Shadowbox.init();
$(document).ready(function () {		
	/* START Background */
	setTimeout
	(
		function()
		{
			jQuery("#teaser #bgblur").fadeIn(1000, function () {
				jQuery('#teaser #bgfocus').hide();
				
				if($.browser.msie){
					$('#series').css({visibility: "visible"});
					$('.promotion').css({visibility: "visible"});
					$('#appfinder').css({visibility: "visible"});
				}
				else{
					$('#series').css({visibility: "visible",display: "none"}).fadeIn(500);
					setTimeout(function() { $('.promotion').css({visibility: "visible",display: "none"}).fadeIn(500); }, 1000); 
					setTimeout(function() { $('#appfinder').css({visibility: "visible",display: "none"}).fadeIn(500); }, 1500); 
				}
				
				
			});
		},
		500
	);
	/* END Background */
	
	/* START STARBUCKS */
	setTimeout(function() {$("#starbucks a").stop(true,false).animate({ height: "393px" }, 600 ); }, 3500);
	setTimeout(function() {$("#starbucks a").stop(true,false).animate({ height: "57px" }, 1000 ); }, 5000);
	//setTimeout(function() {$("a#starbucks").stop(true,false).animate({ height: "57px" }, {duration: 1300,easing: 'easeOutElastic'}); }, 6000);
	

	
	
    $("#starbucks a").mouseover(function(){
		$("#starbucks a").stop(true,false).animate({ 
        height: "393px"
      	}, 600 );
		pageTracker._trackEvent('PoPup', 'onMouseOver', 'Survey');
    }).mouseout(function(){
		$("#starbucks a").animate({ height: "57px" }, {duration: 1300});
    });
	/* END STARBUCKS */
	
	/* START appfinder */
	$('#appfinder input').click(function(){
										 
		var liapp = $("input[name='app']:checked").getCheckboxVal() 
		if (liapp == '') { var liapp = 0;}
		
		/* START APP AJAX */
		$.ajax({
			type: "POST",
			url: "/app-request.cfm",
			data: "liapp="+liapp,
			success: function(html){
			 var arrmodels = html.split(";");		 
			 //ED
			 if(arrmodels[0].split(":")[1] == 0 && $(".ed img").hasClass("large") == true){
				$(".ed .imgwrapper img").animate({ 
						width: "40px",
						height: "50px",
						marginLeft: "100px"
					  }, 500 );
				$(".ed img").removeClass("large");
			 }
			 else if (arrmodels[0].split(":")[1] == 1 && $(".ed img").hasClass("large") == false){
				$(".ed .imgwrapper img").animate({ 
						width: "199px",
						height: "211px",
						marginLeft: "0px"
					  }, 500 );
				$(".ed img").addClass("large");
			 }
			 
			 //FD
			 if(arrmodels[1].split(":")[1] == 0 && $(".fd img").hasClass("large") == true){
				
				$(".fd .imgwrapper img").animate({ 
						width: "40px",
						height: "50px",
						marginLeft: "100px"
					  }, 500 );
				$(".fd img").removeClass("large");
			 }
			  else if (arrmodels[1].split(":")[1] == 1 && $(".fd img").hasClass("large") == false){
				$(".fd .imgwrapper img").animate({ 
						width: "199px",
						height: "211px",
						marginLeft: "0px"
					  }, 500 ); 
				$(".fd img").addClass("large");
			 }
			 
			 //FED
			 if(arrmodels[2].split(":")[1] == 0 && $(".fed img").hasClass("large") == true){
				
				$(".fed .imgwrapper img").animate({ 
						width: "64px",
						height: "50px",
						marginLeft: "120px"
					  }, 500 );
				$(".fed img").removeClass("large");
			 }
			  else if (arrmodels[2].split(":")[1] == 1 && $(".fed img").hasClass("large") == false){
				$(".fed .imgwrapper img").animate({ 
						width: "268px",
						height: "211px",
						marginLeft: "0px"
					  }, 500 ); 
				$(".fed img").addClass("large");
			 }

			 //FP
			 if(arrmodels[3].split(":")[1] == 0 && $(".fp img").hasClass("large") == true){
				
				$(".fp .imgwrapper img").animate({ 
						width: "64px",
						height: "50px",
						marginLeft: "122px"
					  }, 500 );
				$(".fp img").removeClass("large");
			 }
			  else if (arrmodels[3].split(":")[1] == 1 && $(".fp img").hasClass("large") == false){
				$(".fp .imgwrapper img").animate({ 
						width: "270px",
						height: "211px",
						marginLeft: "0px"
					  }, 500 ); 
				$(".fp img").addClass("large");
			 }
			 
			 
	   		if ($(".ed img").hasClass("large") == false && $(".fd img").hasClass("large") == false && $(".fed img").hasClass("large") == false && $(".fp img").hasClass("large") == false){
				$('#dialog').show();
				$('#modal').show();
				}
			
			 
			}
			
			});
			/* END APP AJAX */

		});
	/* END appfinder */

});

jQuery.fn.getCheckboxVal = function(){ 
    var vals = []; 
    var i = 0; 
    this.each(function(){ 
        vals[i++] = jQuery(this).val(); 
    }); 
    return vals; 
}
