/* Release 5.2 */

	// © Copy right United Airlines Inc.
	// Homepage Resource Control
	// S. Smull, S. Davis, N. Ziyad Phd.
	//update 10/30/2009 SHD for iframe pixels
	var selectedSection = "HP";
	var maImg="/ual/asset/hdg_UnitedNews.gif";
	//the var HR_ER_mode is set if the HP is delivered in ER mode. Used to turn off components
	if(typeof HP_ER_mode == 'undefined'){ var HP_ER_mode = false;}
	var writeSWNprotocol = (document.location.protocol == 'https:') ?'https' : 'http';
	
	// aff -->
	var affOn=true;
	var sbsTimes=true;
	var vsAffSwitch='F';
	var affType=1;
	//insert intl text here
	var affCtryCode='us';
	var affText1='Search flights';
	var affText2='Book with miles';
	var affAwardFare='Award travel fees up to USD 100.00';
	var affPass0Msg='Please review the number of passengers and revise the entry if necessary.';
	var affPass10Msg='The maximum passengers per itinerary is 9. Please revise your entry.';
	var affMore1='Upgrades, promotions, class, nonstops...';
	var affMore2='Service class, Maximum stops';
	var affTripType=2;
	var ualhpdatedummy;
	// end aff -->
	var bFlashActive = true;
	String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/gi,"") };
	
	function ff30popup(wURL,varToPass) 
	{
		window.open(wURL+varToPass,"ff29","width=550,height=400,top=20,left=20,menubar=no,status=no,toolbar=no,resizable=yes,scrollbars=yes")
	}
	
	//Start DOM Ready Function
	var divstofade; //global scope variable , creating array of objects to apply the fade
 
	
	$(document).ready(function(){
		divstofade = $('.hpDivsToFade'); //find the 2 divs with class of xx
		document.getElementById('fade1').style.backgroundColor = "";
		document.getElementById('fade2').style.backgroundColor = "";
		document.getElementById('fade1').style.backgroundColor = "#ffffff";
		document.getElementById('fade2').style.backgroundColor = "#ffffff";
		
		
		//START - FSN Auto-suggest && Calendar Changes
		try {																										
			document.body.onclick = function(e) {
				if(document.getElementById('dp-popup') && (document.getElementById('dp-popup').style.display == 'block')){
						closeCal(e);
				}
				if( document.getElementById('iframe') && (document.getElementById('iframe').style.display == "block" )){
					documentOnclickForAutosuggest(); // implemented in autoSuggestSuggestion.js
				}
			}
			// include AutoSuggets  && Calendar Files
			$.ajax({ type: "GET", 
				 url: "http://www.united.com/ual/asset/autoSuggest.js", 
				 dataType: "script",
					success: function()
					{
						$.ajax({ type: "GET",
						url: "http://www.united.com/ual/asset/autoSuggestSuggestion.js", 
						dataType: "script", 
						cache: false, 
						success: function(){  
							 readyAutosuggest(); // implemented in autoSuggestSuggestion.js
								 $.ajax({ type: "GET", 
								 url: "http://www.united.com/ual/asset/date_bimonth.js", 
								 dataType: "script",
									success: function()	{
										 $.ajax({ type: "GET", 
										 url: "http://www.united.com/ual/asset/populate_bimonthcal1.js", 
										 dataType: "script",
											success: function()	{
											 calendarReady();
												function calendarReady() {
													if($.browser.safari) { $('.date_text').attr('size','12'); }			
													$(window).bind('resize', function() {
														$('#dp-popup').css('display','none');	 
														resizeAutosuggest(); // function inpmenented in autoSuggestSuggestion.js	
													});
												
													if(window.ualhpdate) {
														todaysBimonthDate= new Date(ualhpdate); 
													} else {
														todaysBimonthDate= new Date(ualhpdatedummy);
													}
												
													shop_depart[0] = (new Date(todaysBimonthDate).zeroTime()).addDays(14);	
													shop_arrive0  = (new Date(todaysBimonthDate).zeroTime()).addDays(21);
													jspPage = false;
													roundTrip = true;
													homePageCheck = false;
													
													displayHPdefaultDates();
													
													$('.date-pick').bind('focus', function(e) { onFocusCall(this,"homepage"); });	
													$(document).bind( 'keydown', function(event) { handleEscTab(event); }); 
													$('#dp-popup').bind('click', function(e) {textboxFocus = true; });				
													$('.date-pick').bind('click', function(e) { onClickCal(this); });
													$('.date-pick').bind('keyup', function(e) { handleEditDate(this); });	
													$('#link_nav_prev').bind('click', function(e){ displayPrevMonth(); });
													$('#link_nav_next').bind('click', function(e){ displayNextMonth(); });
													$('#dp-link-close').bind('click', function(e){ closePopUp(dateId); });

												}
											
											}
											});
								
									}
									});
						}});
					}
			});
															
		}
		catch(exception)
		{
			//do nothing
		}
		//END- FSNE Part1 Auto-suggest && Calendar Changes
		
		$('#topLoginUserID').css("color",($('#topLoginUserID').val() == 'MileagePlus # or email address' ? "#666":"#333"))
		
		$('#topLoginUserID')
		.focus(function(){
			if ($(this).val() == 'MileagePlus # or email address'){
				$(this).val('');
				$(this).css("color","#333");
			}
		})
		.blur(function(){
			if ($(this).val() == ''){
				$(this).val('MileagePlus # or email address');
				$(this).css("color","#666");
			}
		});
		
		var e=$("#topLoginUserPass_text");
		var c=$("#topLoginUserPass_password");
		e.focus(function(){
			$(this).css({display:"none"});
			c.css({display:"block"});
			c.focus();
			$(this).val("")
		});
		c.blur(function(){
			if($(this).val()=="")
			{
				e.val("Password");
				$(this).css({display:"none"});
				e.css({display:"block"})
			}
		});
		if(c.val()==""){
			e.css({display:"block"});c.css({display:"none"})
		}
		else{
			e.css({display:"none"});
			c.css({display:"block"})
		}
		
		//	Start HP News
			if (window.ualhpNews)
			{
				var newsReel = "";
				for(ij=0;ij<ualhpNews.length;ij++) {
					if(ualhpNews[ij].length>3) {
					  var ualColor = String(ualhpNews[ij][4]).trim();
						if(ualColor.length==7 || ualColor.substr(0,1)=="#") {
						  newsReel += '<li style="line-height: 1.6;"><a class="fs11 newsItem" href="'+ualhpNews[ij][3]+'" style="color: '+ualColor+' !IMPORTANT;">'+ualhpNews[ij][2]+'</a></li>';
						} else {
						  newsReel += '<li style="line-height: 1.6;"><a class="fs11 newsItem" href="'+ualhpNews[ij][3]+'">'+ualhpNews[ij][2]+'</a></li>';
						}
					} else {
						newsReel += '<li style="line-height: 1.6;"><a class="fs11 newsItem" href="'+ualhpNews[ij][3]+'">'+ualhpNews[ij][2]+'</a></li>';
					}
				}
 
				if($.browser.msie && parseInt($.browser.version.substr(0,1))<7) {
					$('#unitedNewsContent').append('<div class="carret" style="padding-left: 0px !IMPORTANT; padding-right: 4px !IMPORTANT; margin-left: 5px !IMPORTANT;"><ul>'+newsReel+'</ul></div>');
				} else {
					$('#unitedNewsContent').append('<div class="carret" style="padding-left: 0px !IMPORTANT; padding-right: 4px !IMPORTANT; margin-left: 10px !IMPORTANT;"><ul>'+newsReel+'</ul></div>');
				}
			}  // end If (window.ualhpNews)
				
 
		
		//determine login state
	
		if (isDefined(myCookies['rememberProfile'])&& isDefined(myCookies['isSecure']) && myCookies['isSecure']=="true") {
				var parsedValue=unescape(myCookies['rememberProfile']).split("||");
				
				var mpiNumber=parsedValue[0];
				var firstName=parsedValue[1]; //gets updated below
				var lastName=parsedValue[2]; //gets updated below
				var mpLevel=parsedValue[3];
				var mpBal=parsedValue[4];
				var homeArpt=parsedValue[5];
				
				if (isDefined(myCookies["mpInformation"])){
				
					var profile=myCookies["mpInformation"];
					profile = unescape(profile); 
					var parsedValue=profile.split("||");
					var prefix=parsedValue[0];
					var firstName=parsedValue[1];
					var middleinit=parsedValue[2];
					var lastName=parsedValue[3];
					var suffix= parsedValue[4];
					//				var emlErrFlg = parsedValue[5];
					//				var addrErrFlg = parsedValue[6];
				}
				var strFirstAndLastName=firstName+lastName;
				if(strFirstAndLastName != "")
				{
					if(document.getElementById("nameHold"))
						{
							if (strFirstAndLastName.length <= 30 && (firstName.length<=15 && lastName.length<=15))
							{
								// write both
								document.getElementById("nameHold").innerHTML = firstName+' '+lastName;
								document.getElementById("forHold").innerHTML = 'for ';
							}
							else
							{
								if (firstName.length<=15)
								{
									// write first
									document.getElementById("nameHold").innerHTML = firstName;
									document.getElementById("forHold").innerHTML = 'for ';
								}
							}
							if (firstName.length>15)
							{
								// remove "for"
								document.getElementById("nameHold").innerHTML = firstName;
							}
						}
				}
				if (mpLevel != "" && mpBal != "")
				{
					document.getElementById('mpLevelHold').innerHTML = '<nobr>'+mpLevel+' <span style="color:#999;"> | </span> </nobr><nobr>Miles: '+mpBal.commafy()+'</nobr>';
				}
				//hide the MP login and guest login divs
				document.getElementById("mileagePlus_login").style.display = "none";
				document.getElementById("joinMPcontainer").style.display="none";
				document.getElementById("mploggedin").style.display = "block";
				document.getElementById("mpLoggedinContainer").style.display="block";
		
				$('.cio_whichLogin').remove();
				$('#ci_logged').show();
				$('#checkInContent').hide();
				$('#myitins').attr("href","https://www.ua2go.com/ci/DoLogin.jsp?return_to=itins");
				$('#myitins2').attr("href","https://www.ua2go.com/ci/DoLogin.jsp?return_to=itins&navSource=HP07&linkTitle=a22myitineraries");
				$('#loginSwap1').attr("href","https://www.ua2go.com/ci/Login.jsp?return_to=itins&navSource=Dropdown07&linkTitle=itineraries");
				$('#loginSwap2').attr("href","https://travel.united.com/etc/webcheckin/listPnr.do?navSource=Dropdown07&linkTitle=checkin");
				var divHite = $('div.col3').height();
				if (divHite < 446) $('div.col3').height(446);
		} else 
		{  //display  log in
				document.getElementById("mploggedin").style.display = "none";
				$("#ci_cc").click(function() {
					$('#ci_tktNumber #label_searchValueId').html('Credit card #');
					$('#ci_searchValueId').attr('maxlength', 19)
					$('#ci_searchValueId').attr('value', '')
				});
				$("#ci_pnr").click(function() {
					$('#ci_tktNumber #label_searchValueId').html('Confirmation or e-ticket number');
					$('#ci_searchValueId').attr('maxlength', 14);
					$('#ci_searchValueId').attr('value', '')
				});
				if (isDefined(myCookies["rememberME"])) {
					switch (myCookies["rememberME"]) {
						case "E":
							if (isDefined(myCookies["rememberEMAIL"])) {
								$('input.userId').val(myCookies["rememberEMAIL"]);
								$(".remMP").check();
								document.topLogin.userId.value=myCookies["rememberEMAIL"];
							}
						break;
					
						case "M":
							if	(isDefined(myCookies["getMP"])) rememberMP = myCookies["getMP"];// *.united.com
							else if	(isDefined(myCookies["rememberMP"])) rememberMP = myCookies["rememberMP"];// ua2go.com
							if (isDefined(rememberMP)) {
									$('input.userId').val(rememberMP);
									$(".remMP").check();
									document.topLogin.userId.value=rememberMP;
								}
							break;
					}	
				}
				$('#loggedout').show();
				document.getElementById("mpLoggedinContainer").style.display="none";
				document.getElementById("mileagePlus_login").style.display = "block";
				document.getElementById("joinMPcontainer").style.display = "block";
				$('#ci_logged').hide();
				$('#checkInContent').show();
		}
		
		try { 
			 $.getScript("/ual/asset/hpMenuArr.js", function() {
				writeSWNav2(0);
			}); 		
			$.ajax({
				type: "GET", url: "/ual/asset/ff30FlightStatus.html", dataType: "html", cache: false,
				success: function(thePage){ 
					$('#ff29pane3').append(thePage); 
					$('#ff29pane3').css('display','none');
					$('#flightStatusSelect').append(ff29FlightStatusOptions); 
					document.forms.FlightStatus.reset();
					if(ff29mode==3) { ff29click(3); }
				}
			});
			requiredMajorVersion = 8; //over-ride this variable constant in DetectBrowser.js from 6 forcing 8 SHD 2/15/2010
			var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
			var ieOld = false;
			if($.browser.msie){
				if(parseInt($.browser.version.substr(0,1)) < 7) {
					ieOld = true;
					//alert("old browser detected"+ $.browser.version);
				}
			}
				
			if(hasRightVersion && !ieOld) {  // if we've detected an acceptable version
			//if (1 == 0) { //disable all flash here
				bFlashActive = true;
				$.getScript("/ual/asset/AC_RunActiveContent1.7.js", function() {
					AC_FL_RunContent( 
					'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
					'width','258',
					'height','350',
					'id','FS9slideshow_flash8_v7',
					'align','middle',
					'src','/ual/asset/FS9slideshow_flash8_v7',
					'quality','high',
					'bgcolor','#ffffff',
					'name','FS9slideshow_flash8_v7',
					'pluginspage','http://www.macromedia.com/go/getflashplayer',
					'movie','/ual/asset/FS9slideshow_flash8_v7',
					'wmode','transparent',
					'menu','false',
					'FlashVars', 'xmlsrc=/ual/asset/fs9.xml', 'AllowScriptAccess', 'always', 'content','true');   // embed the flash movie
				});
			} else {  // flash is too old or we can't detect the plugin
				$.ajax({ 
					type: "GET", 
					url: "/ual/asset/fs9.xml",  
					dataType: "xml",
					cache: false, 
					success: function(xml){
						NoFlashCenterTile(xml);
					},
					error: function(XMLHttpRequest, textStatus, errorThrown){
						$('#hpCenterTile').html('<a href="http://www.united.com/FS9alternate"><img src="http://www.united.com/ual/asset/FS9alternate.jpg" width="258" height"350" border="0"></a>');
						$('.hpDivsToFade').css('backgroundColor', "72a4d8");
					}
				});
			}
			if ($.browser.msie && !ieOld) {
				$("#hpCenterTileImage").html('<a href="http://www.united.com/FS9alternate"><img src="http://www.united.com/ual/asset/FS9alternate.jpg" width="258" height="350" border="0"></a>');
			}
			$.ajax({ type: "GET", url: "/ual/asset/ff30BookWithMiles.html", dataType: "html", cache: false, success: function(thePage){ $('#affAwdSrchOpts').append(thePage); $('#affAwdSrchOpts').css('display','none'); 
			
				$.ajax({ type: "GET", url: "/ual/asset/ff30VacationsTopHalf.html", dataType: "html", cache: false, success: function(thePage){ $('#ff29pane1sub4a').append(thePage); $('#ff29pane1sub4a').css('display','none'); 
					$.ajax({ type: "GET", url: "/ual/asset/ff30VacationsBottomHalf.html", dataType: "html", cache: false, success: function(thePage){ $('#ff29pane1sub4b').append(thePage); $('#ff29pane1sub4b').css('display','none'); 
						$.ajax({ type: "GET", url: "/ual/asset/ualFooter.html", dataType: "html", cache: false, success: function(thePage){ $('#unitedFooter').append(thePage); } });
		
						//load vo tiles
						$.getScript("/ual/asset/vo_tiles.js", function(){
							$("#divVOtiles").show(); $('#topSlot').children().css('border','0px'); 
							if($.browser.msie) {
								if($.browser.version.substr(0,1) > 6) {
									$('.voCopy').css("padding-left","6px");
								}
							}
							tagLinks();
							
							
							if (getCookie("homeArpt")) 
							{ 
								document.getElementById('shop_from0').value=getCookie("homeArpt");
								document.getElementById("vacationO").value=getCookie("homeArpt");
							}
							//build the request for hp iframe for pixel tracking
							//pass required parameters to the iframe query string
								var uValue = escape(document.location);
								var rValue = escape(document.referrer);
								var iframeQstr = "curLoc="+uValue+"&refLoc="+rValue;
 
								$(document.body).append('<IFRAME id="unitedMediaplex" name="mediaplexUnited" src="http://www.united.com/ual/asset/hp_mediaplexunited.html?'+iframeQstr+'" width="0" height="0" frameborder="0" ></iframe>');
									$('iframe#unitedMediaplex').load(function() {
										//do nothing on load
									});
							//capture the click event of links that are not javascript 	
							$('a[href]').not('a[href^=javascript]').not($('a[target=_blank]')).click(function(evt){
								//evt.preventDefault();
								$.fx.off = true ; //kill all animation on jQuery objects
								if (typeof removeFlash != "undefined") {
									removeFlash(); 
								}
								//alert('updated click captured.');
							});
						});
						if(ff29mode==3) { ff29click(3); }
					} });
				} });
			} });
			
			// includes Check-In tab 
			try {
				
						$.ajax({ type: "GET",
						url: "http://www.united.com/ual/asset/hpCheck-in.js", 
						dataType: "script", 
						cache: false, 
						success: function(){  
							$.ajax({ type: "GET",
							url: "http://www.united.com/ual/asset/MyItin_global_2010.js", 
							dataType: "script", 
							cache: false, 
							success: function(){ 
							//$('#ff29pane2').append(thePage); 
							$('#ff29pane2').css('display','none'); 
							
							// Added for ECO Redesign June Rel-4.7 
							var gotMPno = null;
							rememberME = getCookie("rememberME");
							
							if (rememberME!= undefined && rememberME=="E") {
								gotMPno = getCookie("rememberEMAIL");
							}
							if (rememberME!= undefined && rememberME=="M") {
								gotMPno = getCookie("getMP");
							}
							
							if (gotMPno != null) {
								$('input:text[class="ecohpCheckin_MpNumber"]').attr('value', gotMPno);	
								document.getElementById('remMP').checked=true;
								$('input:password[class="ecohpCheckin_Password"]').attr('value', '');
								$('input:text[class="ecohpCheckin_MpNumber"]').css('color', 'black');
								$('input:password[class="ecohpCheckin_Password"]').css('color', 'black');
							} else {
								$('input:text[class="ecohpCheckin_MpNumber"]').attr('value', 'Mileage Plus # or email address');
								$('input:password[class="ecohpCheckin_Password"]').attr('value', 'Password');
								$('input:text[class="ecohpCheckin_MpNumber"]').css('color', 'gray');
								$('input:password[class="ecohpCheckin_Password"]').css('color', 'gray');
							}
					
					} });
				}});
			
				
			}
			catch(exception)
			{
				//do nothing
			}
			
			$('#unitedBenefits').show(); 
			
			
			if (showToolTips==1) {
				$('#ci_gli a').Tooltip({ 
					track: true, 
					delay: 0, 
					showURL: false, 
					showBody: " - ", 
					opacity: 0.90 
				});
			}
		} 
		catch(exception) 
		{
			// Do Nothing for now on exceptions
			//alert("Caught an exception!\n\n"+exception);
		}
		
		// write timestamp @ footer
		var futdate = new Date();
		var expdate = futdate.getTime();
		$('footerTimestamp').append('<img src="http://www.united.com/ual/asset/vstesthp.gif?timestamp='+expdate+'" border="0" width="1" height="1">');
		
		$('div.col3').css('padding', 5);
		$('#myItinsEmplCheckin').addClass('dashTop');
		document.getElementById("flightSRC").selectedIndex = 0; // 229
		document.getElementById("flightCNN").selectedIndex = 0; // 229 
 
		// these may be obsolete SHD 3-25-2010
		ff29tabs[3].src = "http://content.united.com/ual/asset/hp30_tab_CI_off.gif";
		ff29tabs[4].src = "http://content.united.com/ual/asset/hp30_tab_CI_off.gif";
		ff29tabs[5].src = "http://content.united.com/ual/asset/hp30_tab_CI_off.gif";
		ff29tabs[6].src = "http://content.united.com/ual/asset/hp30_tab_CI_off_roll.gif";
		ff29tabs[7].src = "http://content.united.com/ual/asset/hp30_tab_CI_off_roll.gif";
		
		
		//capture the enter event of certain forms on the page
		$('#topLogin, #cio_MP, #authForm3, #FlightStatus ').keypress(function(event) {
			if (event.keyCode == '13') {
				event.preventDefault();
				switch(this.id) {
					case "topLogin" :
						//if (ValidateUserId(this)) {
						if (ValidateUserIdHome(this)) {
							if (typeof removeFlash != "undefined") {removeFlash(); };
							this.submit()
						}
					break
					case "cio_MP" :
						if (ValidateUserId2(this)) {
							if (typeof removeFlash != "undefined") {removeFlash(); };
							this.submit()
						}
					break
					case "authForm3" :
						if (ecodlSubmit3(this)) {
							if (typeof removeFlash != "undefined") {removeFlash(); };
							this.submit()
						}
					break
					case "FlightStatus" :
						if (verify(this)) {
							if (typeof removeFlash != "undefined") {removeFlash(); };
							this.submit()
						}
					break
				}
			}
		});
		
		
		
	}); // End of DOM Ready Function
	
function chkBrs(sInp) {
	var sUA=navigator.userAgent.toLowerCase();
	var bFound=sUA.indexOf(sInp) +1;
	return bFound;
}
 
function chkBrows(sInp) {
	var sUA=navigator.userAgent.toLowerCase();
	var bFound=sUA.indexOf(sInp) +1;
	return bFound;
}
			
$.fn.check = function() {
	return this.each(function() {
		this.checked = true;
	});
};
 
function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}
 
// JavaScript Document
var environment = "PRODUCTION"; //change this when placing in PRODUCTION ENVIRONMENT
var currentUALsite = "US-EN";
 
StartinSelectLst = new Array();
StartinSelectLst[0] = new Array("My mileage summary","&return_to=mpsummary_us","SI~MP");
StartinSelectLst[1] = new Array("My itineraries","&return_to=newitin_us","IC");
StartinSelectLst[2] = new Array("-------------------","","");
StartinSelectLst[3] = new Array("Shop for flights","&return_to=booking_us","PB");
StartinSelectLst[4] = new Array("Book with miles","&return_to=awardShop_us","");
StartinSelectLst[5] = new Array("Red Carpet Club","&return_to=rcc&echoParam=rcchome","");
StartinSelectLst[6] = new Array("-------------------","","");
StartinSelectLst[7] = new Array("Check-in online","&return_to=easy_checkin","");
StartinSelectLst[8] = new Array("Change itineraries","&return_to=rax","");
StartinSelectLst[9] = new Array("Upgrades","&return_to=eug_sum","");
StartinSelectLst[10] = new Array("Ticket refunds","&return_to=refund","");
StartinSelectLst[11] = new Array("-------------------","","");
StartinSelectLst[12] = new Array("My profile","&whereto=UpdateProfile.jsp","");
StartinSelectLst[13] = new Array("Flight notification","&return_to=centerPost","");
StartinSelectLst[14] = new Array("My trip templates","&return_to=triptemplate","");
 
//update the dropdown list
//[0] = label, [1] = url, [2] = selected index
function writeStartIn() {
	selObj = document.topLogin.sel_return_to;
	selObj.length = 0;
	for (q=0;q<StartinSelectLst.length;q++)
		{
			selObj.options[q] = new Option (StartinSelectLst[q][0],StartinSelectLst[q][1]);
			if (StartinSelectLst[q][2].indexOf(selectedSection) > -1) selObj.options[q].selected = true
		}
}
 
 

 
function NoFlashCenterTile(xml){
	var fatArray=new Array() //array to hold "weighted" ads
	fatArray.length=0;
 
	$('slide',xml).each(function(){
		var slide = $(this);
		for(var ii = 0; ii < slide.attr('wt'); ii++) {
			fatArray[fatArray.length] = slide.attr('id');
		}
	})
	var selPro=(Math.floor(Math.random()*fatArray.length));
	var selectedId = fatArray[selPro];
	//loop again for the match??
	$('slide',xml).each(function(){
		var slide = $(this);
		if (slide.attr('id') == selectedId) {

				var decodedURI  = decodeURIComponent(slide.attr('url'));
				myHTMLOutput = '<a href="'+decodedURI+'"><img border="0" src="'+slide.attr('src')+'"></a>';
				$("#hpCenterTile").html(myHTMLOutput); //write the Center Tile with the selected static image
			//} //removed with mediaplex cachebuster SHD 3/25/2010
			
			//apply the color to the Background of the two tiles
			$('.hpDivsToFade').css('background-color',slide.attr('rgb'));
			return false;
		}
	});
}
 
// FS7 CenterTile link extraction function  -- S. Smull 2-3-09   
function vsChangeFlashHrefToThis(sNewHref) {
	vsLinkClicked = sNewHref;
	window.location.assign(sNewHref); //.replace doesn't load in session history, assign does
}		
 
// FS7 CenterTile fading function  -- S. Smull 2-3-09
function doTheFade(sStartColor, sColor) {
	//append color string with #
	try {
	var reg= /^#/;
		if (typeof sStartColor == "undefined") {
			sStartColor="#ffffff";
		}
		
	if(!reg.test(sColor)) {sColor = "#" + sColor; }
		if(!reg.test(sStartColor)) {sStartColor = "#" + sStartColor; }
	
		divstofade.animate({ backgroundColor: sColor }, 100); 
	} catch (e) {
		// do nothing, wait for next fade.
	}
}
 
 
function removeFlash() {
	if($.browser.msie && parseInt($.browser.version.substr(0,1)) > 6){
 
		$.fx.off = true;
		$('#hpCenterTile').empty().hide();
		$('#hpCenterTileImage').show();
		$('.hpDivsToFade').css('backgroundColor','#72a4d8');
	}
}	
