/* [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','1301',jdecode('Home'),jdecode(''),'/1301.html','true',[],'',''],
	['PAGE','1394',jdecode('About+us'),jdecode(''),'/1394.html','true',[],'',''],
	['PAGE','3301',jdecode('Services'),jdecode(''),'/3301/index.html','true',[ 
		['PAGE','13101',jdecode('How+to+calculate+cubic+feet'),jdecode(''),'/3301/13101.html','true',[],'','']
	],'',''],
	['PAGE','1373',jdecode('Quote'),jdecode(''),'/1373.html','true',[],'',''],
	['PAGE','3343',jdecode('Testimonials'),jdecode(''),'/3343.html','true',[],'',''],
	['PAGE','17401',jdecode('Tips'),jdecode(''),'/17401.html','true',[],'',''],
	['PAGE','3364',jdecode('Contact'),jdecode(''),'/3364.html','true',[],'',''],
	['PAGE','11401',jdecode('Links'),jdecode(''),'/11401.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Delphi';
theSitetree.paletteFamily='2B3559';
theSitetree.keyvisualId='7579';
theSitetree.keyvisualName='kv_7579.jpg';
theSitetree.fontsetId='16657';
theSitetree.graphicsetId='12222';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='818181';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Delphi',
				paletteFamily: 	'2B3559',
				keyvisualId: 	'7579',
				keyvisualName: 	'kv_7579.jpg',
				fontsetId: 		'16657',
				graphicsetId: 	'12222',
				contentColor: 	'000000',
				contentBGColor: '818181',
				a_color: 		'424242',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1301',
internalId:  '',
customField: '20100811-102418'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3301',
internalId:  '',
customField: '20100216-104450'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1373',
internalId:  '',
customField: '20090912-005736'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1394',
internalId:  '',
customField: '20100811-103727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3364',
internalId:  '',
customField: '20100607-114651'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3343',
internalId:  '',
customField: '20090809-210024'
};
webappMappings['7008']=webappMappings['7008-19553']={
webappId:    '7008',
documentId:  '1373',
internalId:  '19553',
customField: 'language:en;country:US;'
};
webappMappings['1002']=webappMappings['1002-3343aendu0in3hku']={
webappId:    '1002',
documentId:  '3343',
internalId:  '3343aendu0in3hku',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11401',
internalId:  '',
customField: '20100216-105040'
};
webappMappings['1501']=webappMappings['1501-21159813']={
webappId:    '1501',
documentId:  '1301',
internalId:  '21159813',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1301',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13101',
internalId:  '',
customField: '20090912-005214'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17401',
internalId:  '',
customField: '20100216-102805'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN3HKU';
var companyName   = 'Tara+Shipping+-++Overseas+Container+Services';
var htmlTitle	  = 'Tara+Shipping+Overseas+Shipping+Services';
var metaKeywords  = 'international%2C+overseas%2C+worldwide%2C+shipping%2C+container%2C+automibles%2C+cars%2C+boats%2C+recreational+vehicles%2C+motorhomes%2C+motorcyles%2C+USA%2C+Canada%2C+UK%2C+Ireland%2C+Spain%2C+Germany%2C+Europe%2C+Australia%2C+Asia%2C+Japan%2C+Hong+Kong%2C+China%2C+South+America%2C+Brazil%2C+Puerto+Rico';
var metaContents  = 'Tara+Shipping+International++Overseas+Container+Shipping+Service';
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();
};
