// JavaScript Document
/* Domain */
var defhost = document.URL;
var defhost = defhost.substr(defhost.lastIndexOf('//')+2,defhost.length);
var defhost = defhost.substr(0,defhost.indexOf('/'));
//document.write(defhost);

/* Language */
var lang = 'en';

/* Words */
var words = new Array();

words.push(Array('personal-banking','Personal Banking'));
words.push(Array('deposits','Deposits'));
words.push(Array('power-saver','Power $aver'));
words.push(Array('executive-banking','Executive Banking'));
words.push(Array('excel-banking','Excel Banking'));
words.push(Array('interest-rate','Interest Rate'));
words.push(Array('flexi-deposit','Flexi Deposit'));
words.push(Array('tariffs','Tariffs'));
words.push(Array('forms','Forms'));
words.push(Array('terms-and-conditions','Terms & Conditions'));

words.push(Array('loans','Loans'));
words.push(Array('product-feature','Product Features'));
words.push(Array('interest-rate-and-charges','Interest rate & charges'));
words.push(Array('online-application-forms','Online application Forms'));
words.push(Array('customer-survey','Customer\'s survey'));
words.push(Array('FAQs','F.A.Qs'));

words.push(Array('services','Services'));
words.push(Array('branch-banking-hours','Branch Banking Hours'));
words.push(Array('cheque-services','Cheque Services'));
words.push(Array('automated-banking-lobby','Automated Banking Lobby'));
words.push(Array('call-center','Call centre'));
words.push(Array('i-banking','Online Banking'));
words.push(Array('online-banking','Online Banking'));
words.push(Array('e-statement','e-Statement'));
words.push(Array('contact-the-bank','Contact the Bank'));

words.push(Array('sme-banking','SME Banking'));
words.push(Array('business-guarantee','business Guarantee'));
words.push(Array('deposits-investments','Deposits & Investments'));
words.push(Array('flexi-deposit','Flexi Deposit'));
words.push(Array('business-saver','business $aver'));
words.push(Array('straight2bank-e-banking','Straight2Bank'));
words.push(Array('trade-facilities','Trade Facilities'));

words.push(Array('contact-us','Contact Us'));
words.push(Array('terms-conditions','Terms & Conditions'));
words.push(Array('investor-relations','Investor Relations'));
words.push(Array('data-protection-privacy-policy','Data Protection & Privacy Policy'));
words.push(Array('about-us','About Us'));

words.push(Array('client-charter','Client Charter'));

words.push(Array('sitemap','Site Map'));

words.push(Array('usefullink','Useful Links'));

words.push(Array('accounts-deposits','Accounts and Deposits'));
words.push(Array('savings-account','Savings Account'));
words.push(Array('dream-account','Dream Account'));
words.push(Array('diva-account','Diva Account'));
words.push(Array('executive-account','Executive Account'));
words.push(Array('junior-account','Junior Account'));
words.push(Array('current-account','Current Account'));
words.push(Array('payroll-booster','Payroll Booster'));
words.push(Array('ultra-pack','Ultra Pack'));
words.push(Array('credit-cards','Credit Cards'));
words.push(Array('visa-gold-credit-card','Visa Gold Credit Card'));
words.push(Array('visa-classic-credit-card','Visa Classic Credit Card'));
words.push(Array('visa-infinite-credit-card','Visa Infinite Credit Card'));
words.push(Array('platinum-credit-card','Platinum Credit Card'));
words.push(Array('airports','List of Airports'));
words.push(Array('infinite-travel','Travel'));
words.push(Array('infinite-peace-of-mind','Peace of Mind'));
words.push(Array('infinite-rewards','Rewards'));
words.push(Array('infinite-services','Services'));
words.push(Array('infinite-convenience','Convenience'));
words.push(Array('personal-loan','Personal Loan'));
words.push(Array('wealth-management','Wealth Management'));
words.push(Array('bancassurance','Bancassurance'));
words.push(Array('investment-plan','Investment Plan'));
words.push(Array('retirement-plan','Retirement Plan'));
words.push(Array('education-plan','Education Plan'));
words.push(Array('life-insurance-plan','Life Insurance Plan'));
words.push(Array('priority-banking','Priority Banking'));
words.push(Array('channels','Channels'));
words.push(Array('branches','Branches'));
words.push(Array('atm','ATM'));
words.push(Array('call-center','Call Center'));
words.push(Array('phone-banking','Phone Banking'));
words.push(Array('e-mail','E-mail'));
words.push(Array('e-statements','eStatements'));
words.push(Array('tnc-cc-estatements','General eStatement T&Cs'));
words.push(Array('business-current-accounts','Business Current Accounts'));
words.push(Array('business-plus-account','Business Plus Account'));
words.push(Array('business-premium-account','Business Premium Account'));
words.push(Array('business-priority-account','Business Priority Account'));
words.push(Array('individual-establishment-account','Individual Establishment Account'));
words.push(Array('financing','Financing'));
words.push(Array('business-instalment-loan','Business Instalment Loan'));
words.push(Array('express-trade-services','Express Trade Services'));
words.push(Array('treasury-services','Treasury Services'));
words.push(Array('helpdesk','Helpdesk'));
words.push(Array('NRI','NRI Banking'));
words.push(Array('press-releases','Press Releases'));
words.push(Array('22-feb-09','22 Feb 2009'));
words.push(Array('05-mar-09','05 Mar 2009'));
words.push(Array('03-mar-09','03 Mar 2009'));
words.push(Array('17-mar-09','17 Mar 2009'));
words.push(Array('23-mar-09','23 Mar 2009'));
words.push(Array('07-apr-09','07 Apr 2009'));
words.push(Array('16-apr-09','16 Apr 2009'));
words.push(Array('media-centre','Media Centre'));
words.push(Array('key-people-oman','Key People - Oman'));
words.push(Array('atms-and-branches','ATMs &amp; Branches'));
words.push(Array('media-contacts','Media Contacts'));
words.push(Array('11-jun-09','11 Jun 2009'));
words.push(Array('17-jun-09','17 Jun 2009'));
words.push(Array('03-jun-09','03 Jun 2009'));
words.push(Array('06-may-09','06 May 2009'));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));
words.push(Array('',''));

///////////////////////////////////////////////////////////////////////////////////////////

/* URL domain */
var ud = new String();
ud = document.URL;
var ud = ud.substr(ud.lastIndexOf('http://')+7,ud.length);
//document.write('<p><strong>The URL is: </strong>'+ud+'</p>');
var ua = new Array();
ua = ud.split('/');
//document.write('<p><strong>The URL array is: </strong>'+ua+'</p>');
ua.splice(1,ua.length);
//document.write('<p><strong>The URL array modified as: </strong>'+ua+' and total <strong>'+ua.length+'</strong> array item inside.</p>');
//ua[0] = 'www.standardchartered.com.hk';

/* URL path */
var up = new String();
up = document.location.pathname;
//document.write('<p><strong>URL path = </strong>'+up+'</p>');

/* Array link */
var al = new Array();
al = up.split('/');
//al.splice(0,1);
al.splice(al.length-2,2);
al[0] = ua[0];
//document.write('<p><strong>Array of link = </strong>'+al+'<br /><strong>Total array(s): </strong>'+al.length+'</p>');

/* Array */
var ap = new Array();
ap = up.split('/');
//ap.splice(0,1);
ap.splice(ap.length-2,2);
ap[1] = 'Home';
//document.write('<p><strong>Array of path = </strong>'+ap+'<br /><strong>Total array(s): </strong>'+ap.length+'</p>');

var ta = new Number(ap.length);

/* Value converstion */
//document.write('<p><strong>Converted array(s) as below: </strong><br />');
for (i=1; i<ta; i++) {
	var tmpvalue = ap[i];
	for (j=0; j<words.length;j++) {
		if (tmpvalue == words[j][0]) {
			ap[i] = words[j][1];
			//document.write(tmpvalue+' &gt; '+ap[i]+'<br />');
		}
	}
}
//document.write('</p><p>');

/* Store array */
var defuse = 0;
var sa = new Array();
for (k=1; k<ta; k++) {
	var tmppath = ap[k];
	if (tmppath == 'products') {
		continue;
	}
	////////////////////////////////////////////////////////////////
	// BEGIN Special treat for don't link to any pages
	if (tmppath == 'Deposits' && pre == 'Personal Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Services' && pre == 'SME Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	
	if (tmppath == 'Services' && pre == 'Personal Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Loans' && pre == 'Personal Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	
	if (tmppath == 'Savings Account') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Cards') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'FAQs') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Electronic Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Credit Facilities') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Excel and Priority Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Accounts and Deposits') {
		sa.push(Array(tmppath,"/om/personal-banking/accounts-deposits/savings-account/"));
		continue;
	}
	if (tmppath == 'Credit Cards') {
		sa.push(Array(tmppath,"/om/personal-banking/credit-cards/visa-gold-credit-card/"));
		continue;
	}
	if (tmppath == 'Business Current Accounts') {
		sa.push(Array(tmppath,"/om/sme-banking/business-current-accounts/business-plus-account/"));
		continue;
	}
	if (tmppath == 'Wealth Management') {
		sa.push(Array(tmppath,"/om/personal-banking/wealth-management/bancassurance/"));
		continue;
	}
	if (tmppath == 'Channels') {
		sa.push(Array(tmppath,"/om/personal-banking/channels/branches/"));
		continue;
	}
	if (tmppath == 'Media Centre') {
		sa.push(Array(tmppath,"/om/media-centre/media-contacts/"));
		continue;
	}
	
	// END special treat
	/////////////////////////////////////////////////////////////////
	var pre = tmppath;
	var tmplink = 'http://';
	for (m=0; m<=k; m++) {
		if (al[m] == 'personal-banking') {
			if (defuse) {
				tmplink += al[m];
				tmplink += '/';
			} else {
				defuse = true;
			}
		} else {
			tmplink += al[m];
			tmplink += '/';
		}
	}
	//document.write('<strong>ID '+k+': </strong> '+tmppath+' : '+tmplink+'<br />');
	sa.push(Array(tmppath,tmplink));
}
//document.write('</p>');

var counted = false;

/* Special case(s) */
// Repeat the statement block for each case(s)
for (n=1; n<ta-1; n++) {
	var chkstr = sa[n-1][0];
	var chklink = sa[n-1][1];
	// Insert specific condition(s) here
	if (chkstr == 'Personal Loans' && chklink.indexOf('/personal-loans/personal-loans/')) {
		if (counted) {
			sa.splice(n-1,1);
		} else {
			counted = true;
		}
	}
}

/* Trace updated array */
/*document.write('<p>');
for (s=0; s<sa.length; s++) {
	document.write('<strong>'+sa[s][0]+'</strong> : '+sa[s][1]+'<br />');
}
document.write('</p>');
*/

document.write('<ul>');

/* Output */
var pageTitle = '';
for (r=0; r<sa.length; r++) {
	if (r != 0) {
		pageTitle += sa[r][0] + " - ";
	}
	
	if (r == sa.length-1) {
		document.write('<li><span>'+sa[r][0]+'</span></li>');
	} else {
		if (r==0) {
			if (document.URL.indexOf('/om/sme-banking/business-current-accounts/business-priority-account') != -1) {
				document.write('<li id="firstlink"><a href="'+sa[r][1]+lang+'/"><img src="/om/sme-banking/business-current-accounts/business-priority-account/_images/stan_logo_breadcrumb.gif" alt="'+sa[r][0]+'" /></a></li>');	
			}
			else {
				if (document.URL.indexOf('/om/priority-banking') != -1) {
					document.write('<li id="firstlink"><a href="'+sa[r][1]+lang+'/"><img src="/om/priority-banking/_images/stan_logo_breadcrumb.gif" alt="'+sa[r][0]+'" /></a></li>');	
				}
				else{
					document.write('<li id="firstlink"><a href="'+sa[r][1]+lang+'/"><img src="/om/_images/stan_logo_breadcrumb.gif" alt="'+sa[r][0]+'" /></a></li>');	
				}
			}
		} else {
		document.write('<li><a href="'+sa[r][1]+lang+'/">'+sa[r][0]+'</a></li>');
		}
	}
}
document.write('</ul>');

//pageTitle += "Standard Chartered Bank Oman";
//document.title = pageTitle;
//document.write('<p>The <strong>Home</strong> will be replaced by the domain name.</p>');

