/* [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','5001',jdecode('Home'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','11001',jdecode('Products'),jdecode(''), jdecode('%2F11001%2Findex.html'), 'true',[ 
		['PAGE','11064',jdecode('Doors'),jdecode(''), jdecode('%2F11001%2F11064.html'), 'true',[],'',''],
		['PAGE','11085',jdecode('Insulation'),jdecode(''), jdecode('%2F11001%2F11085.html'), 'true',[],'',''],
		['PAGE','15401',jdecode('Trim'),jdecode(''), jdecode('%2F11001%2F15401.html'), 'true',[],'',''],
		['PAGE','15422',jdecode('Windows'),jdecode(''), jdecode('%2F11001%2F15422.html'), 'true',[],'',''],
		['PAGE','11022',jdecode('Cabinets'),jdecode(''), jdecode('%2F11001%2F11022.html'), 'true',[],'',''],
		['PAGE','11043',jdecode('Cabinet+Accesories'),jdecode(''), jdecode('%2F11001%2F11043.html'), 'true',[],'',''],
		['PAGE','15443',jdecode('More'),jdecode(''), jdecode('%2F11001%2F15443.html'), 'true',[],'','']
	],'',''],
	['PAGE','57312',jdecode('New+Stuff'),jdecode(''), jdecode('%2F57312.html'), 'true',[],'',''],
	['PAGE','11106',jdecode('FAQ'),jdecode(''), jdecode('%2F11106.html'), 'true',[],'',''],
	['PAGE','5052',jdecode('About+us'),jdecode(''), jdecode('%2F5052.html'), 'true',[],'',''],
	['PAGE','5073',jdecode('Contact+us'),jdecode(''), jdecode('%2F5073.html'), 'true',[],'',''],
	['PAGE','31701',jdecode('RESULTS'),jdecode(''), jdecode('%2F31701.html'), 'true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Draft';
theSitetree.paletteFamily='A4895B';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10619';
theSitetree.graphicsetId='10614';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='A4895B';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp13-cbeyon',
  product: 'WSCSYSSSSLYTC2ZA'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Draft',
				paletteFamily: 	'A4895B',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10619',
				graphicsetId: 	'10614',
				contentColor: 	'FFFFFF',
				contentBGColor: 'A4895B',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'444443',
				e_color: 		'705F58',
				f_color: 		'533C33',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20120217-175947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20111103-110613'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20111121-181013'
};
webappMappings['7008']=webappMappings['7008-27290']={
webappId:    '7008',
documentId:  '5073',
internalId:  '27290',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11106',
internalId:  '',
customField: '20111121-180916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20120117-094051'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11022',
internalId:  '',
customField: '20120117-085405'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11043',
internalId:  '',
customField: '20120117-090438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11064',
internalId:  '',
customField: '20120117-083311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11085',
internalId:  '',
customField: '20111120-103853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15401',
internalId:  '',
customField: '20120117-084926'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15422',
internalId:  '',
customField: '20120117-085226'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15443',
internalId:  '',
customField: '20120117-095252'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31701',
internalId:  '',
customField: '20120117-144917'
};
webappMappings['1501']=webappMappings['1501-18025919']={
webappId:    '1501',
documentId:  '5001',
internalId:  '18025919',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '57312',
internalId:  '',
customField: '20120217-180933'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7951A';
var companyName   = 'EXTRA+Building+Materials%2C+Inc';
var htmlTitle	  = 'Extra+Building+Materials';
var metaKeywords  = 'insulation%2Ccabinets%2Cdiscount%2Cbuidling+materials%2Cextra%2Coverstock%2Ctrim%2Cmoulding%2Ccabinet+parts%2Ccabinet+accesories%2Ccountertops%2Cwindows%2Cdoors%2Cprehung+doors%2C+bi-fold+doors%2Clumber%2Crigid+insulation%2Cosb%2Cplywood%2Csheet+goods%2Ctoilets%2Cbathtubs%2Cremodel%2Cfix+n+flip%2Cconstruction%2Ccontractors%2Cdiy%2C';
var metaContents  = 'Extra+Building+Materials+has+been+supplying+Denver+and+surround+with+NEW+surplus+building+materials+since+1996.';
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();
};

