if (document.getElementById("CMU_EXCLUDE")==null && top != self)
     top.location=self.document.location;


/*Added to fix issue in IE 6  with CSS button*/
try {
		document.execCommand("BackgroundImageCache", false, true);
	} catch(err) { 
}

function createMenu(){
	if(typeof iNav_Selected_Level3_Item != 'undefined'){
		if(iNavTrim(iNav_Selected_Level3_Item) != "" ){ 	
			var temp = iNav_Selected_Level3_Item.split("_");
			iNav_Selected_Level3 = temp[0]+"_"+temp[1];
			iNav_Selected_Level2 = "L2"+"_"+temp[1];
			showMenu(iNav_Selected_Level3,iNav_Selected_Level2);
		}
	}else if (typeof iNav_Selected_Level2!='undefined'){
		iNav_Selected_Level3 = "L3_"+iNav_Selected_Level2.substring(3,iNav_Selected_Level2.length);
		if(typeof document.getElementById('iNav_Selected_Level3')!='undefined')
			showMenu(iNav_Selected_Level3,iNav_Selected_Level2);
	}
	else{
		iNav_Selected_Level3='none';
		iNav_Selected_Level2='none';
		showMenu(iNav_Selected_Level3,iNav_Selected_Level2);
	}

	/*Tier0 border setting*/
	var all_Li_Elements = document.getElementsByTagName("li");
	var s = new Array();
	var x = new Array();
	var temp;
	var activeGlobalIndex;
	var nextTab;
	var hideIndex;
	var prevTab;

	for(j=0; j < all_Li_Elements.length; j++){
		if (all_Li_Elements[j].id) {
			s[j] = all_Li_Elements[j].id;

			x = s[j].split("_");
			if (x[0]=='L1' && x[2] == '1'){
				document.getElementById(s[j]).style.border='0px solid #FFFFFF';
			}
			if (x[3] == 'A')
			{
				document.getElementById(s[j]).style.border='0px solid #FFFFFF';
				activeGlobalIndex = x[2];
				nextTab = parseFloat(activeGlobalIndex)+1;
			}
			if (x[2] == parseFloat(activeGlobalIndex)+1)
			{
				document.getElementById(s[j]).style.border='0px solid #FFFFFF';
			}
		}
	}

	if (typeof iNav_logo_url_suppress != 'undefined'){
		if(iNavTrim(iNav_logo_url_suppress) != "" ){ 
			document.getElementById('iNav_Amex_Logo_ID').style.cursor="default";
		}
	}else{
		document.getElementById('iNav_Amex_Logo_ID').style.cursor="hand";
	}
}	

function showMenu(tier2Id, tier1Id){

	if (typeof tier2Id!='undefined' && typeof tier1Id!='undefined'){
		if (typeof iNav_Selected_Level3_Item!='undefined')
			document.getElementById(iNav_Selected_Level3_Item).style.background = "#FFFFFF";

		if (document.getElementById(tier1Id)){
			document.getElementById(tier1Id).style.background="#DBE9F4";
			document.getElementById(tier1Id).style.color="#005495";
			colorAnchors(document.getElementById(tier1Id), "#005495");			
		}
			
		if (document.getElementById(tier2Id)){		
			document.getElementById(tier2Id).style.background="#DBE9F4";
			document.getElementById(tier2Id).style.display = "block";
			changeAnchors(document.getElementById(tier2Id), "#005495", "#001826");	
		}
		if (typeof iNav_Selected_Level3_Item!='undefined') {
			document.getElementById(iNav_Selected_Level3_Item).style.background = "#FFFFFF";
			changeAnchors(document.getElementById(iNav_Selected_Level3_Item), "#001826","#001826");
		}
	}
	if(typeof iNavHide!='undefined'){
		hideNavElements()
	}
}

function colorAnchors(node, newcolor){
	if (typeof node == 'object' && node.hasChildNodes() == true){
		for(i = 0; i< node.childNodes.length; i++){
			if (node.childNodes[i].nodeName == 'A'){
				node.childNodes[i].style.color = newcolor;
				return; //This recursion will stop at the first anchor
			}
			else if (node.childNodes[i].nodeName == 'UL' || 
					node.childNodes[i].nodeName == 'LI'){
					colorAnchors(node.childNodes[i], newcolor) //Calling recursively
			}
		}
	}
}

function changeAnchors(node, normaldisplay, hoverdisplay ){

	if (typeof node == 'object' && node.hasChildNodes() == true){
		for(i in node.childNodes){
			if (node.childNodes[i].nodeName == 'A'){

				node.childNodes[i].style.color = normaldisplay;
				node.childNodes[i].onmouseover = function(){this.style.color=hoverdisplay;};
				node.childNodes[i].onmouseout = function(){this.style.color=normaldisplay;};
				node.childNodes[i].onclick = function(){this.style.color=hoverdisplay;};
				return; //This recursion will stop at the first anchor
			}
			else if (node.childNodes[i].nodeName == 'UL' || 
				node.childNodes[i].nodeName == 'LI'){
				changeAnchors(node.childNodes[i], normaldisplay, hoverdisplay) //Calling recursively
			}
		}
	}
}

function searchRightNow(form){
	searchVal = form.iNav_textbox.value;
}

/*  Begin: Leftnav   */
/*Initialize Leftnav*/
function createLeftNav(){
	if (typeof iNav_Selected_Level5_Item != 'undefined'){
		if(iNavTrim(iNav_Selected_Level5_Item) != "" ){
			temp = iNav_Selected_Level5_Item.split("_");
			iNav_Selected_Level5 = temp[0]+"_"+temp[1];
			iNav_Selected_Level4 = "L4"+"_"+temp[1];
			showLeftNav(iNav_Selected_Level5,iNav_Selected_Level4);
		}
	}
	else if(typeof iNav_Selected_Level4!='undefined'){
		temp = iNav_Selected_Level4.split("_");
		showLeftNav('none',iNav_Selected_Level4);
	}
	if(typeof iNavHide!='undefined'){
		hideNavElements();
	}
}

/*Display Leftnav*/
function showLeftNav(L5_Id, L4_Id){
	if(L4_Id.length!=0){
		var headerId = L4_Id.substring(3);
		document.getElementById(headerId).style.background ='#edf4f9';
		L5_Id = "L5"+"_"+temp[1];
	}
	if (L5_Id){
		if(L5_Id!='none'){
			if (document.getElementById(L5_Id))
				document.getElementById(L5_Id).style.display="block";
		}
	}
	if(typeof iNav_Selected_Level5_Item!='undefined'){
		newImage = "transparent url("+NAV_LOCATION+"/shared/nav/images/inav_k_arr.gif)  no-repeat scroll top left"; 
        document.getElementById(iNav_Selected_Level5_Item).style.background = newImage;
		document.getElementById(iNav_Selected_Level5_Item).style.color = "#1F5E8B";
	}
}
/*End: Leftnav*/

function hideNavElements() {

		if (iNavHide.length>0){

			for(i=0;i<iNavHide.length;i++) {
				if (document.getElementById(iNavHide[i])){
					document.getElementById(iNavHide[i]).style.display='none';
					if (typeof iNav_Selected_Level2!='undefined') {
						if (iNavHide[i] == iNav_Selected_Level2) {
							if (typeof iNav_Selected_Level3!='undefined') {
								var iNav_Level3_Hide = iNav_Selected_Level3;
								document.getElementById(iNav_Level3_Hide).style.display='none';
							}
						}
					}
				}
				if ('iNav_Search'==iNavHide[i]){
					if (document.getElementById('iNav_textbox'))
						document.getElementById('iNav_textbox').style.display='none';
					if (document.getElementById('iNav_Search_Seperator'))	
						document.getElementById('iNav_Search_Seperator').style.display='none';
					if (document.getElementById('iNav_SearchButton'))	
						document.getElementById('iNav_SearchButton').style.display='none';
				}
				if ('iNav_Utility_CARDMEMBERSITE'==iNavHide[i]){
					if (document.getElementById('iNav_Utility_Divider_CARDMEMBERSITE'))
						document.getElementById('iNav_Utility_Divider_CARDMEMBERSITE').style.display='none';
				}	
				if ('iNav_Utility_LOSTANDSTOLENCARD'==iNavHide[i]){
					if (document.getElementById('iNav_Utility_Divider_LOSTANDSTOLENCARD'))
						document.getElementById('iNav_Utility_Divider_LOSTANDSTOLENCARD').style.display='none';
				}	
				if ('iNav_Utility_CHANGELANGUAGE'==iNavHide[i]){
					if (document.getElementById('iNav_Utility_Divider_CHANGELANGUAGE'))
						document.getElementById('iNav_Utility_Divider_CHANGELANGUAGE').style.display='none';
				}
				if ('iNav_Utility_CONTACTUS'==iNavHide[i]){
					if (document.getElementById('iNav_Utility_Divider_CONTACTUS'))
						document.getElementById('iNav_Utility_Divider_CONTACTUS').style.display='none';
				}	
				if ('iNavLogoutButton'==iNavHide[i] || 'iNavLoginButton'==iNavHide[i]){
					if (document.getElementById('iNavLogoutButton'))
						document.getElementById('iNavLogoutButton').style.display='none';
					
					if (document.getElementById('iNavLoginButton'))
						document.getElementById('iNavLoginButton').style.display='none';

					if (document.getElementById('iNav_Search_Seperator'))	
						document.getElementById('iNav_Search_Seperator').style.display='none';
				}	
				if ('iNav_CountryName'==iNavHide[i]){
					if (document.getElementById('iNav_CountryName')){
						if (document.getElementById('iNav_CountrySep')){
							document.getElementById('iNav_CountryName').style.display='none';
							document.getElementById('iNav_CountrySep').style.display='none';
						}
					}
				}	
				if ('iNav_ChangeCountry'==iNavHide[i]){
					if (document.getElementById('iNav_ChangeCountry')){
						if (document.getElementById('iNav_CountrySep')){
							document.getElementById('iNav_ChangeCountry').style.display='none';
							document.getElementById('iNav_CountrySep').style.display='none';
						}
					}
				}
			}
		}
}


function clearTextBox(text){
	if(document.getElementById("iNav_textbox").value == text){
		document.getElementById("iNav_textbox").value = "";
	}
}
function populateTextBox(text){
	if(document.getElementById("iNav_textbox").value == ""){
		document.getElementById("iNav_textbox").value = text;
	}
}

/********* iNavScripts_Redesign_Timeout.js *******************/
	
	function readCookie(name) { 
		var nameEQ = name + "="; 
		var ca = document.cookie.split(';'); 
		for(var i=0;i < ca.length;i++) 
		{ 
			var c = ca[i]; 
			while (c.charAt(0)==' ') 
				c = c.substring(1,c.length); 
			if (c.indexOf(nameEQ) == 0) 
				return c.substring(nameEQ.length,c.length); 
		} 
		return null; 
	}

	function checkCardMember() { 
		var chkcookie = readCookie("blueboxvalues"); 
		if (chkcookie != null) 
			return true; 
		else 
			return false; 
	}

	function iNavLogIn(){
		if (typeof iNav_LOGIN_URL != 'undefined')
			window.location.href=iNav_LOGIN_URL;
		else
			window.location.href="http://www.americanexpress.com";
	}	

	function iNavLogOut(){
		if (typeof iNav_LOGOUT_URL != 'undefined')
			window.location.href=iNav_LOGOUT_URL;
		else
			window.location.href="http://www.americanexpress.com";
	}	

	function iNavSearchFunction() {
		var searchURL = iNav_SEARCH_URL;
		searchKeyWord = document.iNav_Form.iNav_textbox.value;
		searchURL = iNav_SEARCH_URL+"?p_search_text="+searchKeyWord;
		if(typeof iNav_SEARCH_URL != 'undefined' && iNav_SEARCH_URL != '')
			window.location.href = searchURL;
		return true;
	}

	function iNavTrim(trimText)	{
		while (trimText.substring(0,1) == ' ')	{
			trimText = trimText.substring(1, trimText.length);
		}
		while (trimText.substring(trimText.length-1, trimText.length) == ' ') {
			trimText = trimText.substring(0,trimText.length-1);
		}
		return trimText;
	} 

/********* Function for logo URL suppression *******************/	
	function linkToAmex(){
		var logoURL = iNav_logo_URL;
		if (typeof iNav_logo_url_suppress != 'undefined'){
			if(iNavTrim(iNav_logo_url_suppress) != "" ){ 
				return false;
			}
		}
		window.location.href = logoURL;
		return true;
	}
