// 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('contact-centre','Contact Centre'));
words.push(Array('i-banking','Online Banking'));
words.push(Array('mobile-banking','Mobile Banking'));
words.push(Array('estatement','eStatement'));
words.push(Array('contact-the-bank','Contact the Bank'));
words.push(Array('telegraphic-transfer','Telegraphic Transfers')); 

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('deposit-interest-rates','Deposit Interest Rates '));
words.push(Array('whats-new','What\'s new '));
words.push(Array('atms-and-branchs','ATMs and Branches'));

words.push(Array('press-releases','Latest News'));
words.push(Array('latest-news','Latest News'));
words.push(Array('09-08-launches-africa-sme-month','Sep 01, 2008'));
words.push(Array('09-08-organizes-international-taxation-training','Sep 18, 2008'));
words.push(Array('09-08-promotes-foreign-trade','Lagos, Sep 18, 2008'));
words.push(Array('11-08-seeing-is-believing','Nov 03, 2008'));
words.push(Array('12-08-expands-branch-network','Dec 05, 2008'));

words.push(Array('demo-online-banking','Online Banking'));
words.push(Array('account','Account'));
words.push(Array('authorize-transaction','Authorize transaction'));
words.push(Array('existing-customer-account','Existing customer account'));
words.push(Array('forgot-password','Forgot password'));
words.push(Array('fund-transfer','Fund transfer'));
words.push(Array('instant-registration','Instant registration'));
words.push(Array('mail-box','Mail box'));
words.push(Array('market-watch','Market watch'));
words.push(Array('personal-home','Personal home'));
words.push(Array('personal-update','Personal update'));
words.push(Array('standing-order','Standing order'));

words.push(Array('search','Search result'));
words.push(Array('application-forms','Application Forms'));
words.push(Array('personal-loan','Personal Unsecured Loan'));
words.push(Array('phone-banking-services','Phone Banking Services'));
words.push(Array('sme-banking-centers','SME Banking Centre'));

words.push(Array('credit-card','Credit Card'));
words.push(Array('mortgages','Mortgages'));
words.push(Array('key-people','Key People'));
words.push(Array('online-banking','Online Banking'));
words.push(Array('demo','Demo'));
words.push(Array('savings-accounts','Savings Account'));
words.push(Array('instant-access','Instant Access'));
words.push(Array('current-accounts','Current Account'));
words.push(Array('all-in-one','All In One'));
words.push(Array('fixed-deposit','Fixed/Term Deposit'));
words.push(Array('debit-card','Debit Card'));
words.push(Array('foreign-currency-debit-card','Foreign Currency Debit Card'));
words.push(Array('excel-and-priority-banking','Excel and Priority Banking'));
words.push(Array('excel-banking-centres','Excel Banking Centres'));
words.push(Array('priority-banking','Priority Banking'));
words.push(Array('international-banking','International Banking'));
words.push(Array('commercial-banking','Commercial Banking'));
words.push(Array('business-banking-solutions','Business Banking Solutions'));
words.push(Array('overview','Overview'));
words.push(Array('feature','Feature'));
words.push(Array('contact-details','Contact Details'));
words.push(Array('banking-hours','Banking Hours'));
words.push(Array('unsecured','Unsecured'));
words.push(Array('auto-loans','Auto-Loans'));
words.push(Array('accounts-services','Accounts-Services'));
words.push(Array('sme-current-account','SME-Current-Account'));
words.push(Array('investment-management','Investment-Management'));
words.push(Array('savings-plus','Saving Plus'));
words.push(Array('my-dream-account','My Dream Account'));
words.push(Array('premium-savings','Premium Savings'));
words.push(Array('money-builder','Money Builder'));
words.push(Array('higher-education-fund','Higher Education Fund'));
words.push(Array('diva-club','Diva Club'));
words.push(Array('young-executive-club','Young Executive Club'));
words.push(Array('fixed-deposit-accounts','Fixed Deposit Accounts'));
words.push(Array('foreign-exchange-accounts','Foreign Exchange Accounts'));
words.push(Array('investment-services','Investment Services'));
words.push(Array('branches','Branches'));
words.push(Array('atms','ATM Locations'));
words.push(Array('branches-contact','Branches Locations'));
words.push(Array('phone-banking','Phone Banking'));
words.push(Array('mbanking','mBanking'));
words.push(Array('internet-banking','Internet Banking'));
words.push(Array('call-centre','Call Centre'));
words.push(Array('business-savings','Business Savings Account'));
words.push(Array('business-current','Business Current Account'));
words.push(Array('business-premium-current','Business Premium Current Account'));
words.push(Array('gold-crest','Gold Crest Account'));
words.push(Array('international-trade','International Trade Account'));
words.push(Array('stanfex','Stanfex Account'));
words.push(Array('visa-business-electron','Visa Business Electron Cards'));
words.push(Array('trade-and-working','Trade & Working Capital'));
words.push(Array('express-trade','Express Tade'));
words.push(Array('credit-facilities','Credit Facilities'));
words.push(Array('cards','Cards'));
words.push(Array('other-services','Other Services'));
words.push(Array('telegraphic-transfers','Telegraphic Transfer'));
words.push(Array('straight2bank','Straight2Bank'));
words.push(Array('vpay','Vpay Debit Card'));
words.push(Array('visa-electron','Visa Electron Debit Card'));
words.push(Array('visa-platinum','Visa Platinum Card'));
words.push(Array('smartcredit','SmartCredit'));
words.push(Array('insurance','Insurance'));
words.push(Array('personal-accident','Personal Accident Bancassurance'));
words.push(Array('home','Home Bancassurance'));
words.push(Array('savelife','Savelife Bancassurance'));
words.push(Array('motor','Motor Bancassurance'));
words.push(Array('Marine','Marine Bancassurance'));
words.push(Array('exclusive-banking','Exclusive Banking'));
words.push(Array('bancassurance','Bancassurance'));
words.push(Array('atms-and-branches','ATMs and Branches'));
words.push(Array('marine-bancassurance','Marine Bancassurance'));
words.push(Array('business-term','Business Term Account'));
words.push(Array('great-giveaway-promo','Great Giveaway Promo'));
words.push(Array('eSaver-account','eSaver Account'));

//added by Derrick Yeboah 1222329

words.push(Array('investment-services','Investment Services'));
words.push(Array('unit-trusts','Unit Trusts'));
words.push(Array('smart-savings-plan','Smart Savings Plan'));
words.push(Array('fixed-income-securities','Fixed Income Securities'));
words.push(Array('sun-secured-advantage','Sun Secured Advantage'));
words.push(Array('group-life','Group Life Insuarance Scheme'));
words.push(Array('visa-platinum-cc','Visa Platinum Credit Card'));
words.push(Array('visa-gold-cc','Visa Gold Credit Card'));
words.push(Array('credit-cards','Credit Cards'));
words.push(Array('visa-gold','Visa Gold Debit Card'));
words.push(Array('naira-visa-card','Naira Visa Debit Card'));
words.push(Array('family-comfort','Family Comfort Plan'));
words.push(Array('employee-banking','Employee Banking'));






///////////////////////////////////////////////////////////////////////////////////////////

/* 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;
	}
	if (tmppath == 'Deposits' && pre == 'SME Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Services' && pre == 'SME Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Cards') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Credit Facilities') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Other Services') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Deposits') {
		sa.push(Array(tmppath,"../../eSaver-account/"));
		continue;
	}
	if (tmppath == 'Loans') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Investment Services') {
		sa.push(Array(tmppath,"#"));
		continue;//added by Derrick 1222329
	}
	if (tmppath == 'Exclusive Banking' && pre == 'Investment Services') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	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('/exclusive-banking/priority-banking') != -1) {
				document.write('<li id="firstlink"><a href="'+sa[r][1]+lang+'/"><img src="/ng/personal-banking/exclusive-banking/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="/ng/_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 Kenya";
//document.title = pageTitle;
//document.write('<p>The <strong>Home</strong> will be replaced by the domain name.</p>');
