/*
 * Controller.js
 * This file should init any custom plugins(found in plugins.js) and "control" the flow/load order and all js functionality of this project.
 * 
 * The object literal below emulates the structure of your site based on the body IDs and classes, much like views/actions in a MVC 
 * architecture such as cakePHP or rails.
 */

/* Call the init for the obj-literal organized code */
(function($){
	
	//$('html').removeClass('no-js');

	GATORADEUK = {
		"common" : {
			init:function() {
				//urchinTracker();
			},
			finalize:function() {
				if( $('.modal_trigger').length )
					$('.modal_trigger').createModalTrigger({ windowCSSClass:'legal_text' });
				
				EVENTS.createBackButtons();
				EVENTS.createPrintButtons();
				EVENTS.createNavHover();
			}
		},
		"home" : {
			init:function() { EVENTS.startSWFHero('theme/flash/v4_homepage.swf'); } 
		},
		"events" : {
			init:function() {
				log("GATORADEUK.events.init");
				CALENDAR.init('data/events.json');
				//EVENTS.startHeroRotator();
				$('#rotator img').click( function() { $('#rotator').cycle('toggle'); });
			}
		},
		"heritage" : { 
			init:function() { EVENTS.startHeroRotator(); }
		},
		"products" : {
			init:function() { log("GATORADEUK.products.init"); },
			//product_detail:function() { PRODUCTS.init('data/products_json.txt'); },
			//blackcurrant:function() { EVENTS.startProductCarousel({ num_items:3 }); },
			//orange:function() { EVENTS.startProductCarousel({ num_items:2 }); },
			//lemon:function() { EVENTS.startProductCarousel({ num_items:3 }); }
			prime:function() { EVENTS.startProductCarousel({ num_items:2 }); },
			perform:function() { EVENTS.startProductCarousel({ num_items:3 }); },
			recover:function() { EVENTS.startProductCarousel({ num_items:1 }); }
		}
	};
	
	log('FILE_LOADED: controller.js');
	UTIL.init( GATORADEUK );
	
})(jQuery);
