/* [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','9701',jdecode('Home'),jdecode(''), jdecode('%2F9701.html'), 'true',[],'',''],
	['PAGE','30312',jdecode('About+us'),jdecode(''), jdecode('%2F30312.html'), 'true',[],'',''],
	['PAGE','30375',jdecode('Auto+Glass'),jdecode(''), jdecode('%2F30375.html'), 'true',[],'',''],
	['PAGE','30396',jdecode('Flat+Glass+%26+Mirror'),jdecode(''), jdecode('%2F30396.html'), 'true',[],'',''],
	['PAGE','37412',jdecode('Glass+Table+Tops'),jdecode(''), jdecode('%2F37412.html'), 'true',[],'',''],
	['PAGE','38712',jdecode('Textured+Glass'),jdecode(''), jdecode('%2F38712.html'), 'true',[],'',''],
	['PAGE','30812',jdecode('Commercial+Services'),jdecode(''), jdecode('%2F30812.html'), 'true',[],'',''],
	['PAGE','32412',jdecode('Satisfied+Customers'),jdecode(''), jdecode('%2F32412.html'), 'true',[],'',''],
	['PAGE','16701',jdecode('Products+and+Services'),jdecode(''), jdecode('%2F16701.html'), 'true',[],'',''],
	['PAGE','14201',jdecode('Hours+and+Directions'),jdecode(''), jdecode('%2F14201.html'), 'true',[],'',''],
	['PAGE','35712',jdecode('Contact'),jdecode(''), jdecode('%2F35712.html'), 'true',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Commander';
theSitetree.paletteFamily='2B25A2';
theSitetree.keyvisualId='2376';
theSitetree.keyvisualName='autos.jpg';
theSitetree.fontsetId='391';
theSitetree.graphicsetId='439';
theSitetree.contentColor='2B25A2';
theSitetree.contentBGColor='E0E0E0';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'comcast',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Commander',
				paletteFamily: 	'2B25A2',
				keyvisualId: 	'2376',
				keyvisualName: 	'autos.jpg',
				fontsetId: 		'391',
				graphicsetId: 	'439',
				contentColor: 	'2B25A2',
				contentBGColor: 'E0E0E0',
				a_color: 		'E0E0E0',
				b_color: 		'5762CA',
				c_color: 		'A1A4D2',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9701',
internalId:  '',
customField: '20110428-101554'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14201',
internalId:  '',
customField: '20100104-105748'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16701',
internalId:  '',
customField: '20110216-132007'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '9701',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30375',
internalId:  '',
customField: '20120213-090205'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30312',
internalId:  '',
customField: '20110217-130750'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30812',
internalId:  '',
customField: '20110216-131054'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '30396',
internalId:  '',
customField: '20110428-102218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '35712',
internalId:  '',
customField: '20120213-090340'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32412',
internalId:  '',
customField: '20110217-134928'
};
webappMappings['1501']=webappMappings['1501-9046391']={
webappId:    '1501',
documentId:  '9701',
internalId:  '9046391',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37412',
internalId:  '',
customField: '20110629-121325'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38712',
internalId:  '',
customField: '20110629-124954'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INLYV6';
var companyName   = 'American+Plate+%26+Auto+Glass+Co.%2C+Inc.';
var htmlTitle	  = 'American+Plate+%26+Auto+Glass+Co.+';
var metaKeywords  = 'Windshield%2C+Backglass%2C+Doorglass%2C+Quarterglass%2C+Sunroof+Glass%2C+Side+View+Mirrors%2C+Storefronts%2C+Aluminum+Doors%2C+Door+Closers%2C+Door+Pivots%2C+Flush+Bolts%2C+Panic+Bars%2C+Flat+glass%2C+Plate+glass%2C+Window+glass%2C+Picture+frame+glass%2C+Plexiglas%2C+Acyrlic%2C+Polycarboate%2C+Lexan%2C+Mirror%2C+Beveled+Mirror%2C+Glass+tops%2C+Beveled+Glass%2C+Insulated+Glass%2C+Low+E+Glass%2C+Patio+Door+Glass%2C+';
var metaContents  = 'A+local+family+owners+and+operated+glass+company+wanted+to+serve+all+your+glass+needs.++Home%2C+Auto+and+Commercial+we+do+it+all.';
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();
};

