/* [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 theSitetree=[ 
	['PAGE','5701',jdecode('Home'),jdecode(''),'/5701.html','true',[],''],
	['PAGE','5752',jdecode('Our+Services'),jdecode(''),'/5752.html','true',[],''],
	['PAGE','5773',jdecode('Contact+Us'),jdecode(''),'/5773.html','true',[],''],
	['PAGE','6301',jdecode('Special+Offers%21'),jdecode(''),'/6301.html','true',[],''],
	['PAGE','9901',jdecode('Interior+photo%26%23x27%3Bs'),jdecode(''),'/9901.html','true',[],''],
	['PAGE','10201',jdecode('Exterior+photo%26%23x27%3Bs'),jdecode(''),'/10201.html','true',[],''],
	['PAGE','6501',jdecode('Online+bid+request'),jdecode(''),'/6501.html','true',[],''],
	['PAGE','5794',jdecode('Customer+feedback'),jdecode(''),'/5794.html','true',[],'']];
var siteelementCount=8;
theSitetree.topTemplateName='Orbit';
theSitetree.paletteFamily='660000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='172';
theSitetree.graphicsetId='208';
theSitetree.contentColor='DDDDDD';
theSitetree.contentBGColor='660000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Orbit',
				paletteFamily: 	'660000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'172',
				graphicsetId: 	'208',
				contentColor: 	'DDDDDD',
				contentBGColor: '660000',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'660000',
				b_color: 		'CC9999',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-5794aendu0in2193']={
webappId:    '1002',
documentId:  '5794',
internalId:  '5794aendu0in2193',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20100202-120829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5752',
internalId:  '',
customField: '20091018-214326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5773',
internalId:  '',
customField: '20091014-112015'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5794',
internalId:  '',
customField: '20091017-155901'
};
webappMappings['7008']=webappMappings['7008-22061']={
webappId:    '7008',
documentId:  '6501',
internalId:  '22061',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6301',
internalId:  '',
customField: '20100216-085118'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6501',
internalId:  '',
customField: '20091015-181812'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9901',
internalId:  '',
customField: '20091018-211136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10201',
internalId:  '',
customField: '20091018-213905'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN2193';
var companyName   = 'NeelyChris+Painting+++Kansas+City%2C+Missouri+';
var htmlTitle	  = 'NeelyChris+Painting-++interior+and+exterior+painting+contractor+in+Kansas+City';
var metaKeywords  = 'NeelyChris+Painting%2Cinterior%2Cexterior%2CKansas+City%2Cpaint%2Cpainting%2Cstain%2Cdrywall%2Cpressure+washing%2Cwood+rot%2Cresidential%2Ccommercial%2Cdeck%2Cchrisneely+painting%2Cdetail';
var metaContents  = 'NeelyChris+Painting+provides+the+Kansas+City+metro+area+with+professional%2C+friendly+services.++Attention+to+detail+and+100%25+customer+satisfaction.++*Interior+*Exterior+*Residential+*Commercial.';
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();
};
