/* [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 theSitetree=[ 
	['PAGE','701',jdecode('Home'),jdecode(''),'/701.html','true',[],''],
	['PAGE','794',jdecode('Glass'),jdecode(''),'/794/index.html','true',[ 
		['PAGE','6422',jdecode('Storefronts'),jdecode(''),'/794/6422.html','true',[],''],
		['PAGE','6443',jdecode('Architectural+Glass+'),jdecode(''),'/794/6443.html','true',[],''],
		['PAGE','24601',jdecode('Shower+Enclosures'),jdecode(''),'/794/24601.html','true',[],''],
		['PAGE','32701',jdecode('Shower+Handles'),jdecode(''),'/794/32701.html','true',[],''],
		['PAGE','36401',jdecode('Hinges'),jdecode(''),'/794/36401.html','true',[],'']
	],''],
	['PAGE','38401',jdecode('Paint'),jdecode(''),'/38401.html','true',[],''],
	['PAGE','51501',jdecode('Jobs'),jdecode(''),'/51501.html','true',[],''],
	['PAGE','878',jdecode('Contact'),jdecode(''),'/878.html','true',[],'']];
var siteelementCount=10;
theSitetree.topTemplateName='Bow';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='12019';
theSitetree.keyvisualName='kv_12019.jpg';
theSitetree.fontsetId='33246';
theSitetree.graphicsetId='14117';
theSitetree.contentColor='333333';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				name: 			'Bow',
				paletteFamily: 	'000000',
				keyvisualId: 	'12019',
				keyvisualName: 	'kv_12019.jpg',
				fontsetId: 		'33246',
				graphicsetId: 	'14117',
				contentColor: 	'333333',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'F2F5F8',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '701',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-56448cdafda8fce6ba7837ca52aa0018']={
webappId:    '7060',
documentId:  '24601',
internalId:  '56448cdafda8fce6ba7837ca52aa0018',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-006fb93fb64ec7e0ffee02ea6f90037f']={
webappId:    '7060',
documentId:  '32701',
internalId:  '006fb93fb64ec7e0ffee02ea6f90037f',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-2104acb2c5ad6f633cb89cd76df99c2b']={
webappId:    '7060',
documentId:  '36401',
internalId:  '2104acb2c5ad6f633cb89cd76df99c2b',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '701',
internalId:  '',
customField: '20100118-191101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '794',
internalId:  '',
customField: '20060814-171725'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24601',
internalId:  '',
customField: '20060819-170547'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32701',
internalId:  '',
customField: '20070124-083652'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36401',
internalId:  '',
customField: '20070124-083853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6422',
internalId:  '',
customField: '20060804-111200'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6443',
internalId:  '',
customField: '20060802-175947'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '878',
internalId:  '',
customField: '20100125-130753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '51501',
internalId:  '',
customField: '20100125-150026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38401',
internalId:  '',
customField: '20100125-145301'
};
var canonHostname = 'wsc1.brinkster.com';
var accountId     = 'ABRI10INXZH8';
var companyName   = 'ELITE+GLASS+%26+PAINT';
var htmlTitle	  = 'ELITE+GLASS+%26+PAINT';
var metaKeywords  = 'jersey+city+glass%2C+mirrors%2C+shower+doors%2C+shower+doors+new+jersey%2C+mirrors+new+jersey%2C+storefronts%2C+curtain+wall%2C+tabletops%2C+curtainwall%2C+Glass%2C+Paint%2C+Jersey+city+glass%2C+Jersey+City+paint%2C+NYC+Glass%2C+NYC+Paint%2C+Paint+restoration%2C+Shower+Doors%2C+Custom+Shower+Doors%2C+Storefronts%2C+Curtain+walls%2C+Mirrors%2C+Windows%2C+Shower+Enclosure%2C+curtainwall';
var metaContents  = 'Glass%2C+Paint%2C+Jersey+city+glass%2C+Jersey+City+paint%2C+NYC+Glass%2C+NYC+Paint%2C+Paint+restoration%2C+Shower+Doors%2C+Custom+Shower+Doors%2C+Storefronts%2C+Curtain+walls%2C+Mirrors%2C+Windows%2C+Shower+Enclosure%2C+curtainwall%2C+jersey+city+glass%2C+mirrors%2C+shower+doors%2C+shower+doors+new+jersey%2C+mirrors+new+jersey%2C+storefronts%2C+curtain+wall%2C+tabletops%2C+curtainwall%2C';
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();
};

