/* 
	init.js
	===============================================================
	Wellington on a Plate
	Calls Functions
	
	Last Updated: See SVN	
	
	#t-* used to apply template level override of shared styles
	#st-* used to apply sub template level override of shared styles	
	
	Note that jQuery uses the jQuery shortcut (rather than $)
	to prevent conflicts with Prototype which is used by the backend.	
	
	To sort, search for '@'		
	Debugging is via the Firebug console: console.debug	
  ===============================================================
*/

/*	
	@ jQuery(document).ready
  ---------------------------------------------------------------
	Functions to initialise when the DOM has loaded
	_______________________________________________________________
*/	

	var isHiFi = false;
	var platform = '';
	
	jQuery(document).ready(
		function() 
		{						
			// variables					
		
			jQuery.globals = {};		
			
			jQuery.globals.isHiFi = false;		
			jQuery.globals.isFirefox15up = false;		
			jQuery.globals.isFirefox2 = false;
			jQuery.globals.isFirefox3up = false;
			jQuery.globals.isIE6 = false;				
			jQuery.globals.isIE6up = false;		
			jQuery.globals.isSafari3down = false;
			jQuery.globals.isSafari3up = false;		
			jQuery.globals.isSafari4up = false;
	
			jQuery.globals.isHiFi = detect_browser();
			platform = detect_platform();
			
			if (jQuery.globals.isHiFi)
			{						
				// variables										
				
				jQuery.globals.template_id = jQuery('body').attr('id');			
				
				// function calls		
					
				// non-template-specific function calls		
				
				hover_states_incl_preload( jQuery('#plate-nav, #home-nav').find('img') );	
								
				if ( ( jQuery.globals.isSafari3up ) && (platform == 'win') )
				{
					load_stylesheet('/resources/ui/styles/imported/browser/screen-win-safari.css');
				}
				if ( ( jQuery.globals.isSafari3up ) && (platform == 'mac') )
				{
					load_stylesheet('/resources/ui/styles/imported/browser/screen-mac-safari.css');
				}
				
				// Google maps
				
				if ( jQuery('#t-event .map-trigger, #t-restaurant .map-trigger').length > 0 ) {
					if ( jQuery('#map2').length < 1 )
					{
						jQuery('#content').append( '<div id="map2" class="google-map-container"></div>' );
					}
					PWT_Events_Map.init( window.pwt_map_data ); 
					jQuery('.map-trigger').click(function() {
																								PWT_Events_Map.popup();
																								return false;
																								});
				}	
				
				
				
			} // end isHiFi
		}
	);