/* [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','1906',jdecode('Windshield+Repair'),jdecode(''), jdecode('%2F1906.html'), 'true',[],'',''],
	['PAGE','201',jdecode('+Rock+Chip+Repair+School'),jdecode(''), jdecode('%2F201.html'), 'true',[],'',''],
	['PAGE','1901',jdecode('Set+Appointment+Date'),jdecode(''), jdecode('%2F1901.html'), 'true',[],'',''],
	['PAGE','21001',jdecode('Headlight+Restoration+%28follow+up+page%29'),jdecode(''), jdecode('%2F21001.html'), 'false',[],'','']];
var siteelementCount=4;
theSitetree.topTemplateName='Stars';
theSitetree.paletteFamily='3C5284';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10466';
theSitetree.graphicsetId='10913';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='3C5284';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'wl_enom',
  product: 'WSCENOSSSLYTC21A'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Stars',
				paletteFamily: 	'3C5284',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10466',
				graphicsetId: 	'10913',
				contentColor: 	'FFFFFF',
				contentBGColor: '3C5284',
				a_color: 		'3C5284',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '1906',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-1058']={
webappId:    '7008',
documentId:  '1901',
internalId:  '1058',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1901',
internalId:  '',
customField: '20100316-132929'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '201',
internalId:  '',
customField: '20110307-165310'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1906',
internalId:  '',
customField: '20110307-163428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21001',
internalId:  '',
customField: '20080620-002045'
};
var webAppHostname = 'wsc.ehost-services.com:80';
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN010INXH61';
var companyName   = 'YOU+WILL+CLEARLY+SEE+THE+DIFFERENCE%21+';
var htmlTitle	  = 'WINDSHIELD+ROCK+CHIP+REPAIR';
var metaKeywords  = 'mobile%2C+windshield+repair%2C+automotive%2C+Auto+Glass+Repair%2C+Auto+Glass%2C+Windshield+Repair%2C+houston%2C+tx%2C+Sugarland%2C+TX%2C+Pearland%2C+TX%2C+Windshield%2C+Windshield+Replacement%2C+Auto+Glass+Replacement%2C+Auto+Glass+Installation%2C+Car+Window%2C+Rear+Window%2C+Safelite+Auto+Glass%2C+Car+Windshield%2C+Safelite%2C+Car+Window+Repair%2C+Car+Window+Replacement%2C+Car+Glass%2C+Replace+Windshield%2C+Auto+Windshield+Replacement%2C+Auto+Glass+Specialist%2C+Auto+Glass+Prices%2C+Windshield+Glass%2C+Safelite+Glass%2C+Truck+Window%2C+Auto+Glass+Tool%2C+Safelight+Auto+Glass%2C+Auto+Windshield%2C+Safelight%2C+Safeline+Auto+Glass%2C+Windshield+Installation%2C+Windshield+Price%2C+Auto+Glass+Quot%2C+windshield+repair+school%2C+windshield+repair+industry%2C+information%2C+windshield+repair+equipment%2C+windshield+repair+training%2C+glass+kit%2C+windscreen+repair%2C+business+opportunities%2C+home+based+business%2C+windsheild+auto+glass+service%2C+oglass%2C+repair%2C+service%2C+replacement%2C+windshields%2C+mirrors%2C+auto%2C+mobile+rock+chip+repair%2C+broken%2C+cracked%2C+chip%2C++greensboro%2C+wilmington%2C+north+carolina%2C+free%2C+business+opportunity%2C+mlm%2C+marketing%2C+work+from+home%2C+boss%2C+rock+chip+repair%2C+free+gas%2C+work+from+home%2C+mobile+service+houston%2C+tx%2C+windshield+repair+automotive%2C+rock+chip+repair+school%2C+windshield+repair+industry+information%2C+windshield+repair+equipment%2C+windshield+repair+training%2C+glass+kit%2C+windscreen+repair%2C+business+opportunities%2C+home+based+business%2C+windsheild+auto+glass%2C+houston+tx%2C+and+stafford%2C+TX%2C+fort+bend+and+harris+county%2C+tx%2C+ricky+reed%2C+ilonnye+bailey%2C+ricky%2C+ilonnye%2C+windsheild+repair+school%2C+repair+school%2C+replacement+school.';
var metaContents  = 'Mobile+windshield+chip%2C+crack+repair+and+replacement.++Specializing+in+quality+reparis+of+rock+chips%2C+star+cracks%2C+bullseyes%2Ca+nd+crack+up+to+20+inches+long.++We+can+come+to+your+home+or+job.++Ft.+Bend%2C+Harris%2C+Brazora+and+other+county%27s.';
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();
};

