






if (0) {
	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('/tw/images/spacer.gif', this.baseURL);


 // Generic Navigation Section 

	navL1 = this.add(new NavTab( "/tw/", "/tw/wce/GIF/3603_home_on.gif","113","16", "/tw/wce/GIF/3602_home_off.gif","113","16", "首頁", this.baseURL, true ));

	navL2 = navL1.add(new NavTab( "/tw/general/website_disclaimer.html", "","","", "","","", "隱私政策", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "http://www.mastercardinternational.com/cgi-bin/index.cgi", "","","", "","","", "關於萬事達卡", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/general/contact_us.html", "","","", "","","", "與我們聯 絡", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/general/faq.html", "","","", "","","", "常見的問題", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/general/faq_current_cardholders.html", "萬事達卡持卡人", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/general/faq_apply.html", "申請信用卡", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/general/faq_privacy.html", "有關隱私權", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/tw/findacard/", "/tw/wce/GIF/3601_find_a_card_on.gif","113","16", "/tw/wce/GIF/3600_find_a_card_off.gif","113","16", "我們的卡片", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/findacard/credit_card.html", "/tw/wce/GIF/4140_nav_sub_creditcard_on.gif","61","16", "/tw/wce/GIF/4141_nav_sub_creditcard_off.gif","61","16", "信用卡", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/findacard/gold_card.html", "萬事達卡金卡", this.baseURL, true ));

	navL4 = navL3.add(new NavLink( "/tw/findacard/platinum_card.html", "萬事達卡白金卡", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/findacard/world_card.html", "萬事達卡世界卡", this.baseURL, true ));

	navL2 = navL1.add(new NavTab( "/tw/findacard/debit_card.html", "/tw/wce/GIF/4144_nav_sub_debit_on.gif","61","16", "/tw/wce/GIF/4145_nav_sub_debit_off.gif","61","16", "轉帳卡", this.baseURL, true ));

	navL2 = navL1.add(new NavTab( "/tw/findacard/prepaid_card.html", "/tw/wce/GIF/4142_nav_sub_prepaid_on.gif","61","16", "/tw/wce/GIF/4143_nav_sub_prepaid_off.gif","61","16", "儲值卡", this.baseURL, true ));

	navL2 = navL1.add(new NavTab( "/tw/findacard/request_a_card.html", "/tw/wce/GIF/4146_nav_sub_request_on.gif","73","16", "/tw/wce/GIF/4147_nav_sub_request_off.gif","73","16", "申請信用卡", this.baseURL, true ));

	navL1 = this.add(new NavTab( "/tw/cardholderservices/", "/tw/wce/GIF/3599_cardserv_on.gif","113","16", "/tw/wce/GIF/3598_cardserv_off.gif","113","16", "持卡人服務", this.baseURL, true ));

	navL2 = navL1.add(new NavTab( "/tw/general/emergency.html", "/tw/wce/GIF/4149_nav_sub_emergency_on.gif","86","16", "/tw/wce/GIF/4148_nav_sub_emergency_off.gif","86","16", "緊急救援服務", this.baseURL, true ));

	navL2 = navL1.add(new NavTab( "http://www.mastercard.com/atmlocator/cobrand/index.jsp?lang=zh&country=TWN&var=COBRAND", "/tw/wce/GIF/4151_nav_sub_atm_on.gif","86","16", "/tw/wce/GIF/4150_nav_sub_atm_off.gif","86","16", "ATM位置指南", this.baseURL, true ));

	navL3 = navL2.add(new NavLink( "/tw/cardholderservices/atm/atm_country_template.html", "ATM Country Template", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/cardholderservices/atm/atm_map_template.html", "ATM Map Template", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/cardholderservices/atm/results.html", "ATM Results", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/cardholderservices/atm/tips.html", "ATM Tips", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/tw/education/", "/tw/wce/GIF/3770_edu_on.gif","113","16", "/tw/wce/GIF/3771_edu_off.gif","113","16", "持卡人須知", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/education/using_your_card.html", "/tw/wce/GIF/4158_nav_sub_using_ur_card_on.gif","86","16", "/tw/wce/GIF/4155_nav_sub_using_ur_card_off.gif","86","16", "使用您的卡片", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/education/fraud_protection.html", "/tw/wce/GIF/4159_nav_sub_fraud_protect_on.gif","61","16", "/tw/wce/GIF/4160_nav_sub_fraud_protect_off.gif","61","16", "防止盜刷", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/education/glossary.html", "/tw/wce/GIF/4153_nav_sub_glossary_on.gif","100","16", "/tw/wce/GIF/4154_nav_sub_glossary_off.gif","100","16", "信用卡常見名詞", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/tw/securityandbasics/debtknowhow/index.html", "/tw/wce/GIF/11777_debtknowhow_on.gif","113","16", "/tw/wce/GIF/11778_debtknowhow_off.gif","113","16", "財富管理大師", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/securityandbasics/debtknowhow/index.html", "/tw/wce/GIF/11688_debtknowhow_tab_on.gif","96","22", "/tw/wce/GIF/11689_debtknowhow_tab_off.gif","96","22", "財富管理大師", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/securityandbasics/debtknowhow/debtbasics.html", "債務基本須知", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/smartsteps.html", "10個聰明步驟", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/rewardsofgettingout.html", "遠離負債的好處", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/securityandbasics/debtknowhow/debtwarningsigns.html", "設定負債警示訊號", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/causesoffinancial.html", "財務危機的原因", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/quiz.html", "測驗", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/howtohelp.html", "幫助朋友及家人", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/securityandbasics/debtknowhow/assessyourdebt.html", "評估您的未清償債務", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/measureyourdebt.html", "管理您的未清償債務", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/paymorethan.html", "繳款高於最低應繳金額", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/securityandbasics/debtknowhow/knowyourcredit.html", "瞭解您的信用歷史", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/requestyourcredit.html", "申請您的信用報告", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/disputeerrors.html", "對錯誤之處提出爭議", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/understandyour.html", "瞭解您的信用報告", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/buildgood.html", "建立良好信用", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/securityandbasics/debtknowhow/payoffyourdebt.html", "償還所有欠款", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/waystosave.html", "省錢方式", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/gettinghelp.html", "尋求協助", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/whatisdebtmanagement.html", "債務管理計劃", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/whatisdebtreduction.html", "債務減輕方案", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/filingforbankruptcy.html", "申請破產", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/securityandbasics/debtknowhow/debtresources.html", "財富管理相關資源", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/debtquestions.html", "債務問題", this.baseURL, false ));

	navL4 = navL3.add(new NavLink( "/tw/securityandbasics/debtknowhow/helpfullinks.html", "實用網站連結", this.baseURL, false ));

	navL1 = this.add(new NavTab( "/tw/promotions/index.html", "/tw/wce/GIF/3776_promote_on.gif","113","16", "/tw/wce/GIF/3775_promote_off.gif","113","16", "卡友獨享優惠", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/promotions/promotion_index.html", "/tw/wce/GIF/4236_promote_tab_on.gif","86","16", "/tw/wce/GIF/4237_promote_tab_off.gif","86","16", "最新活動及資訊", this.baseURL, false ));
	
	navL2 = navL1.add(new NavTab( "/tw/pressroom/index.html", "/tw/wce/GIF/4238_pressroom_tab_on.gif","86","16", "/tw/wce/GIF/4239_pressroom_tab_off.gif","86","16", "新聞中心", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/world2007/world_index.html", "/tw/wce/GIF/world_tab_on.gif","102","16", "/tw/wce/GIF/world_tab_off.gif","102","16", "世界卡獨享禮遇", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/world2007/travel_index.html", "至尊之旅 Premium Travel", this.baseURL, false ));
	
	navL3 = navL2.add(new NavLink( "/tw/world2007/leisure_index.html", "休閒享憩 Enjoy Leisure", this.baseURL, false ));
	
	navL3 = navL2.add(new NavLink( "/tw/world2007/food_index.html", "美味佳餚 Wine & Dine", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/world2007/living_index.html", "愜意人生 Living", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/business2007/business_index.html", "/tw/wce/GIF/business_tab_on.gif","102","16", "/tw/wce/GIF/business_tab_off.gif","102","16", "商務卡獨享禮遇", this.baseURL, false ));

	navL2 = navL1.add(new NavTab( "/tw/premium2007/premium_index.html", "/tw/wce/GIF/12739_premium_tab_on.gif","102","16", "/tw/wce/GIF/12740_premium_tab_off.gif","102","16", "大中華尊貴禮遇", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/premium2007/travel_index.html", "至尊之旅 Premium Travel", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/premium2007/food_index.html", "美味佳餚 Wine & Dine", this.baseURL, false ));
	
	navL3 = navL2.add(new NavLink( "/tw/premium2007/golf_index.html", "暢意揮杆 Golf Courses", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/premium2007/shopping_index.html", "品味之選 Shopping", this.baseURL, false ));

	navL3 = navL2.add(new NavLink( "/tw/premium2007/living_index.html", "愜意人生 Living", this.baseURL, false ));
	
	navL2 = navL1.add(new NavTab( "/tw/promotions/contributor_index.html", "/tw/wce/GIF/12738_contributor_tab_on.gif","86","16", "/tw/wce/GIF/12737_contributor_tab_off.gif","86","16", "尊榮秘書", this.baseURL, false ));

}





var C_LANG = "lang";
var C_LANG_PREV = "lang_prev";

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);
	
	if (0) {	
		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 (0) {
		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.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>");
		
	// Primary Navigation Tabs			
	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>");	
			this.nPrimary = this.subnav[i].item
		} 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>");	
		}				
	}
	
	document.write("<td width='100%' background='" + relative("/tw/images/nav_rule.gif", this.baseURL) + "'><img src='" + relative("/tw/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 (i=0; i < this.nPrimary.subnav.length; i++) {
			L += this.nPrimary.subnav[i].item.imgOff.width;
		}
		
		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 (this.nPrimary.subnav[0].item.hasImage)
			document.write("<td><img src='" + relative("/tw/images/nav_sub_left-border.gif", this.baseURL) + "' width='1' height='16' border='0' alt=''></td>");

		for (i=0; i < this.nPrimary.subnav.length; i++) {
			if (this.nPrimary.subnav[i].item.inPath) {
				if (this.nPrimary.subnav[i].item.hasImage) document.write("<td><a href='" + this.nPrimary.subnav[i].item.url + "'><img src='" + this.nPrimary.subnav[i].item.imgOn.src + "' width='" + this.nPrimary.subnav[i].item.imgOn.width + "' height='" + this.nPrimary.subnav[i].item.imgOn.height + "' alt='" + this.nPrimary.subnav[i].item.alt + "' border='0'></a></td>");
				this.nSecondary = this.nPrimary.subnav[i].item;
			} else {
				if (this.nPrimary.subnav[i].item.hasImage) document.write("<td><a href='" + this.nPrimary.subnav[i].item.url + "'><img src='" + this.nPrimary.subnav[i].item.imgOff.src + "' width='" + this.nPrimary.subnav[i].item.imgOff.width + "' height='" + this.nPrimary.subnav[i].item.imgOff.height + "' alt='" + this.nPrimary.subnav[i].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("/tw/images/arrow_down.gif", this.baseURL);
		var arrowRightSmallSrc = relative("/tw/images/arrow_right_small.gif", this.baseURL) ;
		var arrowRightLargeSrc = relative("/tw/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 winwidth = 650; // width of the new window
    var winheight = 350; // height of the new window
    var winleft = 75;
    var wintop = 125;

    if(parseInt(navigator.appVersion)>=4) {

        winleft = (screen.width / 2) - (winwidth / 2); // center the window right to left
        wintop = (screen.height / 2) - (winheight / 2); // center the window top to bottom

    }

    var attrib =  'top=' + wintop + ',left=' + winleft + ',height=' + winheight + ',width=' + winwidth + ',scrollbars=yes, resizable=yes';

    window.open(url, "PopUp", attrib);
    return void(null);

}

function relative(resourceURL, locationURL) {
	var relativePath = "";
	
	if (resourceURL.indexOf("http://") == 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;

var nav = new NavSystem();


