// 03/01 BRANDING SSM

/* Release 4.8 */
//var defaultSearchBoxText = 'Search for . . .';
var defaultSearchBoxText = 'Search site';
var headerVS_NavSource = "header"; 
var continental_link = "http://www.united.com/Continental?navSource="+headerVS_NavSource+"&linkTitle=Continental_link";
var merger_link = "http://www.united.com/ournewlogo?navSource="+headerVS_NavSource+"&linkTitle=our_new_logo";
var siteURL = "http://www.united.com/";
var homepage_link = siteURL + 'homepage'; // DPOS structure
var logoImgName = "new-united-logo.gif";
var footerVS_NavSource = "footer"; 
var starAlliance_link= "http://www.united.com/sainfo?navSource="+footerVS_NavSource+"&linkTitle=staralliance";
var staralliance_logo = "star-alliance.gif";
var langUA2GO = "en";
var myProfile_link = "https://www.ua2go.com/ci/UpdateProfile.jsp?lang="+langUA2GO+"&navSource="+headerVS_NavSource+"&linkTitle=myprofile";
var myProfile_label = "My profile";
var worldwide_label = "Worldwide sites";
var worldwide_link = "http://www.united.com/worldwide?navSource="+headerVS_NavSource+"&linkTitle=worldwidesites";
var customerSerice_label = "Customer service";
var customerSerice_link = "http://faq.ua2go.com/?cid=1&c=12&cpc=WnaqDcP5KrMu623S1OA64DwwrR4UyhK6fv2ylkXXS&navSource="+headerVS_NavSource+"&linkTitle=customerservice";

function checkForDefault() 
{
	var SearchValue = document.getElementById('swnquerytext').value;
	if (SearchValue == defaultSearchBoxText || SearchValue == '') return false;
	HPSearch(this);
	return true;
}
//old header

/*
document.write('<div id="ualbranded">' 
+'			<div id="ualbrandedlogo"><a href="http://www.united.com/homepage"><img src="//www.united.com/ual/asset/swn_2007_united_brand.gif" height="15" width="144" alt="United" border="0" /></a></div>'
+'			<div id="ualbrandedlinks"><a href="https://www.ua2go.com/ci/UpdateProfile.jsp?navSource=HP07&linkTitle=a1myprofile">My profile</a> <span class="headerpipe">|</span> <a href="http://www.united.com/worldwide?navSource=HP07&linkTitle=a2worldwidesites">Worldwide sites</a> <span class="headerpipe">|</span> <a href="http://faq.ua2go.com/?cid=1&c=12&cpc=WnaqDcP5KrMu623S1OA64DwwrR4UyhK6fv2ylkXXS&navSource=HP07&linkTitle=a3customerservice">Customer service</a></div>'	
+'		</div>'
*/

//new header

document.write('<div id="bhHeader">' 

	+'<div id="bhTop">'
	+'<div id="bhTopLeft">'
	+'<p><a href="'+continental_link+'">continental.com</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<span class="untxt">united.com</span></p>'
	+'</div>'
	+'<div id="bhTopRight">'
	+'<p><a href="'+merger_link+'">About our new logo</a></p>'
	+'</div>'
	+'</div>'
	+'<div id="bhMiddleArrow">'
	+'<img src="//www.united.com/ual/asset/global-nav-pointer.gif" height="9" width="18" alt="Pointer" />'
	+'</div>'
	+'<div id="bhBottom">'
	+'<div id="bhBottomLeft">'
	+'<a href="'+ homepage_link +'"><img class="newUnitedLogo" src="//www.united.com/ual/asset/' + logoImgName +'" height="30" width="173" alt="United" /></a>'
	+'</div>'
	+'<div id="bhBottomLeftSA">'
	+'<a href="'+starAlliance_link+'"><img class="newSALogo" src="//www.united.com/ual/asset/'+ staralliance_logo +'" height="14" width="160" alt="Star Alliance" /></a>'
	+'</div>'
	+'<div id="bhBottomRight">'
	+'<p><span id="ualbrandedlinks"></span><a href="'+ myProfile_link +'">'+ myProfile_label +'</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="'+ worldwide_link +'">'+ worldwide_label +'</a>&nbsp;&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;<a href="'+customerSerice_link+'">'+customerSerice_label+'</a></p>'
	+'</div>'
	+'</div>'
	+'</div>'
	
+'		<div id="ualswnarea">'
+'			<form id="Homepagesearch" onsubmit="return checkForDefault();" action="http://www.united.com/cgi-bin/texis/webinator/search/" name="Homepagesearch" method="get" style="margin: 0px;">'
+'				<div style="float:left; height:32px;width:10px; background-color:#FFF;"></div>'
+'				<ul class="jd_menu" style="float:left;">'
+'					<li id="tab1" onClick="window.location.assign(\'http://www.united.com/page/middlepage/0,6823,1009,00.html?navSource=Dropdown07&linkTitle=planningandbooking\');"><a id="tab1Button" class="navButton" href="http://www.united.com/page/middlepage/0,6823,1009,00.html?navSource=Dropdown07&linkTitle=planningandbooking"></a>'
+'						<ul style="width: 141px !IMPORTANT;" class="newSubMenu"></ul>'
+'					</li>'
+'					<li id="tab2" onClick="window.location.assign(\'http://www.united.com/page/middlepage/0,,52100,00.html?navSource=Dropdown07&linkTitle=itinerariesandcheckin\');"><a id="tab2Button" class="navButton" href="http://www.united.com/page/middlepage/0,,52100,00.html?navSource=Dropdown07&linkTitle=itinerariesandcheckin"></a>'
+'						<ul style="width: 170px !IMPORTANT;" class="newSubMenu"></ul>'
+'					</li>'
+'					<li id="tab3" onClick="window.location.assign(\'http://www.united.com/page/middlepage/0,6823,1136,00.html?navSource=Dropdown07&linkTitle=mileageplus\');"><a id="tab3Button" class="navButton" href="http://www.united.com/page/middlepage/0,6823,1136,00.html?navSource=Dropdown07&linkTitle=mileageplus"></a>'
+'						<ul style="width: 150px !IMPORTANT;" class="newSubMenu"></ul>'
+'					</li>'
+'					<li id="tab4" onClick="window.location.assign(\'http://www.united.com/page/middlepage/0,6823,1030,00.html?navSource=Dropdown07&linkTitle=servicesandinformation\');"><a id="tab4Button" class="navButton" href="http://www.united.com/page/middlepage/0,6823,1030,00.html?navSource=Dropdown07&linkTitle=servicesandinformation"></a>'
+'						<ul style="width: 175px !IMPORTANT;" class="newSubMenu"></ul>'
+'					</li>'
+'				</ul>'
+'				<div class="swnquerytextContainer"><input type="text" value="' + defaultSearchBoxText + '" name="query" id="swnquerytext"></div>'
+'				<div class="swnquerybuttonContainer"><input id="swnquerybutton" type="image" src="//www.united.com/ual/asset/swn_search_button.gif" value="submit" name="submit"><input type="hidden" value="siteprofile" name="pr"></div>'
+'			</form>'
+'		</div>');


/* It would be great if we could use jQuery stuff here, however the ualmiles 
 * Partner Kit doesn't include jQuery until the end of the page. When they 
 * update their PK (include jQuery before this file), we can use this again.
 * Rob 7/13/10

$(document).ready(function() {
	$('#swnquerytext')
	.bind("keydown keypress",function(e){
		if (window.quickUASearch){quickUASearch(event);}
	})
	.focus(function(){
		if ($(this).val() == defaultSearchBoxText){
			$(this).val('');
			$(this).css('textAlign','left');
			$(this).css('color','#1B3D6B');
			
		}
	})
	.blur(function(){
		if ($(this).val() == ''){
			$(this).css('textAlign','left');
			//$(this).css('color','#666666');
			$(this).css('color','#1B3D6B');
			$(this).val(defaultSearchBoxText);
			}
	});	
});
*/

var ualEvent = {
		add: function(obj,type,fn) {
			if (obj.attachEvent) {
				obj['e'+type+fn] = fn;
				obj[type+fn] = function() { obj['e'+type+fn](window.event); };
				obj.attachEvent('on'+type,obj[type+fn]);
			} else
			obj.addEventListener(type,fn,false);
		},
		remove: function(obj,type,fn) {
			if (obj.detachEvent) {
				obj.detachEvent('on'+type,obj[type+fn]);
				obj[type+fn] = null;
			} else
			obj.removeEventListener(type,fn,false);
		}
	};

var SearchBoxObj = document.getElementById('swnquerytext');
ualEvent.add(SearchBoxObj,'focus',function(){
	if (SearchBoxObj.value == defaultSearchBoxText){
		SearchBoxObj.value = '';
		SearchBoxObj.style.textAlign = 'left';
		SearchBoxObj.style.color = '#1B3D6B';
	}
});

ualEvent.add(SearchBoxObj,'blur',function(){
	if (SearchBoxObj.value == ''){
		SearchBoxObj.value = defaultSearchBoxText;
		SearchBoxObj.style.textAlign = 'left';
		SearchBoxObj.style.color = '#666666';
	}
});

ualEvent.add(SearchBoxObj,'keydown',function(e){
	if (window.quickUASearch){
		quickUASearch(event);
		}
});

ualEvent.add(SearchBoxObj,'keypress',function(e){
	if (window.quickUASearch){
		quickUASearch(event);
		}
});




