﻿$(window).load(function() {     
	$("#content .info").hide()  
	$("#content .info:first").show() 	
	$("ul#newSuiteLinks li a:first").css("color", "#e8d497").addClass("activated"); 
	$("ul#newSuiteLinks li:last").css("border", "none"); 
function hideTabs() {       
	$("#content .info").hide()  
	$("ul#newSuiteLinks li a").css("color", "").removeClass("activated"); 
	$("#mainImage .currentImage").css("z-index", "10").removeClass("currentImage").fadeOut("slow");   
}
		
function showTab(whatTab) {
	$(whatTab).css("color", "#e8d497"); 
	var source = whatTab.getAttribute("rel");
	var target = document.getElementById(source);        
	 $(target).fadeIn("slow");            
	var targetImage = "#mainImage #" + source + "Image";     
	$(targetImage).addClass("currentImage");  ;
		if($(targetImage + ".currentImage img").length > 1) {   
			$(targetImage + ".currentImage img").hide();
			$(targetImage).css("z-index", "20").show();             
			loop();
		} else {
		$(targetImage + ".currentImage img").show();
			$(targetImage).css("z-index", "20").fadeIn("slow");
			/*$(targetImage + ".currentImage img").fadeIn("slow");			*/
	} 
}                                                         

$("ul#newSuiteLinks li a").click (
	function() {   
		$.idle(null, 0) 
		if($(this).hasClass("activated")) {
			return false;
			} else {
			hideTabs(); 
			showTab(this); 
			$(this).addClass("activated");
			
				if($("#lightbox").css("display") == "block") {
					$("#tourHolder iframe").remove();                                       				
					setTimeout("$('#lightbox').fadeOut('slow'); $('.tourControls').hide();", 500); 
				if($("#mainImage .currentImage").length > 1 ) {
					$.idle(loop, 5000);  
			} 
			$("li.topLevel").hoverIntent (  			
					function() { /*$("a.slideOpener", this).css("backgroundPosition", "0 -23px"); */$("ul", this).slideDown("fast"); } , 
					function() { $("ul", this).slideUp("fast"); /*$("a.slideOpener", this).css("backgroundPosition", "0 0");*/}
				);
		}

	}	
		
goSifr();
  
return false;					
	}
);   


currentIndx = 0;                        
var suiteImages = new Array(); 
//if($(suiteImages).load == true) {


//}
loop =  function(){    
	var suiteImages = $("#mainImage .currentImage img"); 
		if (suiteImages.length > 1) { 
			for (var i=0; i < suiteImages.length; i++) {     
				$(suiteImages[i]).fadeOut("slow");
			}         
			if (currentIndx < suiteImages.length-1) {
				currentIndx=currentIndx+1;
				$(suiteImages[currentIndx]).fadeIn("slow")  
			} else {
				currentIndx=0;  
			$(suiteImages[currentIndx]).fadeIn("slow");  
}			   
$.idle(loop, 5000);           
}
}   
//$(suiteImages).load(function() { looper2 = setTimeout("loop()", 50) });
$.idle(loop, 5000);  


  

});

