/* [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','2001',jdecode('Home'),jdecode(''), jdecode('%2F2001.html'), 'true',[],'',''],
	['PAGE','2401',jdecode('About+us'),jdecode(''), jdecode('%2F2401%2Findex.html'), 'true',[ 
		['PAGE','2443',jdecode('How+to+find+us'),jdecode(''), jdecode('%2F2401%2F2443.html'), 'true',[],'','']
	],'',''],
	['PAGE','2464',jdecode('Contact'),jdecode(''), jdecode('%2F2464.html'), 'true',[],'',''],
	['PAGE','2485',jdecode('Jobs'),jdecode(''), jdecode('%2F2485.html'), 'true',[],'',''],
	['PAGE','9612',jdecode('Project+Photo+Gallery'),jdecode(''), jdecode('%2F9612%2Findex.html'), 'true',[ 
		['PAGE','17812',jdecode('Commercial+'),jdecode(''), jdecode('%2F9612%2F17812.html'), 'true',[],'',''],
		['PAGE','17833',jdecode('Specialty+Mirrors'),jdecode(''), jdecode('%2F9612%2F17833.html'), 'true',[],'',''],
		['PAGE','17854',jdecode('Showers'),jdecode(''), jdecode('%2F9612%2F17854.html'), 'true',[],'',''],
		['PAGE','17875',jdecode('Previous+Jobs'),jdecode(''), jdecode('%2F9612%2F17875.html'), 'true',[],'','']
	],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Chaste';
theSitetree.paletteFamily='A3D392';
theSitetree.keyvisualId='11551';
theSitetree.keyvisualName='kv_11551.jpg';
theSitetree.fontsetId='32877';
theSitetree.graphicsetId='13963';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp35-attweb',
  product: 'WSCSYSSSSLY0X9RC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Chaste',
				paletteFamily: 	'A3D392',
				keyvisualId: 	'11551',
				keyvisualName: 	'kv_11551.jpg',
				fontsetId: 		'32877',
				graphicsetId: 	'13963',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'A3D392',
				b_color: 		'659A53',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100813-144548'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2401',
internalId:  '',
customField: '20100813-145005'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2443',
internalId:  '',
customField: '20100802-102107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2464',
internalId:  '',
customField: '20100813-155354'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2485',
internalId:  '',
customField: '20100730-140511'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9612',
internalId:  '',
customField: '20100813-160107'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17854',
internalId:  '',
customField: '20100813-123006'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2401',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2443',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2464',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2485',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '9612',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17833',
internalId:  '',
customField: '20100813-160031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17875',
internalId:  '',
customField: '20100813-122741'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17812',
internalId:  '',
customField: '20100813-160018'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '17812',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '17833',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '17854',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '17875',
internalId:  '',
customField: 'language:en;country:US;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INHILI';
var companyName   = 'Great+Plains+Glass+%26+Mirror';
var htmlTitle	  = 'Great+Plains+Glass+%26+Mirror+Co.';
var metaKeywords  = 'auto+glass+retail%2C+door+%26+window+dealers%2C+dealer%2C+door+%26+window+screen+sales%2C+sale%2C+repair%2C+doors%2C+door%2C+windows%2C+window+installation%2C+glass+%26+glass+products%2C+product+dealers%2C+dealer%2C+plate+glass+windows%2C+window%2C+storm+door+%26+window+dealers%2C+dealer%2C+windows%2C+window%2C+parts%2C+part+dealers%2C+dealer%2C+windows%2C+window%2C+parts%2C+part%2C+doors%2C+door%2C+windows%2C+window%2C+glass+%26+glass+products%2C+product%2C+door+%26+window+screens%2C+screen%2C+installation%2C+storm+doors%2C+door%2C+windows%2C+window%2C+windows%2C+window%2C+glass%2C+industrial+materials%2C+material%2C+door+%26+window+dealers%2C+dealer%2C+glass+%26+glass+products%2C+product+dealers%2C+dealer%2C+plate+glass+windows%2C+window%2C+windows%2C+window%2C+parts%2C+part+dealers%2C+dealer%2C+windows%2C+window%2C+parts%2C+part%2C+doors%2C+door%2C+windows%2C+window%2C+glass+%26+glass+products%2C+product%2C+windows%2C+window%2C+glass%2C+industrial+materials%2C+material%2C+Oklahoma%2C+Anadarko%2C+Cyril%2C+Apache%2C+Cement%2C+Binger%2C+Gracemont%2C+Chickasha%2C+Elgin%2C+%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A';
var metaContents  = 'We+repair+all+kinds+of+glass.+We+are+experienced+in+handling+all+kinds+of+commercial+and+residential+glass+repairs+to+doors+and+windows.+We+replace+Locks+%26+make+keys.+';
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();
};

