/* Release 5.2 */

/*
 * 
 * This file has been deprecated. Please change references to: /ual/asset/ua.united.js
 * If changes are absolutely necessary to this file, please make sure they are also 
 * reflected in the new file as well. - Rob 12/7/10
 * 
 */

/* below switch is used DASwitch variable to control DA project related links*/
if (typeof DASwitch == "undefined"){
	var DASwitch = true; /* added this switch to control Dynamic Air project changes */
}

var pbaoSub = 0;
var epuSub = 0;
var rccSub = 0;

var annualOptions = new Array();
	annualOptions[0] = new Array("Expiring soon","Will expire within the next 60 days.","Renew now");
	annualOptions[1] = new Array("Auto Renewing","Your annual option is scheduled to renew within 30 days.","");
	annualOptions[2] = new Array("Option Expired","Your annual option has expired.","Renew now");

	
var epuOptions = new Array("Economy Plus","https://www.united.com/ual/asset/economyPlus_37x30.gif","Economy Plus annual option","https://store.united.com/traveloptions/control/product?product_id=UM_EPA&category_id=UM_LEGRM&navSource=My+Profile+Subscriptions&linkTitle=UM_EPA");	

var rccOptions = new Array("Red carpet club","https://www.united.com/ual/asset/RCC_37x30.gif","Red carpet club annual option","https://store.united.com/traveloptions/control/product?product_id=UM_RCC&category_id=UM_LOUNGES&navSource=My+Profile+Subscriptions&linkTitle=UM_RCC");	

var pbaoOptions = new Array("Premier Baggage","https://www.united.com/ual/asset/PBAO_37x25.gif","Premier Baggage annual option","https://store.united.com/traveloptions/control/product?product_id=UM_PBA&category_id=UM_BAGS&navSource=My+Profile+Subscriptions&linkTitle=UM_PBA");	

var StartinSelectLst = new Array();
		
		StartinSelectLst[0] = new Array("My MileagePlus","&return_to=mp_review","SI~MP");
		StartinSelectLst[1] = new Array("My reservations","&return_to=newitin_us","IC");
		StartinSelectLst[2] = new Array("-------------------","","");
		StartinSelectLst[3] = new Array("Shop for flights","&return_to=booking_us","PB");
		if (DASwitch) {
			StartinSelectLst[4] = new Array("Book with miles", "&return_to=mp_award_ibe_bridge&fwdPath=awardShop&country=us", "");
		}else{
			StartinSelectLst[4] = new Array("Book with miles", "&return_to=awardShop_us", "");
		}
		/*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 reservations","&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() {
  if(typeof document.forms["topLogin"] != 'undefined') {
		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;
		}
	}
}

/* TODO: Included in ua.js. Remove from here when appropriate */
var myCookies = new Array();
if (document.cookie.length > 0) {
 tempcookies = document.cookie.split(';');
	for (var cookie = 0; cookie < tempcookies.length; cookie++) {
		var oneCookie = tempcookies[cookie].split('=');
		var cookieName = oneCookie[0].replace(/^\s+|\s+$/, '');
		myCookies[cookieName] = oneCookie[1];
	}
}
  var gblErr = new Array();
	gblErr["en"] = new Array ('Our records indicate that some of your profile information is invalid. ','Update your profile'); 


function HPSearch(frm) { /*if_queryForm(frm); return true;*/ }

/* TODO: Included in ua.js. Remove from here when appropriate */
function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

/* TODO: Included in ua.js. Remove from here when appropriate */
String.prototype.commafy = function() { 
	return this.replace(/(\D?)(\d{4,})/g, function($0, $1, $2) { 
			return /[.\w]/.test($1) ? $0 : $1 + $2.replace(/\d(?=(?:\d\d\d)+(?!\d))/g, '$&,'); 
	}); 
}; 

/* TODO: Included in ua.js. Remove from here when appropriate */
Number.prototype.commafy = function() { 
	return String(this).commafy(); 
};

function elevenLength(MPNO) {
    var id = TrimString(MPNO.value);
    if (MPNO && id!="" && id.length < 11) {
        while (id.length < 11) {
            id="0"+id;
        }
		MPNO.value = id;
    }
}

/* TODO: Included in ua.js. Remove from here when appropriate */
function isDigit(c) {
    return((c>="0")&&(c<="9"));
}

/* TODO: Included in ua.js. Remove from here when appropriate */
function IsNumeric(a,addChars) {
    var i;
    if (a.value.length == 0) {
        return true;
    }
    for(i=0;i < a.value.length;i++) {
        var c=a.value.charAt(i);
        if (!isDigit(c) && !isCharInString(c,addChars)) {
            return false;
        }
    }
    return true;
}
function IsUserIdNumeric(a,addChars) {
    var i;
	var id = TrimString(a.value);
    if (id.length == 0) {
        return true;
    }
    for(i=0;i < id.length;i++) {
        var c = id.charAt(i);
        if (!isDigit(c) && !isCharInString(c,addChars)) {
            return false;
        }
    }
    return true;
    }

function isCharInString(sc,s) {
    return(!sc||!s)?false:(s.indexOf(sc)>-1)?true:false;
}
function isMpNumber(MPNO){
		 if(MPNO != null && MPNO.length == 11 && !(MPNO =="00000000000")) {
				var s = MPNO;
				var  w60count1 =0;
				var  w60count2 = 0;
				w60count1 = s.substring(0,1) * 5 +
							s.substring(1,2) * 4 +
							s.substring(2,3) * 3 +
							s.substring(3,4) * 2 +
							s.substring(4,5) * 7 +
							s.substring(5,6) * 6 +
							s.substring(6,7) * 5 +
							s.substring(7,8) * 4 +
							s.substring(8,9) * 3 +
							s.substring(9,10) * 2;
			 var w60remainder = w60count1 % 11;
			   w60count1 = w60count1/11;
			  if (w60remainder != 0){
			      w60count2 = 11 - w60remainder;
			   } else {
			      w60count2 = 0;
			   }
			  if (w60count2 == 10){
			   		w60count2 = 0;
			   }
			  if (w60count2 != s.substring(10)){
				  	return false;
			   } else { 
				return true; 
			   }
			}
			
	return false;
}

function remMP(name) 
{   
var today = new Date();
var expires = new Date();
   expires.setTime(today.getTime() + 1000*60*60*24*365*2);
   setCookie("getMP", name, expires);
}
function remEMAIL(email) {
var today = new Date();
var expires = new Date();
   expires.setTime(today.getTime() + 1000*60*60*24*365*2);
   setCookie("rememberEMAIL", email, expires);
}

/* TODO: Included in ua.js. Remove from here when appropriate */
function getCookie(Name) {
   var search = Name + "=";
   if (document.cookie.length > 0) { // if there are any cookies      
		offset = document.cookie.indexOf(search);     
		if (offset != -1) { 
			// if cookie exists         
	 		offset += search.length;       
	 		// set index of beginning of value         
	 		end = document.cookie.indexOf(";", offset); 
	 		// set index of end of cookie value         
	 		if (end == -1)             
	 			end = document.cookie.length;
	 		return unescape(document.cookie.substring(offset, end));      
	 	}    
	 }
}

/* TODO: Included in ua.js. Remove from here when appropriate */
function setCookie(name, value, expire) {  
	var curCookie = name + "=" + escape(value) +
      ((expire) ? "; expires=" + expire.toGMTString() : "") + "; path=/";
//      ((domainmp) ? "; domain=" + domainmp : ""); 
	document.cookie = curCookie;
}

/* TODO: Included in ua.js. Remove from here when appropriate */
function deleteCookie(name,path) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

/*updated chngbox to refer to passed form name rather than just form name=MileagePlus*/
function chngbox(f){
	if(f.remMP.checked == false){
	deleteCookie("getMP","/");
	deleteCookie("getMP");
	deleteCookie('rememberME');
	deleteCookie('rememberEMAIL');
	deleteCookie('rememberMP');
	}	else {
	// this is for retriving the MileagePlus number.
		var gotMPno = getCookie("getMP");
	
		if (gotMPno != null) { 
		 if(f.userId.value) {
	 	 	f.userId.value=gotMPno;
		 }
		 f.remMP.checked=true;
		}
	}
}

function ValidateUserIdHome (f) {

	var MPNO = f.userId;
	var id = TrimString(MPNO.value);
	var cr='\n';
	var msg='';
	var isMP = false;
	var valid = true;
	var pwd = TrimString(f.password.value);
	if (f.sel_return_to[0].checked) //my MileagePlus
	{
		var selected_value=f.sel_return_to[0].value;
	}
	else if (f.sel_return_to[1].checked) //my reservations
	{
		var selected_value=f.sel_return_to[1].value;
	}
	else
	{  //protect a bad value SHD 9:11 SHD 6/27/10
		var selected_value="&return_to=mp_review";
		return false;
	}
	
	//disable log in button
	//if(isDefined(document.getElementById("topLogin"))) {document.getElementById("topLogin").disabled = true;}
	
	
	if (id.length == 0 || id.value == "MileagePlus # or email address") {
	    valid = false;
		msg='MileagePlus # or email address is a required field. ' + cr; 
   	}

   	if (valid) {
   		var isNum = IsUserIdNumeric(MPNO, null);
	    if (isNum) {
		    isMP = true;
			elevenLength(MPNO);
			id = TrimString(MPNO.value);
	   	}
	   	if (isMP) {
	   		valid = isMpNumber(id);
	   		if (!valid) {
				msg='The MileagePlus number you have entered is invalid. Please check the number and resubmit.' + cr;
			}
		}
		else {
		    valid = isEmail(id);
			if (!isMP & !valid) {
	    		msg='The MileagePlus number or the email address you have entered is invalid. Please check the number or email address and resubmit.' + cr; 
	    	}
		}
	}
	if (pwd.length==0) {
		msg+='Password is a required field.' + cr;
	}

	//if(isDefined(document.getElementById("topLogin"))) {document.getElementById("topLogin").disabled = false;}

	if (msg) {
        msg='Please Supply the Following:' + cr + cr + msg;
        alert(msg);
				//document.getElementById("topLogin").disabled = false;	
        return false;
    }
	f.action="https://www.ua2go.com/ci/DoLogin.jsp?stamp=NEWCOOKY*itn/ord=NEWREC,itn/air/united"+selected_value; //f.sel_return_to.value; 
	//if_queryForm(f); insight first tag, deactivated
	if (typeof removeFlash != "undefined") {removeFlash(); }; // Remove flash & prevent transition-cancel bug RSO 06-25-10
	return true;

}

function ValidateUserId (f) {
	if (f.sel_return_to.value == "") {return false;}
	var MPNO = f.userId;
	var id = TrimString(MPNO.value);
	var cr='\n';
	var msg='';
	var isMP = false;
	var valid = true;
	var pwd = TrimString(f.password.value);
	//disable log in button
	//if(isDefined(document.getElementById("topLogin"))) {document.getElementById("topLogin").disabled = true;}
	
	
	if (id.length == 0) {
	    valid = false;
		msg='MileagePlus # or email address is a required field. ' + cr; 
   	}
   	if (valid) {
   		var isNum = IsUserIdNumeric(MPNO, null);
	    if (isNum) {
		    isMP = true;
			elevenLength(MPNO);
			id = TrimString(MPNO.value);
	   	}
	   	if (isMP) {
	   		valid = isMpNumber(id);
	   		if (!valid) {
				msg='The MileagePlus number you have entered is invalid. Please check the number and resubmit.' + cr;
			}
		}
		else {
		    valid = isEmail(id);
			if (!isMP & !valid) {
	    		msg='The MileagePlus number or the email address you have entered is invalid. Please check the number or email address and resubmit.' + cr; 
	    	}
		}
	}
	if (pwd.length==0) {
		msg+='Password is a required field.' + cr;
	}

	//if(isDefined(document.getElementById("topLogin"))) {document.getElementById("topLogin").disabled = false;}

	if (msg) {
        msg='Please Supply the Following:' + cr + cr + msg;
        alert(msg);
				//document.getElementById("topLogin").disabled = false;	
        return false;
    }
	f.action="https://www.ua2go.com/ci/DoLogin.jsp?stamp=NEWCOOKY*itn/ord=NEWREC,itn/air/united"+f.sel_return_to.value; 
	//if_queryForm(f); insight first tag, deactivated
	return true;
}

/* TODO: Included in ua.js. Remove from here when appropriate */
function isEmail(str) {
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1) {
		   return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr) {
		   return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false;
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		    return false;
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false;
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		    return false;
		 }
		 if (str.indexOf(" ")!=-1){
		    return false;
		 }
 		 return true;					
	}
	
/* TODO: Included in ua.js. Remove from here when appropriate */
function TrimString(_data) {
  return _data.replace(/^\s+|\s+$/g, '');
}

/* TODO: Included in ua.js. Remove from here when appropriate */
function bTrimString(sInString) {
  if ( sInString ) {
    sInString = sInString.replace( /^\s+/g, "" );// strip leading
    return sInString.replace( /\s+$/g, "" );// strip trailing
  }
}
function toggleGLL() {
	document.getElementById('swnGLLform').style.display='inline';
	document.getElementById('swnGLLtext').innerHTML='<img id="swnGLLarrow" src="'+writeSWNprotocol+'://www.united.com/ual/asset/swn_2007_loginarrowdown.gif" height="11" width="11" alt="">&nbsp;&nbsp;Login';
	//document.getElementById('swnGLLnotamemtable').style.display='none';
}

function isDefined(variable){//alert("in isdefined with :"+variable+"\ngoing to return: "+(!(!( variable||false ))));
	return (!(!( variable||false )));

	//return eval('(typeof('+variable+') != "undefined");');
}

function embedGLL()	{
	var mpSummaryReturnToVal = "mpsummary"; 
	var gllMyItinsPath = "https://www.ua2go.com/ci/Login.jsp?return_to=newitin";
	
	/* This is defined in hpMenuArr.js, but there are some pages which do not include that file */ 
	if (typeof countryTel != 'string'){
		countryTel = 'us';
	}
	
	if (window.currentUALsite) { 
		if (currentUALsite == "US-EN") {
			mpSummaryReturnToVal="mp_review"; //used to append _us for mpsummary for US-EN customers
			gllMyItinsPath += "&navSource=LeftNav07&linkTitle=My+itineraries"; // domestic customers get IF tracking added
		} else if (currentUALsite == "US-ES") {
			mpSummaryReturnToVal="mp_review"; //used to append _us for mpsummary for US-ES customers
			gllMyItinsPath += "&navSource=LeftNav07&linkTitle=My+itineraries"; // domestic customers get IF tracking added
			
		}
	}
	//Intl embedGLL patch SHD 02/11/2007
	// start with generic link 
	var redeemStr = '<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="http://www.united.com/page/article/0,6722,3831,00.html">Redeem miles</a></td></tr>';
	var itinStr = '<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="'+gllMyItinsPath+'">My reservations</a></td></tr>';
	//check for awardURL string--only defined in Intl sites.
	if (typeof(awardURL) != 'undefined') {
		if(awardURL == null) {  //non-booking sites, suppress link
			redeemStr ="";
			itinStr = "";
		} else if (listContains(countryTel, "in,dk,se,nzit,tw,th,vn,es,ru,kw,ae,bh", "any")) {
			redeemStr = '<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="https://www.ua2go.com/ci/Login.jsp?return_to=mp_award_ibe_bridge">Redeem miles</a></td></tr>';
		} else if (awardURL) { //intl booking site with link
			redeemStr = '<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="'+awardURL+'">Redeem miles</a></td></tr>';
		} 
	}//end awrdURL
			
	// rcc patch begin
	var isRedCarpet = false;
	var rccURL = document.location.href;
	rccURL = rccURL.toLowerCase();
	if(rccURL.indexOf('/rcc/') != -1){isRedCarpet=true;}
	// rcc patch end
	// ua2go patch begin
	var isAppServer = false;
	var appServerURL = document.location.href;
	appServerURL = appServerURL.toLowerCase();
	if( (appServerURL.indexOf('www.ua2go.com') == -1) || (appServerURL.indexOf('travel.united.com') == -1) ){isAppServer=true;}
	// ua2go patch end
	if (isDefined(myCookies["rememberProfile"]) && isDefined(myCookies["isSecure"]) && myCookies["isSecure"]=="true") {
		var profile=myCookies["rememberProfile"];
		profile = unescape(profile); 
		var parsedValue=profile.split("||");
		var mpiNumber=parsedValue[0];
		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];
			if ( (parsedValue.length >= 9) &&( typeof(country)== "undefined" || country=="united" )){
			pbaoSub = parseInt(parsedValue[7]);
			epuSub = parseInt(parsedValue[8]);
			rccSub = parseInt(parsedValue[9]);
			}
			
			//alert("prefix: "+prefix+"\ninitial: "+middleinit+"\nsuffix: "+suffix);
		} //end mpInformation
		var errorStr="";
		if (( typeof(country)== "undefined" || country=="united" )&& (emlErrFlg == "true" || addrErrFlg == "true")){
			var lang="en"; // for now, only errors in english
			errorStr = '<div style="color:#CC0000; font-size:10px;margin-left:5px">'+gblErr[lang][0]+'<a href="https://www.ua2go.com/ci/UpdateProfile.jsp">'+gblErr[lang][1]+'</a></div>';
		}
	
		//var swnlogoutUrl = "https://www.mileageplus.com/mp/logout.jsp";
		var  swnlogoutUrl = "https://www.ua2go.com/ci/Logout.jsp"; //Per Naresh 11/18/2010
		//if (!isAppServer && !isRedCarpet)	{ swnlogoutUrl+='?static=true';}
		
		if (document.location.href.indexOf("etc/webcheckin/nonrevenue") != -1) { swnlogoutUrl = "https://www.ua2go.com/etc/webcheckin/nonrevenue/logout.do"; } // for NRSA Logins
		
		if (firstName.length <= 6) { document.write('<div id="swnGLLhello">Hello '+firstName+'</div>'); }// hello firstName on one line
		if ((firstName.length > 6) && (firstName.length <= 9)) { document.write('<div id="swnGLLhello">Hello<br>	'+firstName+'</div>'); } // hello firstName on two lines
		if (firstName.length > 9) { document.write('<div id="swnGLLhello">Hello</div>'); }// hello no name (name is too long 
		 
		 //write out the left rail
		document.write('<div id="swnGLLstatus">'+mpLevel+'</div>'
		+'<table border="0" cellpadding="0" cellspacing="0" width="100%">');
		
		if (mpBal.length>0) {document.write('<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="https://www.ua2go.com/ci/Login.jsp?return_to='+mpSummaryReturnToVal+'">'+mpBal.commafy()+' miles</a></td></tr>');}

		document.write(redeemStr
		+itinStr
		+'</table>');
		
		if( (pbaoSub > 0 && pbaoSub <4)|| (epuSub > 0 && epuSub <4) || (rccSub > 0 && rccSub <4) ){
		 //write out the left rail
		document.write('<div id="swnGLLstatusAO">Annual Options</div>'
		+'<table border="0" cellpadding="0" cellspacing="0" width="100%">');
		
		
		
		if (epuSub > 0 && epuSub <4) {document.write('<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="'+epuOptions[3]+'">'+epuOptions[0]+'</a></td></tr>');}
		if (pbaoSub > 0 && pbaoSub <4){document.write('<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="'+pbaoOptions[3]+'">'+pbaoOptions[0]+'</a></td></tr>');}
		if (rccSub > 0 && rccSub <4) {document.write('<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="'+rccOptions[3]+'">'+rccOptions[0]+'</a></td></tr>');}
		
	

		document.write('</table>');
		
		}
		
		if(errorStr.length>0) document.write(errorStr);
		document.write('<div id="swnGLLmyproflogout"><a href="https://www.ua2go.com/ci/UpdateProfile.jsp">My profile</a>&nbsp;<span id="swnGLLmyproflogoutPipe">|</span> <a href="'+swnlogoutUrl+'">Log out</a></div>');
	}
	else
	{ //not logged in state
		if (DASwitch){
			var bookWithMilesLink="mp_award_ibe_bridge&fwdPath=awardShop&country=us";
		}else{
			var bookWithMilesLink="awardShop_us";
		}
		
		document.write(
		 '<div id="swnGLLid">' 
		+'	<span id="swnGLLtext"><img id="swnGLLarrow" src="'+writeSWNprotocol+'://www.united.com/ual/asset/swn_2007_loginarrowright.gif" height="11" width="11" alt="" border="0">&nbsp;&nbsp;<a href="#" onmousedown="toggleGLL();">Login</a></span>'
		+'</div>'
		+'<div id="swnGLLform">'
		+'<form class="nospace" method="POST" action="https://www.ua2go.com/ci/DoLogin.jsp?stamp=NEWCOOKY*itn/ord=NEWREC,itn/air/united&return_to=ff_acct_hist" name="MileagePlus" onSubmit="return ValidateUserId(this);" style="margin:0;" target="_top">'
		+'	<div id="swnGLLlogin">MileagePlus #<br>or email address</div>'
		+'	<div id="swnGLLloginbox"><input type="text" id="swnGLLuserid" name="userId"></div>'
		+'	<div id="swnGLLpass">Password</div>'
		+'	<div id="swnGLLpassbox"><input type="password" id="swnGLLpassword" name="password"></div>'
		+'	<div id="swnGLLremem"><input type="checkbox" name="remMP">Remember me</div>'
		+'	<div id="swnGLLstartin">Start in</div>'
		+'	<div id="swnGLLdrop"><select id="swnGLLdropdown" name="sel_return_to">'
		+'		<option value="&return_to='+mpSummaryReturnToVal+'" selected>My MileagePlus</option>'
		+'		<option value="&return_to=newitin_us">My reservations</option>'
		+'		<option value="">-------------------</option>'
		+'		<option value="&return_to=booking_us" >Shop for flights</option>'
		+'		<option value="&return_to='+bookWithMilesLink+'">Book with miles</option>'
		+'		<option value="&return_to=rcc&echoParam=rcchome">Red Carpet Club</option>'
		+'		<option value="">-------------------</option>'
		+'		<option value="&return_to=easy_checkin">Check in online</option>'
		+'		<option value="&return_to=rax">Change reservations</option>'
		+'		<option value="&return_to=eug_sum">Upgrades</option>'
		+'		<option value="&return_to=refund">Ticket refunds</option>'
		+'		<option value="">-------------------</option>'
		+'		<option value="&whereto=UpdateProfile.jsp">My profile</option>'
		+'		<option value="&return_to=centerPost">Flight notification</option>'
		+'		<option value="&return_to=triptemplate">My trip templates</option>'
		+'	</select>'
		+'	</div>'
		+'	<div id="swnGLLsubmit"><input type="image" src="'+writeSWNprotocol+'://www.united.com/ual/asset/swn_2007_buttonlogin.gif" border="0"></div>'
		+'	</form>'
		+'</div>'
		+'<table border="0" cellpadding="0" cellspacing="0" width="100%" id="swnGLLnotamemtable">'
		+'<tr><td valign="top" id="swnGLLnotamem" colspan="2">Not a member?</td></tr>'
		+'<tr><td valign="top" class="swnRelatedLinksgt">></td><td valign="top" class="swnRelatedLinksitem"><a href="https://www.ua2go.com/ci/JoinMileagePlus.jsp?jumpLink=%2Fjoinmp">Sign up now</a></td></tr>'
		+'</table>'
		);
		
		writeStartIn();
		
		// this is for retriving the MileagePlus number.
		var rememberME = getCookie("rememberME");
		
		if (rememberME!= undefined && rememberME=="E") {
			var rememberEmail = getCookie("rememberEMAIL");
			document.MileagePlus.userId.value=rememberEmail;
			document.MileagePlus.remMP.checked=true;
		}
		else
		{
			var rememberMP; // init to null
			// then reassign if necessary
			if	(getCookie("getMP")) {	rememberMP = getCookie("getMP"); }// *.united.com
			if	(getCookie("rememberMP")) {	rememberMP = getCookie("rememberMP"); } // ua2go.com
			if (rememberMP != null)	{ 
				document.MileagePlus.userId.value=rememberMP;
				document.MileagePlus.remMP.checked=true;
			}
		}//end remember me cookie
	} //end logged out
} //end embedGLL

// 11-19-08 10:30am - SMS - Espanol Removal From Footer - JIRA 3491
var bEspanolRemoved;
if(window.addEventListener) { 
	window.addEventListener("load",removeEspanolFromFooter,false); 
} else if(window.attachEvent) { 
  window.attachEvent("onload",removeEspanolFromFooter); 
}	else if(window.onload) { 
	var oHEspanol=window.onload;
	window.onload=function pBEspanol(){
		oHEspanol();
		removeEspanolFromFooter();
	};
} else {
	window.onload=removeEspanolFromFooter;
}

function embedAnnualOptions(){

var sideNavOptionsClass = "aobox1-body-block";
var sepLineImage = '';
		if( (pbaoSub >1 && pbaoSub<5)|| (epuSub >1 && epuSub < 5) || (rccSub > 1 && rccSub < 5) ){	
		
		document.write('<div style="padding-top:8px;"><div class="aobox-bg-shade"><div class="aobox_sidenav_corner1"><div class="aobox_sidenav_corner2"><div class="aobox-head-height"><span class="aobox-heading">Important notice</span></div></div></div></div><div class="ao-sidenav-fd">');
		
		var indexArr = 0;
		
		if(epuSub >1 && epuSub < 5){		
		indexArr = epuSub - 2;		
		document.write('<div class="'+sideNavOptionsClass+'"><div class="ao-side-img"><img src="'+epuOptions[1]+'" /></div><div class="ao-alert-text">'+annualOptions[indexArr][0]+'</div><div class="ao-heading-text"><b>'+epuOptions[2]+'</b><br />'+annualOptions[indexArr][1]+'<br /><b><a href="'+epuOptions[3]+'">'+annualOptions[indexArr][2]+'</a></b></div></div>');
		sideNavOptionsClass = "aobox-body-block";
		sepLineImage = '<div><img src="https://www.united.com/ual/asset/dashed_line_98x1.gif" height="1" width="98" alt="swn_sep_line"></div>';
		}
		if(pbaoSub >1 && pbaoSub<5){
		 indexArr = pbaoSub -2;		
		document.write(sepLineImage+'<div class="'+sideNavOptionsClass+'"><div class="ao-side-img"><img src="'+pbaoOptions[1]+'" /></div><div class="ao-alert-text">'+annualOptions[indexArr][0]+'</div><div class="ao-heading-text"><b>'+pbaoOptions[2]+'</b><br />'+annualOptions[indexArr][1]+'<br /><b><a href="'+pbaoOptions[3]+'">'+annualOptions[indexArr][2]+'</a></b></div></div>');	
		sideNavOptionsClass = "aobox-body-block";
		sepLineImage = '<div><img src="https://www.united.com/ual/asset/dashed_line_98x1.gif" height="1" width="98" alt="swn_sep_line"></div>';
		}
		if(rccSub > 1 && rccSub < 5){
		 indexArr = rccSub -2;		 
		document.write(sepLineImage+'<div class="'+sideNavOptionsClass+'"><div class="ao-side-img"><img src="'+rccOptions[1]+'" /></div><div class="ao-alert-text">'+annualOptions[indexArr][0]+'</div><div class="ao-heading-text"><b>'+rccOptions[2]+'</b><br />'+annualOptions[indexArr][1]+'<br /><b><a href="'+rccOptions[3]+'">'+annualOptions[indexArr][2]+'</a></b></div></div>');
		sideNavOptionsClass = "aobox-body-block";
		sepLineImage = '<div><img src="https://www.united.com/ual/asset/dashed_line_98x1.gif" height="1" width="98" alt="swn_sep_line"></div>';
		}
		document.write('</div></div><div><img src="https://www.united.com/ual/asset/swn_2007_left_shadowbottom.gif" height="9" width="108" alt="swn_2007_left_shadowbottom"></div><div id="gllPresent"><img src="https://www.united.com/ual/asset/swn_2007_leftdots.gif" height="1" width="108" alt="swn_2007_leftdots"></div>');
		
		}
}

function removeEspanolFromFooter() {
  if(isDefined(document.getElementById("ualFooter1left"))) {
	  try {
			var eUalFooter = document.getElementById("ualFooter1left");
			var eUalFooterFirstChild = eUalFooter.firstChild;
			
			if(eUalFooterFirstChild.childNodes.length > 0) {
			
				if(eUalFooterFirstChild.firstChild.nodeType == 3) {
					
					if(eUalFooterFirstChild.firstChild.nodeValue.indexOf("Esp") > -1) {
						
						bEspanolRemoved = false;
					}
				}
			} else if(eUalFooter.childNodes > 0) {
				
				if(eUalFooter.firstChild.nodeType == 3) {
					
					if(eUalFooter.firstChild.nodeValue.indexOf("Esp") > -1) {
						bEspanolRemoved = false;
						
					}
				}
			} 
			
			if(bEspanolRemoved==false) {
				eUalFooter.removeChild(eUalFooter.childNodes[0]);
				eUalFooter.removeChild(eUalFooter.childNodes[1]);
				bEspanolRemoved=true;
			}
		} catch(exception) { 
			// Do Nothing for now on exceptions
			//alert("Caught an exception!\n\n"+exception);
		}
	}
}


function insightfirstcall(sDummy) {
  return true;
}

/* Added RO 12/7/10 to support listContains().
 * This is also defined in ua.js, so remove from here when apropriate
 */
if (!String.prototype.trim) {
	String.prototype.trim = function() {
		return this == null ? "" : this.toString().replace(/^\s+/, "").replace(/\s+$/, "");
	}
};

/*added 12/3/2010 SHD*/
function listContains(str1, str2, matchType){
 var arr1 = str1.split(",");
 var arr2 = str2.split(",");
 var arr1Len = arr1.length;
 var arr2Len = arr2.length;
 var matchArr = [];
 
 for (var i=0; i < arr2Len; i++ ) {
  for (var j = 0; j < arr1Len; j++ ) {
   if (arr1[j].trim() == arr2[i].trim()) {
    matchArr.push(arr1[i]);
   }
  }
 }

 switch (matchType) {
  case "all":
   if (matchArr.length == arr2.length) {
    return true;
   }
  break;
 
  case "any":
   if (matchArr.length > 0) { 
    return true; 
   }
  break;
  
  case "none":
   if (matchArr.length == 0) { 
    return true; 
   }
  break;
  }
 return false;
}



/* removed 09112009 SHD for MD
if(!window.vsCustomItems) { var vsCustomItems = new Array(); }

var bDepartingSegsExpanded = false;
var bReturningSegsExpanded = false;
if(document.title=="Search by schedule results") {
  $(window).bind("unload",function(e) {
	  captureSBSVSInfo();
	});
}


function captureSBSVSInfo() {
  vsCustomItems[vsCustomItems.length] = new Array("v_ClkdPrice",$('#curAmt0').text());
	
	var sDepNumHiddenSegs = Number($('.btmflt').eq(0).find("a").eq(1).text());
	if(sDepNumHiddenSegs!="NaN") {
		vsCustomItems[vsCustomItems.length] = new Array("v_DepHidSegs",sDepNumHiddenSegs);
	} else {
		vsCustomItems[vsCustomItems.length] = new Array("v_DepHidSegs",0);
	}
	
	
	var sRetNumHiddenSegs = Number($('.btmflt').eq(1).find("a").eq(1).text());
	if(sRetNumHiddenSegs!="NaN") {
		vsCustomItems[vsCustomItems.length] = new Array("v_RetHidSegs",sRetNumHiddenSegs);
	} else {
		vsCustomItems[vsCustomItems.length] = new Array("v_RetHidSegs",0);
	}
	
	$('input[name="selectedOD0"]').each(function(i) {
	  if($(this).attr('checked')) {
			vsCustomItems[vsCustomItems.length] = new Array("v_DepSelBand",$(this).val());
		}
	});
	
	$('input[name="selectedOD1"]').each(function(i) {
	  if($(this).attr('checked')) {
			vsCustomItems[vsCustomItems.length] = new Array("v_RetSelBand",$(this).val());
		}
	});
	
	vsCustomItems[vsCustomItems.length] = new Array("v_DepExpSegs",bDepartingSegsExpanded);
	vsCustomItems[vsCustomItems.length] = new Array("v_RetExpSegs",bReturningSegsExpanded);
	
	var sCustomString = "";
	for(var x=0; x<vsCustomItems.length; x++ ) {
	  sCustomString += vsCustomItems[x][0] + "\t=\t" + vsCustomItems[x][1] + "\n";
	}
	//alert(sCustomString);
}

function w(msg, bAlert) {
  if(window.console) {
	  console.error(msg);
	} else if(bAlert) {
		alert(msg);
	}
}
*/
