HERSHEYS.Icebreakers = {};

HERSHEYS.Icebreakers.initializations = {
	
	'icebreakers' : function(){
		
			/************************************************************/
			/* ICE PODS */
			//var flashvars = {xmlPath : '/xml/icebreakers-homepage.xml'};
			//var attributes = {};
			//var param = {wmode : 'transparent'};

			//swfobject.embedSWF("/assets/swf/icebreakers/Menu.swf", 
								//"flash_wrap", "100%", "100%", "10.0.0", 
								//"assets/swf/expressInstall.swf",flashvars, param, attributes);	
									
			/* END ICE PODS */
			/*************************************************************/
			
			/*************************************************************/
			/* CAROUSEL */
			
			HERSHEYS.Carousel.init({
				slideDistance : 320
			});

			var bgImageClass = 'bg-coolmind'; 

			$(HERSHEYS.Carousel).bind("SlideComplete", function(data, which){

				var newItem = $(which).parent();

				/* Add class to override background image / color */
				var bgClass = 'bg-'+newItem.attr('title');
				$('body').removeClass(bgImageClass).addClass(bgClass);
				bgImageClass = bgClass;


				if (newItem.hasClass('special-bg')){		
					newItem.parents('li').addClass('special-bg');
				}

			}).bind('SlideStart', function(data, which){

				var newItem = $(which).parent();
				newItem.parents('.carousel').find('li.special-bg').removeClass('special-bg');	
			});			
			
			/* END CAROUSEL */
			/*************************************************************/
	},
	'icebreakers/our-story' : function(){
		
		// our story scroll
	/*	$(".scroller").simplyScroll({
			className: 'vert',
			horizontal: false,
			frameRate: 20,
			speed: 5
		}); */
		
	},
	'icebreakers/mint-products' : function(){
	    HERSHEYS.TabbedBrowsing.init();

	    $(HERSHEYS.TabbedBrowsing).bind('NewItemShowing', function (e, data) {

	        var productName = $(data).attr('title');

	        HERSHEYS.Analytics.doProductView(productName);

	    });
	},
	'icebreakers/frost-products' : function(){
	    HERSHEYS.TabbedBrowsing.init();
	    $(HERSHEYS.TabbedBrowsing).bind('NewItemShowing', function (e, data) {

	        var productName = $(data).attr('title');

	        HERSHEYS.Analytics.doProductView(productName);

	    });
	},
	'icebreakers/sours-products' : function(){
	    HERSHEYS.TabbedBrowsing.init();
	    $(HERSHEYS.TabbedBrowsing).bind('NewItemShowing', function (e, data) {

	        var productName = $(data).attr('title');

	        HERSHEYS.Analytics.doProductView(productName);

	    });
	},
	'icebreakers/cubes-products' : function(){
	    HERSHEYS.TabbedBrowsing.init();
	    $(HERSHEYS.TabbedBrowsing).bind('NewItemShowing', function (e, data) {

	        var productName = $(data).attr('title');

	        HERSHEYS.Analytics.doProductView(productName);

	    });
	},
	'icebreakers/gum-products' : function(){
	    HERSHEYS.TabbedBrowsing.init();
	    $(HERSHEYS.TabbedBrowsing).bind('NewItemShowing', function (e, data) {

	        var productName = $(data).attr('title');

	        HERSHEYS.Analytics.doProductView(productName);

	    });
	}
}

HERSHEYS.Utility.doPageInits(HERSHEYS.Icebreakers.initializations);

$(document).ready(function(){
	
	/* Wire up search result button to field and search result page. */
	HERSHEYS.Utility.stealSearchButton({
		'site' : 'icebreakers'
	});
	
	/* Enable leaving notice binding */
	HERSHEYS.Utility.leavingNotice({
		'transparency' : HERSHEYS.transparency,
		'title' : 'ICEBREAKERS'
	});
	HERSHEYS.ShareThis.init();
	
});


