/* [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','8301',jdecode('Home'),jdecode(''), jdecode('%2F8301.html'), 'true',[],'',''],
	['PAGE','8352',jdecode('About+us'),jdecode(''), jdecode('%2F8352.html'), 'true',[],'',''],
	['PAGE','14701',jdecode('Janitorial'),jdecode(''), jdecode('%2F14701.html'), 'true',[],'',''],
	['PAGE','14722',jdecode('Maids+service'),jdecode(''), jdecode('%2F14722.html'), 'true',[],'',''],
	['PAGE','8436',jdecode('Site+management'),jdecode(''), jdecode('%2F8436.html'), 'true',[],'',''],
	['PAGE','8701',jdecode('Construction+Cleaning'),jdecode(''), jdecode('%2F8701.html'), 'true',[],'',''],
	['PAGE','17501',jdecode('Move-out+cleaning'),jdecode(''), jdecode('%2F17501.html'), 'true',[],'',''],
	['PAGE','8478',jdecode('Quote+request+form'),jdecode(''), jdecode('%2F8478.html'), 'true',[],'',''],
	['PAGE','8520',jdecode('Guest+book'),jdecode(''), jdecode('%2F8520.html'), 'true',[],'',''],
	['PAGE','8457',jdecode('Contact+us'),jdecode(''), jdecode('%2F8457.html'), 'true',[],'',''],
	['PAGE','17901',jdecode('Move-out+check+list'),jdecode(''), jdecode('%2F17901.html'), 'false',[],'',''],
	['PAGE','20401',jdecode('Blog'),jdecode(''), jdecode('%2F20401.html'), 'true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Nebula';
theSitetree.paletteFamily='78419F';
theSitetree.keyvisualId='8791';
theSitetree.keyvisualName='kv_8791.jpg';
theSitetree.fontsetId='17095';
theSitetree.graphicsetId='12477';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='A978CC';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'wl_enom',
  product: 'WSCENOSSSLYTC21T'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Nebula',
				paletteFamily: 	'78419F',
				keyvisualId: 	'8791',
				keyvisualName: 	'kv_8791.jpg',
				fontsetId: 		'17095',
				graphicsetId: 	'12477',
				contentColor: 	'000000',
				contentBGColor: 'A978CC',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-5026']={
webappId:    '7008',
documentId:  '8478',
internalId:  '5026',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14701',
internalId:  '',
customField: '20120102-030235'
};
webappMappings['1002']=webappMappings['1002-8520aen340inp8lc']={
webappId:    '1002',
documentId:  '8520',
internalId:  '8520aen340inp8lc',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8301',
internalId:  '',
customField: '20120102-134005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14722',
internalId:  '',
customField: '20120102-134314'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8457',
internalId:  '',
customField: '20120102-134623'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8478',
internalId:  '',
customField: '20120102-024719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8352',
internalId:  '',
customField: '20120102-134027'
};
webappMappings['8010']=webappMappings['8010-574']={
webappId:    '8010',
documentId:  '20401',
internalId:  '574',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8520',
internalId:  '',
customField: '20120102-024110'
};
webappMappings['1501']=webappMappings['1501-29176023']={
webappId:    '1501',
documentId:  '8301',
internalId:  '29176023',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8436',
internalId:  '',
customField: '20120102-134415'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17501',
internalId:  '',
customField: '20120102-134513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17901',
internalId:  '',
customField: '20120102-022858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8701',
internalId:  '',
customField: '20120102-135645'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20401',
internalId:  '',
customField: '20120102-133934'
};
var webAppHostname = 'wsc.ehost-services.com:80';
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN340INP8LC';
var companyName   = 'Coriana+Cleaning+and+Building+maintenance+LLC+++++++++++++++++++++808-222-4773+';
var htmlTitle	  = 'Coriana+Cleaning+%26+Building+Maintenance+LLC';
var metaKeywords  = 'Cleaning%2Cjanitorial%2Ccarpet%2Cbuilding+maintenance%2Cmaid+service%2Chouse+cleaning%2Cbuilding+cleaning%2Coffice+cleaning%2Crentals+cleaning%2Cfloor+cleaning%2Cconstruction+cleaning%2Cwindows+cleaning%2Cproperty+management%2Capartment+for+rent%2CSite+Management';
var metaContents  = 'All+type+of+janitorial+and+cleaning%2C+commercial+cleaning+and+residential+cleaning';
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();
};

