// 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','iBanking'));
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('deposit-interest-rates','Deposit Interest Rates '));
words.push(Array('whats-new','What‘s new '));
words.push(Array('atms-and-branches','ATMs and Branches'));

words.push(Array('press-releases','Press Releases'));
words.push(Array('latest-news','Latest News'));
words.push(Array('02-09-promotes-ict','Feb, 10 2009'));
words.push(Array('01-09-deepens-bancassurance-proposition','Jan, 30 2009'));
words.push(Array('01-09-celebrates-chinese-year','Jan, 26 2009'));

words.push(Array('01-09-bring-benefit-shool-kids','First, Jan, 15 2009'));
words.push(Array('01-09-kasseh-primary-school','Second, Jan, 15 2009'));
words.push(Array('01-09-korpehem-da-primary-school','Third, Jan, 15 2009'));
words.push(Array('01-09-pick-first-draw-winner','Jan, 23 2009'));

words.push(Array('01-09-hemen-shah-assumes-office','Jan, 02 2009'));
words.push(Array('01-09-kweku-bedu-addo-appointed','Jan, 2009'));
words.push(Array('01-08-sme-customers-market-ghana','Jan, 2008'));

words.push(Array('04-09-scb-management-trainee','April 12, 2009'));
words.push(Array('04-09-scb-and-ifc-enter-agreement','April 07, 2009'));
words.push(Array('03-09-gulf-air-sign-up','March 31, 2009'));
words.push(Array('05-09-scb-alba','May 07, 2009'));

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 Instalment Loans & Personal Overdraft'));
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('mortgage-loan','Mortgage Loan'));
words.push(Array('key-people','Key People'));
words.push(Array('online-banking','Online Banking'));
words.push(Array('demo','Demo'));
words.push(Array('managing-your-needs','Managing Your Needs'));
words.push(Array('savings-accounts','Savings Accounts'));
words.push(Array('instant-access','Instant Access'));
words.push(Array('safari-savings','Safari Savings'));
words.push(Array('safari-jnr','Safari Jnr'));
words.push(Array('diva-chamma','Diva Chamma'));
words.push(Array('current-accounts','Current Accounts'));
words.push(Array('all-in-one','All In One'));
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','Excel Banking'));
words.push(Array('priority-banking','Priority Banking'));
words.push(Array('international-banking','International Banking'));
words.push(Array('wholesale-banking','Wholesale Banking'));
words.push(Array('business-banking-solution','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('safari-savings-foreign-currency','Safari Savings Foreign Currency'));
words.push(Array('cards','Cards'));
words.push(Array('atm-locations','ATM Locations'));
words.push(Array('utility-payment-service','Utility Payment Service'));
words.push(Array('mobile-top-up-service','Mobile Top Up Service'));
words.push(Array('credit-facilities','Credit Facilities'));
words.push(Array('saving-accounts','Saving Accounts'));
words.push(Array('fixed-deposit','Fixed Deposit'));
words.push(Array('sweeping-arrangements','Sweeping Arrangements'));
words.push(Array('payments-services','Payments Services'));
words.push(Array('ordinary','Ordinary'));
words.push(Array('diva','Diva'));
words.push(Array('hifadhi-account','Hifadhi Account'));
words.push(Array('x-account','X Account'));

words.push(Array('faqs','FAQs'));
words.push(Array('general-services','General Services'));
words.push(Array('unsecured-loans','Unsecured Loans'));
words.push(Array('account-opening','Account Opening'));
words.push(Array('call-centre','Call Centre'));
words.push(Array('mortgage','Mortgage'));
words.push(Array('foreign-currency-debit-card','Foreign Currency Debit Card'));
words.push(Array('diva-chamma','Diva Chamma'));
words.push(Array('cards-and-atms','Cards & ATMs'));
words.push(Array('branches','Branches'));
words.push(Array('atms','ATMs'));
words.push(Array('investment-sevices','Investment Services'));
words.push(Array('foreign-exchange','Foreign Exchange'));

words.push(Array('wealth-management','Wealth Management'));
words.push(Array('investment-services','Investment Services'));
words.push(Array('business-current-account','Business Current Account'));
words.push(Array('international-trade-account','International Trade Account'));
words.push(Array('safari-business-savings-account','Safari Savings Business Account'));
words.push(Array('term-deposits','Term Deposit'));
words.push(Array('straight2bank','Straight2Bank'));
words.push(Array('eneza-biashara-product-suite','Eneza Biashara Product Suite'));
words.push(Array('express-credit','Express Credit'));
words.push(Array('business-credit','Business Credit'));
words.push(Array('express-trade','Express Trade'));
words.push(Array('trade-and-working-capital','Trade and Working Capital'));
words.push(Array('mortgages','Mortgages'));
words.push(Array('mobile-banking-services','Call Centre Services'));
words.push(Array('payment-solutions','Payment Solutions'));
words.push(Array('e-statements','e-Statements'));
words.push(Array('electronic-banking','Electronic Banking'));
words.push(Array('m-banking','mBanking'));
words.push(Array('mortgage-centre','Mortgage-centre'));
words.push(Array('mortgage-costs','Mortgage Costs '));
words.push(Array('bank-approved-areas','Bank Approved Areas'));
words.push(Array('interest-rates','Interest Rates'));
words.push(Array('customer-requirements','Customer Requirements'));
words.push(Array('qualifying-criteria','Qualifying Criteria'));
words.push(Array('product-features','Product Features'));
words.push(Array('products','Products'));
words.push(Array('product-features','Product Features'));
words.push(Array('customer-requirements','Customer Requirements'));
words.push(Array('interest-rates','Interest Rates'));
words.push(Array('bank-approved-areas','Bank Approved Areas'));
words.push(Array('mortgage-costs','Mortgage Costs'));
words.push(Array('mortgage-centre','Mortgage Centre'));
words.push(Array('smart-account','SmartAccount'));
words.push(Array('foreign-currency-current','Foreign Currency Current Account'));
words.push(Array('brunei-dollar','Bahrain Dollar Fixed Deposit'));
words.push(Array('foreign-currency-fixed','Foreign Currency Fixed Deposit'));
words.push(Array('passbook','Passbook'));
words.push(Array('ez-savings','ezSavings'));
words.push(Array('student-ez-savings','Student ezSavings'));
words.push(Array('dream-account','Dream Account'));
words.push(Array('unfixed-deposit','Unfixed Deposit'));
words.push(Array('foreign-currency-savings','Foreign Currency Savings Account'));
words.push(Array('personal-banking-plans','Personal Banking Plans'));
words.push(Array('smart-plan-executive','Smart Executive Plan'));
words.push(Array('exclusive-employee-privilege-scheme','Exclusive Employee Privilege Scheme'));
words.push(Array('fixed-deposits','Fixed Deposits'));
words.push(Array('investments','Investments'));
words.push(Array('unit-trusts','Units Trusts'));
words.push(Array('premium-currency','Premium Currency Investments'));
words.push(Array('structured-deposits','Structured Deposits'));
words.push(Array('home-loan','Home Loan'));
words.push(Array('insurance','Insurance'));
words.push(Array('protection','Protection'));
words.push(Array('education','Education'));
words.push(Array('phone-banking','Phone Banking'));
words.push(Array('sms-banking','SMS Banking'));
words.push(Array('safe-deposit-lockers','Safe Deposit Lockers'));
words.push(Array('remittance','Remittance'));
words.push(Array('standing-instruction','Standing Instruction'));
words.push(Array('trade-services','Treasury Services'));
words.push(Array('trade-working-capital','Trade and Working Capital Capilities'));
words.push(Array('cash-and-forex','Cash & Forex'));
words.push(Array('mortgages-and-loan','Mortgages & Loan'));
words.push(Array('business-instalment-loan','Business Instalment Loan'));
words.push(Array('property-financing','Property Financing'));
words.push(Array('automated-paypus-service','Automated Payplus Service'));
words.push(Array('sustainability','Sustainability'));
words.push(Array('living-with-HIVAIDS','Living With HIVAIDS'));
words.push(Array('seeing-is-believing','Seeing Is Believing'));
words.push(Array('environment','Environment'));
words.push(Array('local-community-initiatives','Local Community Initiatives'));
words.push(Array('cash-card','Cash Card'));
words.push(Array('credit-cards','Credit Cards'));
words.push(Array('credit-card-promotions','Credit Card Promotions'));
words.push(Array('visa-platinum','Visa Platinum'));
words.push(Array('gold-card','Gold Card'));
words.push(Array('business-card','Business Cards'));
words.push(Array('easy-pay','0% EasyPay'));
words.push(Array('discounts-and-benefits','Discount And Benefits'));
words.push(Array('believe-rewards','Believe Rewards'));
words.push(Array('priority-banking-centres','Priority Banking Centres'));
words.push(Array('lifestyle-privileges','Lifestyle Privileges'));
words.push(Array('banking-privileges','Banking Privileges'));
words.push(Array('flexilife','Flexilife'));
words.push(Array('premier-health-plan','Premier Health Plan'));
words.push(Array('medu-care','MeduCare'));
words.push(Array('endowment-5','Endowment 5'));
words.push(Array('endowment-classic','Endowment Classic'));
words.push(Array('overdraft','Overdraft'));
words.push(Array('our-history','Our History'));
words.push(Array('personal-loan','Personal Loan'));
words.push(Array('auto-loan','Auto Loan'));
words.push(Array('mortgages','Mortgage Loan'));
words.push(Array('card','Credit Card'));
words.push(Array('loans-and-mortgages','Loan and Mortgages'));
words.push(Array('loan','Loan'));
words.push(Array('islamic-banking','Islamic Banking'));
words.push(Array('accounts-and-deposits','Accounts And Deposits'));
words.push(Array('savings-account','Savings Account'));
words.push(Array('current-account','Current 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('payroll-booster','Payroll Booster'));
words.push(Array('ultra-pack','Ultra Pack'));
words.push(Array('master-titanium','MasterCard Titanium Credit Card'));
words.push(Array('master-visa-gold','MasterCard Gold / Visa Gold Credit Card'));
words.push(Array('master-visa-executive','MasterCard Executive / Visa Executive Credit Card'));
words.push(Array('master-standard-visa-lassic','MasterCard Standard / Visa Classic Credit Card'));
words.push(Array('bancassurance','Bancassurance'));
words.push(Array('future-gold','Future Gold'));
words.push(Array('futura','Futura'));
words.push(Array('harvester','Harvester'));
words.push(Array('sunlife','Sunlife'));
words.push(Array('dws','DWS'));
words.push(Array('channels','Channels'));
words.push(Array('atm','ATMs'));
words.push(Array('email','E-mail'));
words.push(Array('account-services','Saadiq Account Services'));
words.push(Array('auto-finance','Saadiq Auto Finance'));
words.push(Array('personal-finance','Saadiq Personal Finance'));
words.push(Array('mortgage-finance','Saadiq Mortgage Finance'));
words.push(Array('business-account','Business Account'));
words.push(Array('savings-plan','Savings Plan'));
words.push(Array('child-education','Child Education'));
words.push(Array('retirement-solution','Retirement Solution'));
words.push(Array('takaful-products-solution','Takaful Products Solution'));
words.push(Array('bonds','Bonds'));
words.push(Array('mutual-funds','Mutual Funds'));
words.push(Array('fx-investments','FX Investments'));
words.push(Array('high-yield-deposits','High Yield Deposits'));
words.push(Array('commodity-investments','Commodity Investments'));
words.push(Array('business-current-accounts','Business Current Accounts'));
words.push(Array('business-plus','Business Plus  Account'));
words.push(Array('business-premium','Business Premium  Account'));
words.push(Array('business-priority','Business Priority  Account'));
words.push(Array('financing','Financing'));
words.push(Array('express-trade-services','Express Trade Services'));
words.push(Array('08-09-interim-results-final','August 06, 2008'));
words.push(Array('03-09-saadiq-launch-final','March 02, 2009'));
words.push(Array('02-09-priority-banking-press-release-final','February 01, 2009'));
words.push(Array('11-08-contributes-in-ramadan','September 17, 2008'));
words.push(Array('06-08-appointment-jonathan-morrisrFinal','June 30, 2008'));
words.push(Array('06-08-nri-press-release-final14jul2008','July 14, 2008'));
words.push(Array('04-08-bahrain-financial-results-2007','December 31, 2007'));
words.push(Array('03-08-guide-book-bahrain-launch-press-release-v1','March 06, 2008'));
words.push(Array('07-07-dream-account-lexus-draw-final','July 20, 2008'));
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('03-09-income-accelerates','March 22, 2009'));
words.push(Array('master-standard-visa-classic','Master Standard Visa Classic'));
words.push(Array('helpdesk','Helpdesk'));
words.push(Array('individual-establishment','Individual Establishment Accounts'));
words.push(Array('consumer-loans','Consumer Loans'));
words.push(Array('other-contact-channels','Other Contact Channels'));
words.push(Array('apllication-forms','Apllication Forms'));
words.push(Array('your-cards-upgraded','Your Cards are being upgraded'));
words.push(Array('form-center','Form Centre - Download Forms'));
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 == 'Consumer Loans' && pre == 'Personal Banking') {
		sa.push(Array(tmppath,"/bh/personal-banking/consumer-loans/personal-loan/"));
		continue;
	}
	
	if (tmppath == 'Savings Accounts') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	
	if (tmppath == 'Other Contact Channels') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Cards') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'FAQs') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	if (tmppath == 'Wealth Management') {
		sa.push(Array(tmppath,"/bh/personal-banking/wealth-management/bancassurance/"));
		continue;
	}
	if (tmppath == 'Electronic Banking') {
		sa.push(Array(tmppath,"#"));
		continue;
	}
	
	if (tmppath == 'Channels') {
		sa.push(Array(tmppath,"/bh/personal-banking/channels/branches/"));
		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,"#"));
		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('/wealth-management/priority-banking') != -1) {
				document.write('<li id="firstlink"><a href="'+sa[r][1]+lang+'/"><img src="/bh/personal-banking/wealth-management/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="/bh/_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 Bahrain";
//document.title = pageTitle;
//document.write('<p>The <strong>Home</strong> will be replaced by the domain name.</p>');
