/* [nodename, id, name, navigationtext, href, isnavigation, childs[], templatename] */

if (typeof(decodeURIComponent) == 'undefined') {
  decodeURIComponent = function(s) {
    return unescape(s);
  }
}

function jdecode(s) {
    s = s.replace(/\+/g, "%20")
    return decodeURIComponent(s);
}

var POS_NODENAME=0;
var POS_ID=1;
var POS_NAME=2;
var POS_NAVIGATIONTEXT=3;
var POS_HREF=4;
var POS_ISNAVIGATION=5;
var POS_CHILDS=6;
var POS_TEMPLATENAME=7;
var POS_TARGET=8;
var theSitetree=[ 
	['PAGE','5801',jdecode('Home'),jdecode(''),'/5801.html','true',[],'',''],
	['PAGE','14801',jdecode('NatWealth+Corporation'),jdecode(''),'/14801.html','true',[],'',''],
	['PAGE','13801',jdecode('NatWealth+Securities'),jdecode(''),'/13801.html','true',[],'',''],
	['PAGE','15701',jdecode('Sri+Lankan+Diaspora'),jdecode(''),'/15701.html','true',[],'',''],
	['PAGE','5894',jdecode('Downloads'),jdecode(''),'/5894.html','true',[],'',''],
	['PAGE','5978',jdecode('Register'),jdecode(''),'/5978.html','true',[],'',''],
	['PAGE','5999',jdecode('Contact+us'),jdecode(''),'/5999.html','true',[],'',''],
	['PAGE','39101',jdecode('Media+%26+Related+sites'),jdecode(''),'/39101.html','true',[],'',''],
	['PAGE','5852',jdecode('Board+of+Directors'),jdecode(''),'/5852.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Medium';
theSitetree.paletteFamily='01343D';
theSitetree.keyvisualId='2152';
theSitetree.keyvisualName='architektur.jpg';
theSitetree.fontsetId='355';
theSitetree.graphicsetId='409';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='01343D';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Medium',
				paletteFamily: 	'01343D',
				keyvisualId: 	'2152',
				keyvisualName: 	'architektur.jpg',
				fontsetId: 		'355',
				graphicsetId: 	'409',
				contentColor: 	'FFFFFF',
				contentBGColor: '01343D',
				a_color: 		'01343D',
				b_color: 		'8EBFC6',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5801',
internalId:  '',
customField: '20100519-063946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5852',
internalId:  '',
customField: '20091211-060814'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5978',
internalId:  '',
customField: '20090120-054516'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5801',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14801',
internalId:  '',
customField: '20081217-023854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5894',
internalId:  '',
customField: '20091211-003503'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13801',
internalId:  '',
customField: '20090327-051715'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15701',
internalId:  '',
customField: '20100723-013830'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5999',
internalId:  '',
customField: '20090526-005036'
};
webappMappings['7008']=webappMappings['7008-11471']={
webappId:    '7008',
documentId:  '5978',
internalId:  '11471',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39101',
internalId:  '',
customField: '20100519-073756'
};
webappMappings['1501']=webappMappings['1501-14173583']={
webappId:    '1501',
documentId:  '5801',
internalId:  '14173583',
customField: '1501'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INEBXF';
var companyName   = 'NATWEALTH+GROUP';
var htmlTitle	  = 'National+Wealth+Corporation';
var metaKeywords  = 'Primary+Dealers+in+Srilanka%2C+Natwealth+securities%2C+rates%2C+Treasury+bils%2C+Sri+Lankan+Diaspora%2C+Primary+Dealer%2C+Treasury+Bonds%2C+Sri+Lankan+Government+Securities%2C+Authorised+Primary+Dealer%2C+Fund+Managment%2C+Repo%2C+Repurchase+Agreement%2C+Mahapola%2C+Investments%2C+Central+Bank+in+Sri+Lanka%2C+Mahapola+Higher+Educational+Trust+Fund%2C+Banks%2C+Banks+in+Sri+Lanka%2C+Chandra+J+Dias%2CSecure+Investments%2C+Money%2C+Money+investments%2CTB+Srilanka%2C+';
var metaContents  = 'NatWealth+Securities++has+been+granted+a+license+by+the+Central+Bank+of+Sri+Lanka+in+November+2003+to+operate+as+a+Primary+Dealer+in+Government+Securities.+We+invite+all+Sri+Lankan+diaspora+and+migrant+workforce+to+open+Treasury+Bill+%2F+Bond+Investment+External+Rupee+Account+%E2%80%93+Deshabhimani+%28TIERA-D+%29+to+facilitate+your+investment+in+Government+securities.';
theSitetree.getById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		if (ar[i][POS_ID] == id){
			return ar[i];
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getParentById = function(id, ar) {
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		for (var j = 0; j < ar[i][POS_CHILDS].length; j++) {
			if (ar[i][POS_CHILDS][j][POS_ID] == id) {
				// child found
				return ar[i];
			}
			var result=this.getParentById(id, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getName = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAME];
	}
	return null;
};

theSitetree.getNavigationText = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_NAVIGATIONTEXT];
	}
	return null;
};

theSitetree.getHREF = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_HREF];
	}
	return null;
};

theSitetree.getIsNavigation = function(id) {
	var elem = this.getById(id);
	if (elem != null){
		return elem[POS_ISNAVIGATION];
	}
	return null;
};

theSitetree.getTemplateName = function(id, lastTemplateName, ar) {
	if (typeof(lastTemplateName) == 'undefined'){
		lastTemplateName = this.topTemplateName;
	}
	if (typeof(ar) == 'undefined'){
		ar = this;
	}
	for (var i=0; i < ar.length; i++) {
		var actTemplateName = ar[i][POS_TEMPLATENAME];
		if (actTemplateName == ''){
			actTemplateName = lastTemplateName;
		}
		if (ar[i][POS_ID] == id) {
			return actTemplateName;
		}
		if (ar[i][POS_CHILDS].length > 0) {
			var result=this.getTemplateName(id, actTemplateName, ar[i][POS_CHILDS]);
			if (result != null){
				return result;
			}
		}
	}
	return null;
};

theSitetree.getByXx = function(lookup, xx, ar) {
    if (typeof(ar) == 'undefined'){
    	ar = this;
    }
    for (var i=0; i < ar.length; i++) {
        if (ar[i][xx] == lookup){
        	return ar[i];
        }
        if (ar[i][POS_CHILDS].length > 0) {
        	var result=this.getByXx(lookup, xx, ar[i][POS_CHILDS]);
            if (result != null){
                return result;
               }
        }
    }
    return null;
};

function gotoPage(lookup) {
	if(__path_prefix__ == "/servlet/CMServeRES" && typeof (changePage) == 'function'){
		changePage(lookup);
		return;
	}
	var page = theSitetree.getHREF(lookup);
	if (!page) {
		var testFor = [ POS_NAME, POS_NAVIGATIONTEXT ];
		for (var i=0 ; i < testFor.length ; i++) {
			var p = theSitetree.getByXx(lookup, testFor[i]);
			if (p != null) {
				page = p[POS_HREF];
				break;
			}
		}
	}
	document.location.href = (new URL(__path_prefix__ + page, true, true)).toString();
};
