/* [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','2101',jdecode('Double+Hung+%2F+2+Lite+Sliders'),jdecode(''),'/2101.html','true',[],'',''],
	['PAGE','2152',jdecode('Bay+%2F+Bow+%2F+Garden+Windows'),jdecode(''),'/2152.html','true',[],'',''],
	['PAGE','2173',jdecode('Patio+Doors'),jdecode(''),'/2173.html','true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Vita02';
theSitetree.paletteFamily='C5E6FB';
theSitetree.keyvisualId='11283';
theSitetree.keyvisualName='kv_11283.jpg';
theSitetree.fontsetId='32120';
theSitetree.graphicsetId='13933';
theSitetree.contentColor='3C3D3C';
theSitetree.contentBGColor='F6FBFE';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Vita02',
				paletteFamily: 	'C5E6FB',
				keyvisualId: 	'11283',
				keyvisualName: 	'kv_11283.jpg',
				fontsetId: 		'32120',
				graphicsetId: 	'13933',
				contentColor: 	'3C3D3C',
				contentBGColor: 'F6FBFE',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				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:  '2101',
internalId:  '',
customField: '20100222-222719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2152',
internalId:  '',
customField: '20100222-222839'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2173',
internalId:  '',
customField: '20100222-113526'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2101',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN330INFTO4';
var companyName   = 'ST.+LOUIS+BEST+VINYL+REPLACEMENT+WINDOWS';
var htmlTitle	  = 'St.+Louis+Best+Replacement+Windows';
var metaKeywords  = 'window+st.+louis%2C++windows+st+louis%2C+window+saint+louis%2C++windows+saint+louis%2C+window+replacement+st.+louis+%2C+window+replacement+saint+louis%2C+window+replacements+st.+louis+%2C+window+replacements+saint+louis%2C+vinyl+windows+st.+louis%2C+vinyl+windows+saint+louis%2C+vinyl+replacement+windows+st.+louis%2C+vinyl+replacement+windows+saint+louis%2C+window+st.+louis%2C++windows+saint+louis%2C+vinyl+windows%2C+windows%2C+vinyl+window+replacements%2C+Affton%2C+Alhambra%2C+Alorton%2C+Alton%2C+Antonia%2C+Arnold%2C+Augusta%2C%09Ballwin%2C+Barnhart%2C+Beaufort%2C+Bel+Nor%2C+Bel+Ridge%2C+Bella+Villa%2C+Bellefontaine+Neighbors%2C+Bellerive%2C+Belleville%2C+Berger%2C+Berkeley%2C+Bethalto%2C+Beverly+Hills%2C+Black+Jack%2C+Black+Walnut%2C+Breckenridge+Hills%2C+Brentwood%2C+Bridgeton%2C+Bridgeton+Terrace%2C+Burke+City%2C%0D%0A%0D%0AByrnes+Mill%2C+Cahokia%2C+Calverton+Park%2C+Campbellton%2C+Caseyville%2C+Catawissa%2C+Cedar+Hill%2C+Centreville%0D%0A%0D%0ACharlack%2C+Chesterfield%2C+Clarkson+Valley%2C+Clayton%2CClover+Bottom%2C+Cloverleaf%2C+Collinsville%2C+Cottage+Hills%2C+Cottleville%2C+Country+Club+Hills%2C+Crescent%2C+Crestwood%2C+Creve+Coeur%2C+Crystal+City%2C+Crystal+Lake+Park%2C+De+Soto%2C+Defiance%2C+Dellwood%2C+Des+Peres%2C+Desoto%2C+Detmold%2C+Dissen%2C+Dittmer%2C+Dorsey%2C+Dunlap%2C+Lake%09Dupo%2C+E+Carondelet%2C+E+Saint+Louis%2C+E+St+Louis%2C+Eagle+Park%2C+Earth+City%2C+East+Alton%2C+East+Carondelet%2C+East+Saint+Louis%2C+East+St+Louis%2C+Edmundson%2C+Edwardsville%2C+Elkhorn%2C+Ellisville%2C+Etlah%2C+Eureka%2C+Fairmont+City%2C+Fairview+Heights%2C+Fairview+Hieghts%2C+Fairview+Hts%2C+Fayetteville%2C+Femme+Osage%2C+Ferguson%2C+Festus%2C+Fletcher%2C+Flor%2C+Flordell+Hills%2C+Florissant%2C+Foristell%2C+Fort+Russell%0D%0A%0D%0AFreeburg%2C+Frontenac%2C+Gerald%2C+Gilmore%2C+Glasgow+Village%2C+Glen+Carbon%2C+Glencoe%2C+Glendale%2C+Godfrey%2C+Goodfellow+Terrace%2C+Granite+City%2C+Grantfork%2C+Gray+Summit%2C+Greendale%2C+Grover%2C+Grubville%2C+Gumbo%2C+Hanley+Hills%2C+Hartford%09%2C+Harvester%2C+Hazelwood%2C+Herculaneum%2C+High+Ridge%2C+Highland%2C+Hillsboro%2C+Hoene+Spring%2C+Holiday+Shores%2C+Hollywood+Heights%2C+Horine%2C+House+Springs%2C+Huntleigh%2C+IMBS%2C+Imperial%2C+Innsbrook%2C+Jennings%2C+Josephville%2C+Kampville%2C+Kampville+Beach%2C+Kampville+Court%2C+Kaufman%2C+Kinloch%2C+Kirkwood%2C+Labadie%2C+Ladue%2C+Lake+Adelle%2C+Lake+Chesterfield%2C+Lake+Saint+Louis%2C+Lake+Sherwood%2C+Lake+St+Louis%2C+Lebanon%2C+Lemay%2C+Lenzburg%2C+Leslie%2C+Lonedell%2C+Louis%2C+LSL%2C+Luebbering%2C+Lumaghi+Heights%2C+Lyon%2C+Machens%2C+Madison%2C+Manchester%2C+Maplewood%2C+Marine%2C+Marissa%2C+Marrisa%2C+Marthasville%2C+Maryland+Heights%2C+Maryland+Hts%2C+Maryville%2C+Mascoutah%2C+Matson%2C+Mehlville%2C+Millstadt%2C+Mitchell%2C+Moline+Acres%2C+Moro%2C+Moselle%2C+New+Athens%2C+New+Douglas%2C+New+Haven%2C+Newport%2C+Normandy%2C+North+County%2C+Northwest+Plaza%2C+Northwoods%2C+Nw+Plaza%2C+O+Fallon%2C+O+Fallon%2C+Oakland%2C+Oakville%2C+Ofallon%2C+Olivette%2C+Olympian+Village%2C+Orchard+Farm%2C+Otto%2C+Overland%2C+Pacific%2C+Pagedale%2C+Pasadena+Hills%2C+Pasadena+Park%2C+Pea+Ridge%2C+Pendleton%2C+Pevely%2C+Pine+Lawn%2C+Pond%2C+Pontoon+Beach%2C+Portage+des+Sioux%2C+Prairietown%2C+Prtg+de+Sioux%2C+Prtg+de+Souix%0D%0A%0D%0ARentchler%2C+Richmond+Heights%2C+Richmond+Hts%2C+Riverview%2C+Robertson%2C+Robertsville%2C+Rock+Hill%2C+Rosewood%2C+Roxana%2C+Saint+Ann%2C+Saint+Anne%2C+Saint+Charles%2C+Saint+Clair%2C+Saint+John%2C+Saint+Louis%2C+Saint+Paul%2C+Saint+Peters%2C+Sappington%2C+Sauget%2C+Schluersburg%2C+Scott+AFB%2C+Scott+Air+Force+Base%2C+Sherman%2C+Shiloh%2C+Shrewsbury%2C+Signal+Hill%2C+Smithton%2C+South+Roxana%2C+South+Shore%2C+Spanish+Lake%2C+Spring+Bluff%2C+St+Anne%2C+St+Peters%2C+State+Park+Place%2C+Stony+Hill%2C+Strain%2C+Sullivan%2C+Sulphur+Spg%2C+Sulphur+Springs%2C+Sunset+Hills%2C+Swansea%2C+Times+Beach%2C+Town+and+Country%2C+Troy%2C+Truesdail%2C+Truesdale%2C+Twin+Oaks%2C+Twn+and+Cntry%2C+U+City%2C+Union%2C+Univ+City%2C+University+City%2C+University+Cy%2C+Valles+Mines%2C+Valley+Park%2C+Velda+Village+Hills%2C+Venice%2C+Vigus%2C+Villa+Ridge%2C+Vinita+Park%2C+Vitilas+Reid%2C+Warrenton%2C+Warson+Woods%2C+Washingtn+Park%2C+Washington%2C+Washington+Pk%2C+Webster+Groves%2C+Webster+Grvs%2C+Weldon+Spring%2C+Weldon+Spring+Heights%2C+Wellston%2C+Wentzville%2C+West+Alton%2C+West+County%2C+Wildwood%2C+Winchester%2C+Wood+River%2C+Woodson+Terrace%2C+Worden%2C+Wright+City%2C+%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A';
var metaContents  = 'Voted+%23+1+for+Best+Value+in+replacement+windows+-+Guaranteed+Best+Price+-+Call+%28314%29+568-5113+for+a+FREE+in+home+estimate.+Enjoy+30+to+40%25+savings+on+your+utility+bills+with+our+High+Efficiency+Windows+and+Patio+Doors';
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();
};
