






var vdiff_frame_found = false;

if (parent.frames.length != 0) {
		// loaded in frames
		var length = parent.frames.length;
		var vdiff_frame_regexp = new RegExp("vdiff_frame_", "i");

		for (var i=0; i<length; i++) {
				if ( parent.frames[i].name.match(vdiff_frame_regexp) != null ) {
						vdiff_frame_found = true;
						break;
				}
		}
}



function setBaseURL(URL) {
glbBaseURL = URL;

  this.baseURL = URL;
  this.spacer = new Image();
  this.spacer.src = relative('/uy/images/spacer.gif', this.baseURL);


 // Generic Navigation Section 

	navL1 = this.add(new NavTab( "/uy/", "/uy/images/nav_home_on.gif","113","16", "/uy/images/nav_home.gif","113","16", "Inicio", this.baseURL, true ));

	navL2 = navL1.add(new NavTab( "/uy/general/website_disclaimer.html", "","","", "","","", "Descargo Legal del Sitio", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "http://www.mastercardinternational.com/cgi-bin/index.cgi", "","","", "","","", "About the Company", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/general/contact_us.html", "","","", "","","", "Contáctenos", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/general/faq.html", "","","", "","","", "Preguntas Frecuentes", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/general/faq_current_cardholders.html", "Consultas e Informacion General", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/general/faq_apply.html", "Solicite una Tarjeta", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/general/faq_privacy.html", "Acerca de la Privacidad del Consumidor", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/uy/findacard/", "/uy/images/nav_find-a-card_on.gif","113","16", "/uy/images/nav_find-a-card.gif","113","16", "Nuestras Tarjetas", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/findacard/tarjetas_credito.html ", "/uy/wce/GIF/4085_nav_sub_tar_cre_on.gif","108","16", "/uy/wce/GIF/4084_nav_sub_tar_cre_off.gif","108","16", "Tarjetas de Crédito", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/findacard/standard_card.html", "MasterCard ", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/findacard/world_card.html", "MasterCard Internacional", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/findacard/corporate_card.html", "MasterCard Corporate", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/findacard/gold_card.html", "MasterCard Gold ", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/findacard/platinum_card.html", "MasterCard Platinum ", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/findacard/debito.html ", "/uy/wce/GIF/4087_nav_sub_tar_deb_on.gif","105","16", "/uy/wce/GIF/4086_nav_sub_tar_deb_off.gif","105","16", "Tarjetas de Débito", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/uy/cardholderservices/", "/uy/images/nav_cardholder-services_on.gif","113","16", "/uy/images/nav_cardholder-services.gif","113","16", "Servicios para Socios", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "http://www.mastercard.com/atmlocator/cobrand/index.jsp?lang=en&country=URY&var=COBRAND", "/uy/wce/GIF/4103_nav_sub_loc_caj_aut_on.gif","188","16", "/uy/wce/GIF/4102_nav_sub_loc_caj_aut_off.gif","188","16", "Localizador de Cajeros Automáticos", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/cardholderservices/atm/atm_country_template.html", "Cajeros Automáticos - Países", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/cardholderservices/atm/atm_map_template.html", "Mapa de Cajeros Automáticos", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/cardholderservices/atm/results.html", "Resultados de Cajeros Automáticos", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/cardholderservices/atm/tips.html", "Consejos Utiles - Cajeros Automáticos", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/uy/education/", "/uy/wce/GIF/4182_nav_edu_con_on.gif","140","16", "/uy/wce/GIF/4181_nav_edu_con_off.gif","140","16", "Educación al Consumidor", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/education/understanding_credit.html", "/uy/wce/GIF/4113_nav_sub_ent_cre_on.gif","131","16", "/uy/wce/GIF/4112_nav_sub_ent_cre_off.gif","131","16", "Entendiendo su Crédito", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/education/fraud_protection.html", "/uy/wce/GIF/4111_nav_sub_pro_fra_on.gif","138","16", "/uy/wce/GIF/4110_nav_sub_pro_fra_off.gif","138","16", "Protección contra Fraude", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/uy/promotions/promotion.html", "/uy/wce/GIF/6314_nav_prom_on.gif","113","16", "/uy/wce/GIF/6313_nav_prom_off.gif","113","16", "Promociones", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/promotions/ofertas_especiales.html", "/uy/wce/GIF/4099_nav_sub_ofe_esp_on.gif","106","16", "/uy/wce/GIF/4098_nav_sub_ofe_esp_off.gif","106","16", "Ofertas Especiales", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/uy/promotions/publicidad_sponsorship.html", "/uy/wce/GIF/4093_nav_sub_pub_spo_on.gif","137","16", "/uy/wce/GIF/4092_nav_sub_pub_spo_off.gif","137","16", "Sponsorship y Publicidad", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/uy/promotions/sponsorship.html", "Sponsorship", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/uy/promotions/copamundial.html", "Copa Mundial ", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/uy/promotions/eliminatorias.html", "Eliminatorias Mundial Alemania 2006", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/uy/promotions/copaamerica.html", "Copa América Perú 2004", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/uy/promotions/golf.html", "Golf", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/uy/promotions/espectaculos.html", "Espectaculos", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/uy/specialoffers/premiumoffers/index.html", "/uy/wce/GIF/12899_nav_gpo_on.gif","109","16", "/uy/wce/GIF/12898_nav_gpo_off.gif","109","16", "Beneficios Premium", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/uy/aboutus/acerca_mastercard.html", "/uy/wce/GIF/21419_nav_acerca_on.gif","140","16", "/uy/wce/GIF/21418_nav_acerca_off.gif","140","16", "Acerca de Mastercard", this.baseURL, false ));


 // Local Navigation Section 


}




var C_LANG = "lang";
var C_LANG_PREV = "lang_prev";


//var selectedTabIdx;	// the currently selected tab index


function NavTab(URL, ImgOn, ImgOnWidth, ImgOnHeight, ImgOff, ImgOffWidth, ImgOffHeight, ALT, base, hasAltLang) {	

        //if the the URL points to default index page, it appends index.html to the URL.
	URL = (URL.lastIndexOf("/") == URL.length-1) ? URL + "index.html" : URL;
	
	//this.imgOn = new MCImage(relative(ImgOn, base), ImgOnWidth, ImgOnHeight);
	//this.imgOff = new MCImage(relative(ImgOff, base), ImgOffWidth, ImgOffHeight);
	//this.hasImage = (ImgOff.length > 0)?true:false;
	this.hasAltLang = hasAltLang;
	this.defaultURL = URL;
	this.key = URL;
	this.url = relative(URL, base);

    // This logic is used to make the promotion tab images multi-lingual. When the authors enter a promotion in
    // navigation DCR, they should also download the the promotion images for all countries in the header.
	// For example, if the authors choose Promotion 1 in local navigation and they decide to set the on_image to 
	// /be/images/promo1_on.gif and off_image to /be/images/promo1.gif, and header contains france, german and dutch
	// then the authors should also download  /be/images/promo1_on_fr.gif,  /be/images/promo1_fr.gif, 
	// /be/images/promo1_on_de.gif,  /be/images/promo1_de.gif,  /be/images/promo1_on_nl.gif,  /be/images/promo1_nl.gif.
	// The naming convention mentioned above should be followed i.e. filename_<locale>.gif for promotion images
	// Based on whether the lang cookie is set, the image source is set to the correct lang image source.
	var URL_regexp = new RegExp("promotions", "i");

	if ( (URL.match (URL_regexp)) && (this.hasAltLang) ) {

			var cLang = getCookie(C_LANG);

			ImgOn_Name = ImgOn.substring(0, ImgOn.indexOf("."));
			ImgOn_Ext = ImgOn.substring(ImgOn.indexOf("."), ImgOn.length);

			ImgOff_Name = ImgOff.substring(0, ImgOff.indexOf("."));
			ImgOff_Ext = ImgOff.substring(ImgOff.indexOf("."), ImgOff.length);

			cLangOption = (cLang.length)?"_" + cLang:"";
			cImgOn = ImgOn_Name + cLangOption + ImgOn_Ext;
			cImgOff = ImgOff_Name + cLangOption + ImgOff_Ext;

			if (cLang.length) {
				ImgOn = cImgOn;
				ImgOff = cImgOff;
			}
	}
	
	this.imgOn = new MCImage(relative(ImgOn, base), ImgOnWidth, ImgOnHeight);
	this.imgOff = new MCImage(relative(ImgOff, base), ImgOffWidth, ImgOffHeight);
	this.hasImage = (ImgOff.length > 0)?true:false;

    if (! vdiff_frame_found) {

		if (this.hasAltLang) {	
			var cLang = getCookie(C_LANG);
			var pLang = getCookie(C_LANG_PREV);
			
			dFilepath = this.defaultURL.substring(0, this.defaultURL.lastIndexOf("."));				// the default file path
			dExt = this.defaultURL.substring(this.defaultURL.lastIndexOf("."), this.defaultURL.length);		// the default file extention
			
			pLangOption = (pLang.length)?"_" + pLang:"";
			pURL = dFilepath + pLangOption + dExt; 		// the previous language option url

			cLangOption = (cLang.length)?"_" + cLang:"";
			cURL = dFilepath + cLangOption + dExt;  // the current language option url

			var dFilepath_regexp = new RegExp(dFilepath, "i");

			if (cLang.length) {

				this.url = relative(cURL, base);	// all alt lang pages must point to the current lang option
			
				if (cURL == base) this.key = cURL;

				if ( base.match (dFilepath_regexp) ) {
					if ( (URL == base) || ((URL != base) && (cURL != base)) ) {
						// go to the language specific URL
						cURLTokens = cURL.split("/");
						location.href = cURLTokens[cURLTokens.length-1];

					}
				}
			} else {
				// The current language cookie is empty, so we use the default url.
				// If the language option is switched...
				if ( base.match (dFilepath_regexp) ) {
					if ( ((URL != base) && (cURL != base)) ) {
						// go to the default URL
						cURLTokens = cURL.split("/");
						location.href = cURLTokens[cURLTokens.length-1];
					}
				}
			}
		}
	}
	
	this.alt = ALT;
	this.inPath = false;
	this.subnav = new Array();	
}

function MCImage(s, w, h) {
	this.src = s;
	this.width = new Number(w);
	this.height = new Number(h);	
}

function NavLink(URL, Label, base, hasAltLang) {

	//if the the URL points to default index page, it appends index.html to the URL.
	URL = (URL.lastIndexOf("/") == URL.length-1) ? URL + "index.html" : URL;

	this.label = Label;
	this.hasAltLang = hasAltLang;
	this.defaultURL = URL;
	this.key = URL;
	this.url = relative(URL, base);

    if (! vdiff_frame_found) {

		if (this.hasAltLang) {	
			var cLang = getCookie(C_LANG);
			var pLang = getCookie(C_LANG_PREV);
			
			dFilepath = this.defaultURL.substring(0, this.defaultURL.lastIndexOf("."));				// the default file path
			dExt = this.defaultURL.substring(this.defaultURL.lastIndexOf("."), this.defaultURL.length);		// the default file extention
			
			pLangOption = (pLang.length)?"_" + pLang:"";
			pURL = dFilepath + pLangOption + dExt; 						// the previous language option url

			cLangOption = (cLang.length)?"_" + cLang:"";
			cURL = dFilepath + cLangOption + dExt;  // the current language option url

			var dFilepath_regexp = new RegExp(dFilepath, "i");

			if (cLang.length) {

				this.url = relative(cURL, base);							// all alt lang pages must point to the current lang option
			
				if (cURL == base) this.key = cURL;
				
				if ( base.match (dFilepath_regexp) ) {
					if ( (URL == base) || ((URL != base) && (cURL != base)) ) {
						// go to the language specific URL
						cURLTokens = cURL.split("/");
						location.href = cURLTokens[cURLTokens.length-1];
					}
				}
			} else {
				// The current language cookie is empty, so we use the default url.
				// If the language option is switched...
				if ( base.match (dFilepath_regexp) ) {
					if ( ((URL != base) && (cURL != base)) ) {
						// go to the default URL
						cURLTokens = cURL.split("/");
						location.href = cURLTokens[cURLTokens.length-1];
					}
				}
			}
		}
	}	
	
	this.inPath = false;
	this.subnav = new Array();	
}

function NavSystem() {
	this.nPrimary = null;
	this.nPrimaryIMG = null;
	this.nSecondary = null;
	this.nTertiary = null;
	this.baseURL = "";
	this.subnav = new Array();
}		

function writeNavTabs() {
	// navObj points to the current page, whose URL should match the baseURL;
	var navObj = getNavObject(this.baseURL, this);
	
	// to make sure the current page can navigate to itself
	baseURLTokens = this.baseURL.split("/");
	if (navObj) navObj.url = baseURLTokens[baseURLTokens.length-1];
							
	function getNavObject(key, base) {
		var i; 
		var myKey = key;
		var myBase = base;
		var myObj = null;

		for (i=0; i < myBase.subnav.length; i++) {		
			var base_cgi_url = myBase.subnav[i].substring (0, myBase.subnav[i].lastIndexOf("?"));

			if ( (myKey == myBase.subnav[i]) || (myKey == myBase.subnav[i] + "index.html") || ((base_cgi_url) && (myKey.match(base_cgi_url))) ) {
				setNavPath(myBase.subnav[i].item);
			 	return myBase.subnav[i].item;
			} 

			if (myBase.subnav[i].item.subnav.length) {
				myObj = getNavObject(myKey, myBase.subnav[i].item)
				if (myObj != null) {
					setNavPath(myObj);
					return myObj;
				}
			}					
		}
	}
	
	function setNavPath($obj) {
		var obj = $obj;
		obj.inPath = true;
		if (obj.parent) setNavPath(obj.parent);
	}			
	
	document.write("<table border='0' cellpadding='0' cellspacing='0'>");
	document.write("<tr>");
	
	var selectedTabIdx;

	// Primary Navigation Tabs	

	var wp = new Array();
	var wpi = new Array();
	for (i=0; i < this.subnav.length; i++) {
		if (this.subnav[i].item.inPath) {		
			if (this.subnav[i].item.hasImage) document.write("<td><a href='" + this.subnav[i].item.url + "'><img src='" + this.subnav[i].item.imgOn.src + "' alt='" + this.subnav[i].item.alt + "' width='" + this.subnav[i].item.imgOn.width + "' height='" + this.subnav[i].item.imgOn.height + "' border='0'></a></td>");	
			//if (this.subnav[i].item.hasImage) document.write("<td><a href='" + this.subnav[i].item.url + "' onClick='javascript:setCurrentTab(" + i + ");'" + "><img src='" + this.subnav[i].item.imgOn.src + "' alt='" + this.subnav[i].item.alt + "' width='" + this.subnav[i].item.imgOn.width + "' height='" + this.subnav[i].item.imgOn.height + "' border='0'></a></td>");
			this.nPrimary = this.subnav[i].item;
			this.nPrimaryIMG = this.subnav[i].item.url;
			wpi[i] = this.subnav[i].item.url;
			wp[i] = this.subnav[i].item.imgOn.width;
wsstag_category = this.subnav[i].item.alt;
			selectedTabIdx = i;
		
		} else {
			if (this.subnav[i].item.hasImage) document.write("<td><a href='" + this.subnav[i].item.url + "'><img src='" + this.subnav[i].item.imgOff.src + "' alt='" + this.subnav[i].item.alt + "' width='" + this.subnav[i].item.imgOff.width + "' height='" + this.subnav[i].item.imgOff.height + "' border='0'></a></td>");
			//if (this.subnav[i].item.hasImage) document.write("<td><a href='" + this.subnav[i].item.url + "' onClick='javascript:setCurrentTab(" + i + ");'" + "><img src='" + this.subnav[i].item.imgOff.src + "' alt='" + this.subnav[i].item.alt + "' width='" + this.subnav[i].item.imgOff.width + "' height='" + this.subnav[i].item.imgOff.height + "' border='0'></a></td>");
			this.nPrimaryIMG = this.subnav[i].item.url;
			wpi[i] = this.subnav[i].item.url;
			wp[i] = this.subnav[i].item.imgOn.width;
		}				
	
	}	
	document.write("<td width='100%' background='" + relative("/uy/images/nav_rule.gif", this.baseURL) + "'><img src='" + relative("/uy/images/nav_rule.gif", this.baseURL) + "' alt='rule' width='100%' height='16' border='0'></td>");
	document.write("</tr>");
	document.write("</table>");
	
	document.write("<table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>");
	document.write("<tr>");	
	
	
	// Secondary Navigation Tabs	
	if (this.nPrimary && this.nPrimary.subnav.length) {

		var L = 0;
		for (j=0; j < this.nPrimary.subnav.length; j++) {
			L += this.nPrimary.subnav[j].item.imgOff.width;
		}
		
		var secondNavTabWidth = (L/2);
		var currentPrimaryTabWidth = getWidth(selectedTabIdx,wp);
		
//		document.write("<td><img src='" + this.spacer.src + "' width='" + (((2*this.nPrimary.index+1)*this.subnav[this.nPrimary.index].item.imgOff.width-L)/2) + "' height='26' alt='' border='0'></td>");

		if ((currentPrimaryTabWidth - secondNavTabWidth) != -1 ) {
			document.write("<td><img src='" + this.spacer.src + "' width='" + (currentPrimaryTabWidth - secondNavTabWidth) + "' height='26' alt='' border='0'></td>");
		}
		else {
			if (( currentPrimaryTabWidth - secondNavTabWidth ) > window.screen.availWidth) {
			document.write("<td><img src='" + this.spacer.src + "' width='" + (window.screen.availWidth - (secondNavTabWidth*2)) + "' height='26' alt='' border='0'></td>");
		}}
		
		if (this.nPrimary.subnav[0].item.hasImage)
			document.write("<td><img src='" + relative("/uy/images/nav_sub_left-border.gif", this.baseURL) + "' width='1' height='16' border='0' alt=''></td>");

		for (k=0; k < this.nPrimary.subnav.length; k++) {
		
			if (this.nPrimary.subnav[k].item.inPath) {
				if (this.nPrimary.subnav[k].item.hasImage) document.write("<td><a href='" + this.nPrimary.subnav[k].item.url + "'><img src='" + this.nPrimary.subnav[k].item.imgOn.src + "' width='" + this.nPrimary.subnav[k].item.imgOn.width + "' height='" + this.nPrimary.subnav[k].item.imgOn.height + "' alt='" + this.nPrimary.subnav[k].item.alt + "' border='0'></a></td>");
				this.nSecondary = this.nPrimary.subnav[k].item;
			} else {
				if (this.nPrimary.subnav[k].item.hasImage) document.write("<td><a href='" + this.nPrimary.subnav[k].item.url + "'><img src='" + this.nPrimary.subnav[k].item.imgOff.src + "' width='" + this.nPrimary.subnav[k].item.imgOff.width + "' height='" + this.nPrimary.subnav[k].item.imgOff.height + "' alt='" + this.nPrimary.subnav[k].item.alt + "' border='0'></a></td>");	
				
		
			}				
		}
	
		document.write("<td width='100%'>&nbsp;</td>");
		document.write("</tr>");
		document.write("<tr>");
		document.write("<td width='100%' bgcolor='#FFFFFF' colspan='" + (this.nPrimary.subnav.length + 3) + "'><img src='" + this.spacer.src + "' width='1' height='26' alt='' border='0'></td>");
		document.write("</tr>");
		
	} else {
		document.write("<td width='100%' bgcolor='#FFFFFF'><img src='" + this.spacer.src + "' width='1' height='26' alt='' border='0'></td>");
		document.write("</tr>");
	}
	
	document.write("</table>");
	document.write("</td>");
	document.write("</tr>");
	document.write("<tr>");
	document.write("<td bgcolor='#FFFFFF' valign='top'>");
} 

function writeSubNav() {
	if (this.nSecondary && this.nSecondary.subnav.length) {
		document.write("<table border='0' cellspacing='0' cellpadding='0' width='200'>");
		document.write("<tr>");
		document.write("<td rowspan='100%'><img src='" + this.spacer.src + "' width='25' height='1' alt='' border='0'/></td>");
		document.write("<td><img src='" + this.spacer.src + "' width='15' height='15' alt='' border='0'/></td>");
		document.write("<td width='100%'><img src='" + this.spacer.src + "' width='1' height='1' alt='' border='0'/></td>");
		document.write("<td rowspan='100%'><img src='" + this.spacer.src + "' width='15' height='1' alt='' border='0'/></td>");
		document.write("</tr>");
		
		var arrowDownSrc = relative("/uy/images/arrow_down.gif", this.baseURL);
		var arrowRightSmallSrc = relative("/uy/images/arrow_right_small.gif", this.baseURL) ;
		var arrowRightLargeSrc = relative("/uy/images/arrow_right_large.gif", this.baseURL);
		
		for (i=0; i < this.nSecondary.subnav.length; i++) {
			if (this.nSecondary.subnav[i].item.inPath) {
				this.nTertiary = this.nSecondary.subnav[i].item;
				document.write("<tr>");
				document.write("<td valign='top'><img src='" + arrowDownSrc + "' width='13' height='8' alt='' border='0' vspace='3'></td>");
				document.write("<td>");
				document.write("<a href='" + this.nSecondary.subnav[i].item.url + "' class='linkselected'>" + this.nSecondary.subnav[i].item.label + "</a>");
				if (this.nTertiary.subnav.length) {
					for (j=0; j < this.nTertiary.subnav.length; j++) {
						document.write("<br /><img src='" + arrowRightSmallSrc + "' width='9' height='7' alt='' border='0'><a href='" + this.nTertiary.subnav[j].item.url + "' class='linksmall'>" + this.nTertiary.subnav[j].item.label + "</a>");
					}
				}
				document.write("</td>");
				document.write("</tr>");
			} else {
				document.write("<tr>");
				document.write("<td valign='top'><img src='" + arrowRightLargeSrc + "' width='6' height='11' alt='' border='0' hspace='3' vspace='3'></td>");
				document.write("<td><a href='" + this.nSecondary.subnav[i].item.url + "' class='link'>" + this.nSecondary.subnav[i].item.label + "</a></td>");
				document.write("</tr>");
			}
			document.write("<tr>");
			document.write("<td colspan='2'><img src='" + this.spacer.src + "' width='1' height='3' alt='' border='0'></td>");
			document.write("</tr>");		
		}
		document.write("<tr>");
		document.write("<td colspan='2'><img src='" + this.spacer.src + "' width='1' height='20' alt='' border='0'></td>");
		document.write("</tr>");
		document.write("</table>");
	}
}
function writeFooterLinks() {
	var home = this.subnav[0].item;
	for (i=0; i<home.subnav.length; i++) {
		document.write("<a href=\'" + home.subnav[i].item.url + "\' class='globalHeaderLinks'>" + home.subnav[i].item.alt + "</a>");
		if (i != home.subnav.length-1) document.write(" | ");
	}	
}

function getCookie(name) {
	var allcookies = document.cookie;
	var pos = allcookies.indexOf(name+"=");
	var value = "";
	if (pos != -1) {
		var start = pos + name.length + 1;
		var end = allcookies.indexOf(";", start);
		if (end == -1) end = allcookies.length;
		var value = allcookies.substring(start, end);
		value = unescape(value);
	}
	return value;
}

function setCookie(name, value) {
	var nextyear = new Date();
	nextyear.setFullYear(nextyear.getFullYear() + 1);
	
	var sCookie = name + "=" + escape(value);
	sCookie += "; expires=" + nextyear.toGMTString();
	sCookie += "; path=/";
	//sCookie += "; domain=mastercard.com";
	
	document.cookie = sCookie;
}

function deleteCookie(name) {
	var lastyear = new Date();
	lastyear.setFullYear(lastyear.getFullYear() - 1);
	
	document.cookie = name + "=; expires=" + lastyear.toGMTString();
}

function pop(url) {	
		
	var h = 540; // height of the window
	var w = 410; // width of the window
	var winleft = 75;
  	var wintop = 125;
	if(parseInt(navigator.appVersion)>=4) {
		winleft = (screen.width-w)/2;
		wintop = (screen.height-h)/2;
	}
	settings='height=' + h + ',width=' + w + ',top=' + wintop + ',left=' + winleft + ',scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=yes,dependent=no'
	window.open(url,"PopUp",settings);
	return void(null);

}

function relative(resourceURL, locationURL) {
	var relativePath = "";
	
	if ((resourceURL.indexOf("http://") == 0)||(resourceURL.indexOf("https://") == 0)) {
		relativePath = 'javascript:pop("' + resourceURL + '")';
		return relativePath;
	}
	
	aResource = resourceURL.substring(1, resourceURL.length).split("/");
	aLocation = locationURL.substring(1, locationURL.length).split("/");

	// first, remove anything in either path that is common
	var start = 0;
	
	for (m=0; m<aResource.length; m++) {
		if (m <= aLocation.length && aResource[m] != aLocation[m]) {
			start = m;			
			break;					
		}
	}
	
	aResource = aResource.slice(start, aResource.length);
	aLocation = aLocation.slice(start, aLocation.length);
	
	// then, get the relativePathative path from locationURL to the root
	var n = 0;
	while (n < aLocation.length-1) {
		relativePath += "../";
		n++;		
	}

	// lastly, add each remaining element of the resource path to the relativePath path.
	for (p=0; p<aResource.length; p++) {
		relativePath = (p==aResource.length-1)?relativePath + aResource[p]:relativePath + aResource[p] + "/";
	}

	return relativePath;
}

function addNavSystemObject(obj) {
	index = this.subnav.length;
	key = this.subnav[index] = new String(obj.key);
	key.item = obj;
	key.item.index = index;
	return key.item;
}

function addNavTabObject(obj) {
	index = this.subnav.length;
	key = this.subnav[index] = new String(obj.key);
	obj.parent = this;
       // if(!obj.hasImage && !obj.label) this.imgOn = this.imgOff;
	key.item = obj;
	return key.item;
}

function addNavLinkObject(obj) {
	index = this.subnav.length;
	key = this.subnav[index] = new String(obj.key);
	obj.parent = this;
	key.item = obj;
	return key.item;
}

function setLanguage(code) {
	var pLang = getCookie(C_LANG);
	setCookie(C_LANG_PREV, pLang);
	setCookie(C_LANG, code);
	location.reload();
}

function setDefault() {
	var pLang = getCookie(C_LANG);
	setCookie(C_LANG_PREV, pLang);
	setCookie(C_LANG, "");
	location.reload();
}


NavSystem.prototype.setBaseURL = setBaseURL;
NavSystem.prototype.writeNavTabs = writeNavTabs;
NavSystem.prototype.writeSubNav = writeSubNav;
NavSystem.prototype.writeFooterLinks = writeFooterLinks;
NavSystem.prototype.add = addNavSystemObject;
NavSystem.prototype.setLanguage = setLanguage;
NavSystem.prototype.setDefault = setDefault;
NavTab.prototype.add = addNavTabObject;
NavLink.prototype.add = addNavLinkObject;

function getTabNumber(selectedTabUrl, tabUrls) {
	alert("Selected Tab Url: " +selectedTabUrl);
	
	for(m=0; m < tabNames.length; m++) {
	alert("Current Loop Tab Url: " +tabUrls[m]);
		if (selectedTabUrl == tabUrls[m])  {
//			wpt += (wp[m]/2);
			alert("M " +m);
			return m;
//			document.write("<td><img src='" + this.spacer.src + "' width='" + (wpt-b) + "' height='26' alt='' border='0'></td>");	
		}
	}
}	





// this function is called whenever a tab is clicked in order to obtain the index of the selected tab
function setCurrentTab(tabIdx) {
    this.selectedTabIdx = tabIdx;
    //alert("tabIndex: " + tabIdx);
//    alert("tabIndex: " + this.selectedTabIdx);
}


// obtain the width for the currently selected tab
function getWidth(tabIdx,wp) {

   var width = wp[tabIdx]/2;
//   alert("last tab width: " + width);
   
   if( tabIdx > 0 ) {
      for( var i=0; i < tabIdx; i++ ) {
         width = width + wp[i];
//         alert("width + tabIdx(" + i + "): " + width);
      }
   }
   
   return width;   
}

var nav = new NavSystem();




