// JavaScript Document
// EXECUTED AFTER PAGE FINISHED RENDERING
$(document).ready(function(){

	// VARIABLES DECLARED
	var iDispPnlSelectors = 7; // Number of panels visible at one time.
	var iSliderOffset = 0;
	var iSliderMax = 0;
	var iBtnLdCnt = 0;
	var arrLIs = $("#slideDisp li"); // ARRAY of LIs in 'slideDisp' UL
	var iSlideCnt = arrLIs.length;
	var randPnl = 1;
	var curr = "";
	var dispRandTimer;
	var floaterTxt;
	var sLiReArranged = "";
	var bInitRun = true;
	var imgPnls = new Image();
	var imgPnlCont = new Image();
	var imgArr = new Array();
	var bUsrClick = false;
	var iHoverIndx = 0;
	
	// VARIABLES USED ONLY FOR VISITOR GUIDES RANDOM SPREAD
	var uno = 1;
	var dos = 2;
	var tres = 3;	
	
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	var bIE6 = false;
	var arBrowser = navigator.appVersion.split("MSIE ")
	var iBrowserVer;
	if(arBrowser.length>1){
		iBrowserVer = arBrowser[1].substring(0,1);
		if(iBrowserVer==6){
			$("#navi h2").css({'margin-left': '10px','width': '72px'});
			$("#navi a").css({'margin-left': '10px','margin-right': '0px'});
			
			$("#floaters img").css({'behavior': 'url(_assets/js/iepngfix.htc)', width: '121px', height: '22px'});
			$("#floaters img").first().css({height: '10px'});
			bIE6 = true;
		}
	}
	
	////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	// Hides all slideshow and the floating DIVs.
	$(".box").hide();
	if(!bIE6)
		$("#floaters").css({opacity: 0}).hide();
	else
		$("#floaters").hide();
	
	// Randomizes ARRAY containing all
	// slideshow selection LIs.
	// Generates random number between 0 and ARRAY length.
	// Stores value of current ARRAY position as a temporary (temp) VARIABLE.
	// Gets content from random location in ARRAY and sets into current ARRAY position.
	// Sets stored 'temp' as the value for the random location in ARRAY.
	for (var i=0; i<arrLIs.length; i++){
		var rand = Math.floor(Math.random()*arrLIs.length);
		var temp = arrLIs[i];
		arrLIs[i] = arrLIs[rand];
		arrLIs[rand] = temp;
	}

	// Add LOAD EVENT to empty IMAGE.
	// Increases iBtnLdCnt counter by 1.
	// IF the iBtnLdCnt is the same as the number of slideshow selections..
	// call funcOutputImgPnls FUNCTION to output the slideshow selection images.
	// ELSE call funcBeginImgPnls FUNCTION to load next image in line.
	$(imgPnls).load(function(){
		iBtnLdCnt++;
		if(iBtnLdCnt == iSlideCnt)
			funcOutputImgPnls();
		else
			funcBeginImgPnls();
	});
	
	// call funcBeginImgPnls FUNCTION to load 1st slideshow selection image.
	funcBeginImgPnls();
	
	// FUNCTION to load slideshow selection images only.
	function funcBeginImgPnls(event){
		$(imgPnls).attr("src", "_assets/images/mmslideshow/"+arrLIs[iBtnLdCnt].id+"_btn.gif");
	}

	// FUNCTION to OUTPUT all the slideshow selection components after all panels have been randomized and images loaded.
	function funcOutputImgPnls(event){
		// For each item in the ARRAY, take the values and build them out
		// as LI elements then append at the end of the STRING.
		for (var i=0; i < arrLIs.length; i++){
			sLiReArranged = sLiReArranged + "<li id='"+arrLIs[i].id+"'><p>"+$('#'+arrLIs[i].id+' p').text()+"</p><img src='_assets/images/mmslideshow/"+arrLIs[i].id+"_btn.gif' alt='"+$('#'+arrLIs[i].id+' p').text()+"'></li>";
		}
		
		// Find the UL with the ID of 'slideDisp' and replace it with the
		// same UL enclosing tags and for the enclosed content output the
		// LI string we built on the LOOP above.
		$("<ul id='slideDisp'>"+sLiReArranged+"</ul>").replaceAll('#slideDisp');
		
		// Sets 'curr' VARIABLE to the current selected panel to keep track of current active panel.
		// Add 'notChosen' CLASS to all IMGs in the panel selection LIs.
		// Find the slideshow panel corresponding to the currently selected item and makes it visible.
		// Calls Panel Selection FUNCTION and passes the current panel name as a VARIABLE.
		// Removes unselected style and adds selected style to first panel selection LI.
		curr = arrLIs[0].id;
		$("#slideDisp li img").addClass("notChosen");
		$("#"+curr+"_panel").show();
		fPnlSelect(curr);
		$("#"+curr+" img").removeClass("notChosen").addClass("chosen");
		
		// Enables panel CLICK FUNCTION
		// sets bUsrClick to TRUE to indicate user interaction has taken place.
		// stops auto display TIMER.
		// IF the clicked item is NOT already current...
		// call panel display FUNCTION with current ID as a parameter.
		$("#slideDisp li").click(function(){
			bUsrClick = true;
			clearTimeout(dispRandTimer);
			
			if(this.id!=curr){
				fDispPanel(this.id)
			}
		});
		
		// Adds MOUSELEAVE EVENT LISTENER to hide floating info DIV.
		$("#slideDispMask").mouseleave(function(){
			if(!bIE6)
				$("#floaters").stop().animate({opacity: 0}, 250, function(){$(this).hide()});
			else
				$("#floaters").hide();
		});

		// Adds MOUSEOVER EVENT LISTENER to replace floating info DIV content,
		// change X position, and unhide.
		$("#slideDisp li").mouseover(function(){
			$('<p>' + $("#"+this.id+" p").text() + '</p>').replaceAll('.floater p');
			iHoverIndx = ((funcFindIndex(this.id)-iSliderOffset)*112)+117;
			if(!bIE6)
				$("#floaters").stop().css({left: iHoverIndx}).show().animate({opacity: 1}, 250);
			else
				$("#floaters").css({left: iHoverIndx}).show();
		});
	} // END OF funcOutputImgPnls FUNCTION
	
	// FUNCTION returns index of hovered item in selection panels ARRAY.
	function funcFindIndex(tgt){
		var iIndx = 0;
		for (var i=0; i<arrLIs.length; i++){
			if (arrLIs[i].id == tgt)
				iIndx = i;
		}
		return iIndx;
	}

	// Add LOAD EVENT to empty IMAGE.
	// IF this is the 1st EVENT add the image to the corresponding panel background.
	// ELSE add the image for each additional image in the panel.
	// increase the iBtnLdCnt counter to keep track of which image to load next.
	// IF the iBtnLdCnt is lower than the total number of images in the corresponding panel...
	// load the next image into the empty IMAGE to trigger the LOAD EVENT and loop again when finished.
	// ELSE "Hammer Time" (proceed to reveal panel and animate).
	$(imgPnlCont).load(function(){
		if(iBtnLdCnt == 0)
			$("#"+curr+"_panel img").first().attr("src", $(this).attr("src"));
		else
			$("#"+curr+"_"+iBtnLdCnt).attr("src", $(this).attr("src"));
		iBtnLdCnt++;
		
		if(iBtnLdCnt < imgArr.length)
			$(imgPnlCont).attr("src", "_assets/images/mmslideshow/"+curr+"_"+ iBtnLdCnt +".png");
		else
			funcHammerTime(curr);
	});

	// If the number of panel selection LIs is greater than the number of panels visible at once...
	// set initial scrolling limits.
	// set non changing scrolling limit.
	if (iSlideCnt > iDispPnlSelectors){
		iSliderMax = iSlideCnt - iDispPnlSelectors;
	}

	// SLIDER CLICK FUNCTION
	$("a.slideBtn").click(function(event){
		// stops auto display TIMER.
		// sets bUsrClick VARIABLE true to indicate user interaction has occured.
		// disables default behavious of the ANCHOR tag.
		clearTimeout(dispRandTimer);
		bUsrClick = true;
		event.preventDefault();
		
		// IF sliderRight was clicked and slider hasn't reached right-most limit...
		// shift slide selectors to the left.
		// and add 1 from offset tracker.
		if (this.id == "sliderRight" && iSliderOffset < iSliderMax){
			$("#slideDisp").animate({"margin-left": "-=112px"}, 500);
			iSliderOffset++;
		}
		// ELSE IF sliderLeft was clicked and slider hasn't reached left-most limit...
		// shift slide selectors to the right.
		// and subract 1 to offset tracker.
		else if (this.id == "sliderLeft" && iSliderOffset > 0){
			$("#slideDisp").animate({"margin-left": "+=112px"}, 500);
			iSliderOffset--;
		}
	});
	
	// AUTO DISPLAY FUNCTION
	function dispRand(){
		// stops auto display TIMER.
		// call panel display FUNCTION with current ID as a parameter.
		// increase randPnl counter.
		clearTimeout(dispRandTimer);
		fDispPanel(arrLIs[randPnl].id);
		randPnl++;
		
		// IF the auto panel counter is greater than the max number of panels displayed at once...
		// shift selection panels to the left 112px over .5 seconds.
		// and add 1 from offset tracker.
		if(randPnl > iDispPnlSelectors){
			$("#slideDisp").animate({"margin-left": "-=112px"}, 500);
			iSliderOffset++;
		}
		// ELSE IF the auto panel counter is 1, shift selecting to the left-most position over .5 seconds
		// set offset tracker to the max slider offset value.
		else if(randPnl == 1){
			$("#slideDisp").animate({"margin-left": "0px"}, 500);
			iSliderOffset = 0;
		}
		
		// IF the auto panel counter is greater or equal to the number of panel selectors...
		// reset auto panel counter to 0.
		if(randPnl >= iSlideCnt)
			randPnl = 0;
	}
	
	// PANEL SELECT FUNCTION
	// remove 'chosen' CLASS from previously selected panel selector and ad 'notChosen' CLASS.
	// set 'curr' variable to the currently selected panel ID.
	// remove 'notChosen' CLASS from currently selected panel selector and ad 'chosen' CLASS.
	// call Panel Display FUNCTION with currently selected panel ID as a parameter.
	function fDispPanel(tgt){
			$("#"+curr+" img").removeClass("chosen").addClass("notChosen");
			curr = tgt;
			$("#"+curr+" img").removeClass("notChosen").addClass("chosen");
			
			fPnlSelect(curr);
	}
	
	// PANEL SWITCHING FUNCTION
	// STOPs any anymation on the 'overlay' DIV, unhides element, turns solid over .25 seconds.  Once animation completes...
	// hides ALL content panels.
	// unhides corresponding panel for selected item.
	// attaches all IMGs in selected panel to imgArr ARRAY.
	// resets iBtnLdCnt to start image loading loop from the very 1st IMG ELEMENT.
	// loads background IMG to empty IMG OBJECT to trigger LOAD EVENT once complete.
	function fPnlSelect(tgt){
		$("#overlay").stop().show().animate({opacity: 1}, 250, function(){
			$(".box").hide();
			$("#container #" + tgt + "_panel").show();
			imgArr = $("#" + tgt + "_panel > img");
			iBtnLdCnt = 0;
			$(imgPnlCont).attr("src", "_assets/images/mmSlideShow/"+tgt+"_bg.jpg");
		});
	}
	
	// FUNCTION "Hammer Time" (called after all images for selected 
	// panel have finished loading. Takes selected panel ID as a parameter)
	function funcHammerTime(tgt){
		// IF the user has not interacted with the slideshow, restart the auto display TIMER.
		if(!bUsrClick)
			dispRandTimer=setInterval(dispRand,20000);
				
		// calls panel animation FUNCTION with currently active panel as a parameter.
		// turns 'overlay' DIV complitely transparent over .25 seconds. Once animation completes...
		// hides 'overlay' DIV.
		fPnlAnimation(tgt);
		$("#overlay").animate({opacity: 0}, 250, function(){
			$("#overlay").hide();
			
			// IF this is the 1st run... set z-index of overlay to 40 from 52;
			// and set bInitRun FALSE so this code doesn't execute again.
			if(bInitRun){
				$("#overlay").css({'z-index': 40});
				bInitRun = false;
			}
		});
	}
	
	// PANEL ANIMATION FUNCTION
	// stops all animations on 'narr' DIVs, then shifts them 500px to the left (out of view).
	// stops all animation on ANCHOR tags nested in the 'narr' DIVs, then turns them transparent.
	// executes animation depending on matching panel IDs.
	function fPnlAnimation(tgt){
		$("#"+tgt+"_panel .narr").stop().css({'margin-left': '-500px'});
		
		// Execute if this browser is anything other than IE 6.
		if(!bIE6){
			$("#"+tgt+"_panel .learnMore").stop().css({opacity: 0});

			switch(tgt)
			{
				case "inserts":
					$("#"+tgt+"_1").stop().css({left: '936px', top: '15px', opacity: 0});
					$("#"+tgt+"_2").stop().css({width: 0, height: 0, left: '625px', top: '200px'});
					$("#"+tgt+"_panel .narr p").css({width: '270px'});
					
					$("#"+tgt+"_1").delay(500).animate({left: '320px', opacity: 1},500,function(){
						$("#"+tgt+"_2").animate({width: '450px', height: '310px', left: '500px', top: '75px'},500,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){$("#"+tgt+"_panel .learnMore").animate({opacity:1},250);});
						});
					});
					break;
				case "ibro":
					$("#"+tgt+"_1").stop().css({left: '1100px', top: '5px', opacity: 0});
					$("#"+tgt+"_2").stop().css({left: '-45px', top: '20px'});
					$("#"+tgt+"_3").stop().css({left: '230px', top: '180px', display: 'none', opacity: 0});
					
					$("#"+tgt+"_1").delay(250).css({left: '440px'}).animate({opacity: 1},500,function(){
						$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
							$("#"+tgt+"_panel .learnMore").animate({opacity:1},250);
								$("#"+tgt+"_2").delay(500).animate({left: '870px', top: '282px'},1250);
									$("#"+tgt+"_3").css({display: 'block'}).animate({opacity: 1},500);
						});
					});
					break;
				case "parade":
					$("#"+tgt+"_1").stop().css({left: '400px', top: '400px'});
					$("#"+tgt+"_2").stop().css({left: '936px', top: '100px'});
					
					$("#"+tgt+"_1").delay(500).animate({top: '0px'},400,function(){
						$("#"+tgt+"_2").delay(250).animate({left: '580px'},350,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){$("#"+tgt+"_panel .learnMore").animate({opacity:1},250);});
						});
					});
					break;
				case "sem":
					$("#"+tgt+"_1").stop().css({left: '506px', top: '400px'});
					$("#"+tgt+"_2").stop().css({width: 0, height: 0, left: '761px', top: '94px'});
					$("#"+tgt+"_3").stop().css({left: '375px', top: '200px', display: 'none', opacity: 0});
					
					$("#"+tgt+"_1").delay(500).animate({top: '5px'},500,function(){
						$("#"+tgt+"_2").animate({width: '194px', height: '232px', left: '724px', top: '94px'},500,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
								$("#"+tgt+"_panel .learnMore").animate({opacity:1},250, function(){
									$("#"+tgt+"_3").css({display: 'block'}).animate({opacity: 1},500);
								});
							});
						});
					});
					break;
				case "mobile":
					$("#"+tgt+"_1").stop().css({left: '462px', top: '400px'});
					$("#"+tgt+"_2").stop().css({left: '275px', top: '268px', display: 'none', opacity: 0});
					$("#"+tgt+"_panel .narr p").css({width: '380px'});
					
					$("#"+tgt+"_1").delay(500).animate({top: '15px'},500,function(){
						$("#"+tgt+"_2").css({display: 'block'}).animate({opacity: 1},500,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
								$("#"+tgt+"_panel .learnMore").animate({opacity:1},250);
							});
						});
					});
					break;
				case "oprah":
					$("#"+tgt+"_1").stop().css({left: '936px', top: '0px'});
					$("#"+tgt+"_2").stop().css({left: '440px', top: '400px'});
					
					$("#"+tgt+"_1").delay(250).animate({left: '580px'},350,function(){
						$("#"+tgt+"_2").delay(500).animate({top: '90px'},400,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){$("#"+tgt+"_panel .learnMore").animate({opacity:1},250);});
						});
					});
					break;
				case "meetingpg":
					$("#"+tgt+"_1").stop().css({left: '900px', top: '0px'});
					$("#"+tgt+"_2").stop().css({left: '900px', top: '80px'});
					$("#"+tgt+"_3").stop().css({left: '900px', top: '150px'});
					
					$("#"+tgt+"_1").delay(250).animate({left: '630px'},350,function(){
						$("#"+tgt+"_2").delay(500).animate({left: '500px'},400,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
								$("#"+tgt+"_panel .learnMore").animate({opacity:1},250, function(){
									$("#"+tgt+"_3").css({display: 'block'}).animate({left: '639px'},500);
								});
							});
						});
					});
					break;	
				case "visitorGuides":
					$("#"+tgt+"_1").stop().css({left: '936px', top: '0px'});
					$("#"+tgt+"_2").stop().css({left: '936px', top: '74px'});
					$("#"+tgt+"_3").stop().css({left: '936px', top: '165px'});
					
					$("#"+tgt+"_4").stop().css({left: '936px', top: '0px'});
					$("#"+tgt+"_5").stop().css({left: '936px', top: '36px'});
					$("#"+tgt+"_6").stop().css({left: '936px', top: '133px'});
					
					if(Math.floor(Math.random()*2) == 0){
						uno = 1;
						dos = 2;
						tres = 3;
						
						$("#"+tgt+"_"+uno).delay(250).animate({left: '539px'},350,function(){
							$("#"+tgt+"_"+dos).delay(500).animate({left: '647px'},400,function(){
								$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
									$("#"+tgt+"_panel .learnMore").animate({opacity:1},250, function(){
										$("#"+tgt+"_"+tres).css({display: 'block'}).animate({left: '488px'},500);
									});
								});
							});
						});
					}
					else{
						uno = 4;
						dos = 5;
						tres = 6;
						
						$("#"+tgt+"_"+uno).delay(250).animate({left: '626px'},350,function(){
							$("#"+tgt+"_"+dos).delay(500).animate({left: '468px'},400,function(){
								$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
									$("#"+tgt+"_panel .learnMore").animate({opacity:1},250, function(){
										$("#"+tgt+"_"+tres).css({display: 'block'}).animate({left: '576px'},500);
									});
								});
							});
						});
					}
					break;	
				default:
					$("#"+tgt+"_1").stop().css({left: '510px', top: '400px'});
	
					$("#"+tgt+"_1").delay(500).animate({top: '15px'},500,function(){
						$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){$("#"+tgt+"_panel .learnMore").animate({opacity:1},250);});
					});
			}
		}
		// Else execute THIS for IE 6.
		else{
			$("#"+tgt+"_panel .learnMore").stop().css({'visibility': 'hidden'});
			
			// Adds the IEPNGFIX to all .animated PNGs.
			for(var i=1; i <= $("#"+tgt+"_panel .animated").length; i++){
				$("#"+tgt+"_"+i).css({'behavior': 'url(_assets/js/iepngfix.htc)'});
			}
			
			switch(tgt)
			{
				case "inserts":
					$("#"+tgt+"_1").stop().css({left: '936px', top: '15px'});
					$("#"+tgt+"_2").stop().css({width: 0, height: 0, left: '625px', top: '200px'});
					$("#"+tgt+"_panel .narr p").css({width: '270px'});
					
					$("#"+tgt+"_1").delay(500).animate({left: '320px'},500,function(){
						$("#"+tgt+"_2").animate({width: '450px', height: '310px', left: '500px', top: '75px'},500,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){$("#"+tgt+"_panel .learnMore").css({'visibility': 'visible'});});
						});
					});
					break;
				case "ibro":
					$("#"+tgt+"_1").stop().css({left: '1100px', top: '5px'});
					$("#"+tgt+"_2").stop().css({left: '-45px', top: '20px'});
					$("#"+tgt+"_3").stop().css({left: '230px', top: '180px', visibility:'hidden'});
					
					$("#"+tgt+"_1").delay(250).animate({left: '440px'},500,function(){
						$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
							$("#"+tgt+"_panel .learnMore").css({visibility:'visible'});
							$("#"+tgt+"_2").delay(500).animate({left: '870px', top: '282px'},1250);
							$("#"+tgt+"_3").delay(750).css({visibility:'visible'});
						});
					});
					break;
				case "parade":
					$("#"+tgt+"_1").stop().css({left: '400px', top: '400px'});
					$("#"+tgt+"_2").stop().css({left: '936px', top: '100px'});
					
					$("#"+tgt+"_1").delay(500).animate({top: '0px'},400,function(){
						$("#"+tgt+"_2").delay(250).animate({left: '580px'},350,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){$("#"+tgt+"_panel .learnMore").css({'visibility': 'visible'});});
						});
					});
					break;
				case "sem":
					$("#"+tgt+"_1").stop().css({left: '506px', top: '400px'});
					$("#"+tgt+"_2").stop().css({width: 0, height: 0, left: '761px', top: '94px'});
					$("#"+tgt+"_3").stop().css({left: '375px', top: '200px', visibility:'hidden'});
					
					$("#"+tgt+"_1").delay(500).animate({top: '5px'},500,function(){
						$("#"+tgt+"_2").animate({width: '194px', height: '232px', left: '724px', top: '94px'},500,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
								$("#"+tgt+"_panel .learnMore").css({'visibility': 'visible'});
								$("#"+tgt+"_3").css({display: 'block'}).css({visibility:'visible'});
							});
						});
					});
					break;
				case "mobile":
					$("#"+tgt+"_1").stop().css({left: '462px', top: '400px'});
					$("#"+tgt+"_2").stop().css({left: '275px', top: '268px', visibility:'hidden'});
					$("#"+tgt+"_panel .narr p").css({width: '380px'});
					
					$("#"+tgt+"_1").delay(500).animate({top: '15px'},500,function(){
						$("#"+tgt+"_2").css({visibility: 'visible'});
						$("#"+tgt+"_panel .narr").delay(500).animate({'margin-left': 0},500,function(){
							$("#"+tgt+"_panel .learnMore").css({visibility:'visible'});
						});
					});
					break;
				case "oprah":
					$("#"+tgt+"_1").stop().css({left: '936px', top: '0px'});
					$("#"+tgt+"_2").stop().css({left: '440px', top: '400px'});
					
					$("#"+tgt+"_1").delay(250).animate({left: '580px'},350,function(){
						$("#"+tgt+"_2").delay(500).animate({top: '90px'},400,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
								$("#"+tgt+"_panel .learnMore").css({visibility:'visible'});
							});
						});
					});
					break;
				case "meetingpg":
					$("#"+tgt+"_1").stop().css({left: '900px', top: '0px'});
					$("#"+tgt+"_2").stop().css({left: '900px', top: '80px'});
					$("#"+tgt+"_3").stop().css({left: '900px', top: '150px'});
					
					$("#"+tgt+"_1").delay(250).animate({left: '630px'},350,function(){
						$("#"+tgt+"_2").delay(500).animate({left: '500px'},400,function(){
							$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
								$("#"+tgt+"_panel .learnMore").css({visibility:'visible'});
								$("#"+tgt+"_3").delay(250).css({display: 'block'}).animate({left: '639px'},500);
							});
						});
					});
					break;	
				case "visitorGuides":
					$("#"+tgt+"_1").stop().css({left: '936px', top: '0px'});
					$("#"+tgt+"_2").stop().css({left: '936px', top: '74px'});
					$("#"+tgt+"_3").stop().css({left: '936px', top: '165px'});
					
					$("#"+tgt+"_4").stop().css({left: '936px', top: '0px'});
					$("#"+tgt+"_5").stop().css({left: '936px', top: '36px'});
					$("#"+tgt+"_6").stop().css({left: '936px', top: '133px'});
					
					if(Math.floor(Math.random()*2) == 0){
						uno = 1;
						dos = 2;
						tres = 3;
						
						$("#"+tgt+"_"+uno).delay(250).animate({left: '539px'},350,function(){
							$("#"+tgt+"_"+dos).delay(500).animate({left: '647px'},400,function(){
								$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
									$("#"+tgt+"_panel .learnMore").css({visibility:'visible'});
									$("#"+tgt+"_"+tres).delay(250).css({display: 'block'}).animate({left: '488px'},500);
								});
							});
						});
					}
					else{
						uno = 4;
						dos = 5;
						tres = 6;
						
						$("#"+tgt+"_"+uno).delay(250).animate({left: '626px'},350,function(){
							$("#"+tgt+"_"+dos).delay(500).animate({left: '468px'},400,function(){
								$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){
									$("#"+tgt+"_panel .learnMore").css({visibility:'visible'});
									$("#"+tgt+"_"+tres).delay(250).css({display: 'block'}).animate({left: '576px'},500);
								});
							});
						});
					}
					break;	
				default:
					$("#"+tgt+"_1").stop().css({left: '510px', top: '400px'});
	
					$("#"+tgt+"_1").delay(500).animate({top: '15px'},500,function(){
						$("#"+tgt+"_panel .narr").animate({'margin-left': 0},500,function(){$("#"+tgt+"_panel .learnMore").css({'visibility': 'visible'});});
					});
			}
		}
	}
}); //document.ready

