$(document).ready(function(){

var EXIT_MSG = "You are now leaving SquirtSoda.com for a website operated \n by a third party. We do not control, recommend or endorse and \n are not responsible for these sites or their content, products, \n services or privacy policies. Downloading material from certain \n sites may risk infringing intellectual property rights or \n introducing viruses into your system. We recommend that you read \n the privacy policies and terms of these other sites. The \n requested website will open in a new browser window. \n\n Would you like to continue? \n ";
$('a.external').click(function(){
	 if (confirm(EXIT_MSG)) {
		 return true;
	 }
 return false;
 });


$(this).delay(1000,function(){ // delay before animation starts
	$('#container').animate({height: '575px'}, 1000, 'easeOutQuad'); // expand content container height
	$('#roll').animate({height: '0px'}, 900, 'easeOutQuad'); // reduce image height of paper roll
});

$('a.clearScreen').click(function(){ // reverse page load animation when main nav item is clicked
	var hrefLoc = $(this).attr('href'); // store location of link clicked
	$('#container').animate({height: '0px'}, 750, 'easeInQuad'); // reduce height of content container
	$('#roll').animate({height: '113px'}, 750, 'easeInQuad'); // return paper roll to orginal height
	$('#roll').animate({height: '113px'}, 50, // pause to allow IE to catch up
	function(){
		window.location = hrefLoc; // animation is complete, now follow link
	});
	return false; // keep new page from loading until animation is complete

});

$(this).delay(2000,function(){ // delay to allow poster animation to complete
	//alert(document.location.hash);
	
	
	
	if (document.location.hash){
	
	var whatpage = document.location.hash;
	var openIcon;
	
	switch (whatpage)
		{
			case "#home":
				whatpage = 0;
			break;
			case "#calendar":
				whatpage = 1;
			break;
			case "#vehicles":
				whatpage = 2;
			break;
			case "#tshirt":
				whatpage = 0;
			break;
			case "#trip":
				whatpage = 1;
			break;
			case "#girltalk":
				whatpage = 2;
			break;
			case "#cans":
				whatpage = 3;
			break;
			case "#network":
				whatpage = 0;
			break;
			default:
				whatpage = 0;
				window.location.hash = $('a.icon').eq(whatpage).attr("href");
			break;
		};
		
		//whatpage = whatpage.substring(1);
		//alert(whatpage);
	} else {
		var whatpage = 0;
		
		if (iconpage == 1) {
		window.location.hash = $('a.icon').eq(whatpage).attr("href");
		}
		
	}
	
	$('a.icon').eq(whatpage).animate({paddingLeft: '60px'}, 200).attr('style', '').addClass("iconOn");
	
	
	
	$('.iconContent') // expand first content section
		.eq(whatpage)
		.addClass("openCont")
		.addClass("boxOn")
		.css("visibility", "visible").effect("scale", { from: {height: 0, width: 0}, percent: 100, direction: 'both' }, 350);

	if (whatpage == 1){ // workaround for calendar icon on Squirt page
		$('.calBorderOff').removeClass('calBorderOff').addClass('calBorderOn');
		$(this).delay((200),function(){
			$('.noChange').attr('style', ' ');
		});	
	}

});						

$(this).delay((2000),function(){
	iconLinks()
});
	
function iconLinks() {	
	$('a.icon').click(function(){
		
		var whatBox = $('a.icon'); // create array of icon links
		var isBoxOn = $('.iconContent').eq(whatBox.index(this)).attr('class'); // see if current link is already expanded
		
		if (isBoxOn.indexOf("boxOn") ==-1) { // if the current link is not already expanded

			$('a.iconOn').css("paddingLeft", "0px").attr('style', '').removeClass("iconOn"); // remove highlight from preview icon
			
				$('a.icon').eq(whatBox.index(this)).animate({paddingLeft: '60px'}, 200).attr('style', '').addClass("iconOn"); // remove highlight from preview icon
				
				window.location.hash = $('a.icon').eq(whatBox.index(this)).attr("href");
				
				$('.boxOn').each(function(){
					$(this) // collapse current content box
						.removeClass("openCont").fadeOut("fast")
						.removeClass("boxOn"); // remove boxOn class
				});
				
				$('.iconContent')
					.eq(whatBox.index(this)) // expand the content area that matches to new icon
					.addClass("openCont").css("visibility", "visible").effect("scale", { from: {height: 0, width: 0}, percent: 100, direction: 'both' }, 350);
					//.addClass("openCont")
					//.fadeIn("fast");
					
				$('.iconContent') // add boxOn class to the new content area
					.eq(whatBox.index(this))
					.addClass("boxOn");					
			
		} else {
			
			$('a.iconOn').css("paddingLeft", "0px").attr('style', '').removeClass("iconOn");
			$('.boxOn').each(function(){
				$(this) // collapse current content box
					.removeClass("openCont").css("visibility", "hidden")
					.removeClass("boxOn"); // remove boxOn class
			});
		
		};
		
		$(this).delay((200),function(){
			$('.noChange').attr('style', ' ');
		});
		
		// Fire Omniture tags
		
		var iconClasses = $('a.icon').eq(whatBox.index(this)).attr('class'); // see what icon was clicked
		var iconSplit = iconClasses.split(' ');
		var whatLink = iconSplit[1];

		if (whatLink == "iconCalendar"){
			$('.calBorderOff').removeClass('calBorderOff').addClass('calBorderOn');
			
		}

		switch (whatLink)
		{
			case "iconSBB":
				s=s_gi(s_account);
				s.linkTrackVars = "prop5,prop8,eVar8,prop9,eVar9,prop10,eVar10,prop11,eVar12,eVar13,prop28,pageName,channel,events";
				s.linkTrackEvents = "event12";
				s.channel = s.eVar13 = "home";  //Channel (Site Section)	
				s.prop28 = "squirt boom burst";  //level 2 page name
				s.pageName = s.eVar12 = s.channel + ": " + s.prop28 + " - " + "Squirt";  //full page name
				s.prop5 = "Squirt";
				s.prop8 = s.eVar8 = "South West";
				s.prop9 = s.eVar9 = "Squirt";
				s.prop10 = s.eVar10 = "CSDs";
				s.prop11 = s.eVar14 = "NonFlash";
				s.events = s.linkTrackEvents;
				linkName = s.prop28;
				s.tl(this,'o',linkName);				
				break;
			case "iconCalendar":
				s=s_gi(s_account);
				s.linkTrackVars = "prop5,prop8,eVar8,prop9,eVar9,prop10,eVar10,prop11,eVar12,eVar13,prop28,pageName,channel,events";
				s.linkTrackEvents = "event12";
				s.channel = s.eVar13 = "home";  //Channel (Site Section)	
				s.prop28 = "event calendar";  //level 2 page name
				s.pageName = s.eVar12 = s.channel + ": " + s.prop28 + " - " + "Squirt";  //full page name
				s.prop5 = "Squirt";
				s.prop8 = s.eVar8 = "South West";
				s.prop9 = s.eVar9 = "Squirt";
				s.prop10 = s.eVar10 = "CSDs";
				s.prop11 = s.eVar14 = "NonFlash";
				s.events = s.linkTrackEvents;
				linkName = s.prop28;
				s.tl(this,'o',linkName);				
				break;

			case "iconCruiser":
				s=s_gi(s_account);
				s.linkTrackVars = "prop5,prop8,eVar8,prop9,eVar9,prop10,eVar10,prop11,eVar12,eVar13,prop28,pageName,channel,events";
				s.linkTrackEvents = "event12";
				s.channel = s.eVar13 = "home";  //Channel (Site Section)	
				s.prop28 = "street team";  //level 2 page name
				s.pageName = s.eVar12 = s.channel + ": " + s.prop28 + " - " + "Squirt";  //full page name
				s.prop5 = "Squirt";
				s.prop8 = s.eVar8 = "South West";
				s.prop9 = s.eVar9 = "Squirt";
				s.prop10 = s.eVar10 = "CSDs";
				s.prop11 = s.eVar14 = "NonFlash";
				s.events = s.linkTrackEvents;
				linkName = s.prop28;
				s.tl(this,'o',linkName);			
				break;
				
				
			case "iconChicago":
				s=s_gi(s_account);
				s.linkTrackVars = "prop5,prop8,eVar8,prop9,eVar9,prop10,eVar10,prop11,eVar12,eVar13,prop28,pageName,channel,events";
				s.linkTrackEvents = "event12";
				s.channel = s.eVar13 = "boom";  //Channel (Site Section)	
				s.prop28 = "grand prize";  //level 2 page name
				s.pageName = s.eVar12 = s.channel + ": " + s.prop28 + " - " + "Squirt";  //full page name
				s.prop5 = "Squirt";
				s.prop8 = s.eVar8 = "South West";
				s.prop9 = s.eVar9 = "Squirt";
				s.prop10 = s.eVar10 = "CSDs";
				s.prop11 = s.eVar14 = "NonFlash";
				s.events = s.linkTrackEvents;
				linkName = s.prop28;
				s.tl(this,'o',linkName);				
				break;
			case "iconShirt":
				s=s_gi(s_account);
				s.linkTrackVars = "prop5,prop8,eVar8,prop9,eVar9,prop10,eVar10,prop11,eVar12,eVar13,prop28,pageName,channel,events";
				s.linkTrackEvents = "event12";
				s.channel = s.eVar13 = "boom";  //Channel (Site Section)	
				s.prop28 = "squirt boom burst t shirt";  //level 2 page name
				s.pageName = s.eVar12 = s.channel + ": " + s.prop28 + " - " + "Squirt";  //full page name
				s.prop5 = "Squirt";
				s.prop8 = s.eVar8 = "South West";
				s.prop9 = s.eVar9 = "Squirt";
				s.prop10 = s.eVar10 = "CSDs";
				s.prop11 = s.eVar14 = "NonFlash";
				s.events = s.linkTrackEvents;
				linkName = s.prop28;
				s.tl(this,'o',linkName);				
				break;
			case "iconGT":
				s=s_gi(s_account);
				s.linkTrackVars = "prop5,prop8,eVar8,prop9,eVar9,prop10,eVar10,prop11,eVar12,eVar13,prop28,pageName,channel,events";
				s.linkTrackEvents = "event12";
				s.channel = s.eVar13 = "boom";  //Channel (Site Section)	
				s.prop28 = "girl talk";  //level 2 page name
				s.pageName = s.eVar12 = s.channel + ": " + s.prop28 + " - " + "Squirt";  //full page name
				s.prop5 = "Squirt";
				s.prop8 = s.eVar8 = "South West";
				s.prop9 = s.eVar9 = "Squirt";
				s.prop10 = s.eVar10 = "CSDs";
				s.prop11 = s.eVar14 = "NonFlash";
				s.events = s.linkTrackEvents;
				linkName = s.prop28;
				s.tl(this,'o',linkName);				
				break;
			
				
			case "iconCan":
				s=s_gi(s_account);
				s.linkTrackVars = "prop5,prop8,eVar8,prop9,eVar9,prop10,eVar10,prop11,eVar12,eVar13,prop28,pageName,channel,events";
				s.linkTrackEvents = "event12";
				s.channel = s.eVar13 = "boom";  //Channel (Site Section)	
				s.prop28 = "burst of citrus good will";  //level 2 page name
				s.pageName = s.eVar12 = s.channel + ": " + s.prop28 + " - " + "Squirt";  //full page name
				s.prop5 = "Squirt";
				s.prop8 = s.eVar8 = "South West";
				s.prop9 = s.eVar9 = "Squirt";
				s.prop10 = s.eVar10 = "CSDs";
				s.prop11 = s.eVar14 = "NonFlash";
				s.events = s.linkTrackEvents;
				linkName = s.prop28;
				s.tl(this,'o',linkName);				
				break;
			
			default:
				
		};
		
		return false;
		
	});					   
}




});   