/* [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','6001',jdecode('Home'),jdecode(''), jdecode('%2F6001.html'), 'true',[],'',''],
	['PAGE','6052',jdecode('Remodeling'),jdecode(''), jdecode('%2F6052%2Findex.html'), 'true',[ 
		['PAGE','6073',jdecode('Bathrooms'),jdecode(''), jdecode('%2F6052%2F6073.html'), 'true',[],'',''],
		['PAGE','6094',jdecode('Crown+Molding'),jdecode(''), jdecode('%2F6052%2F6094.html'), 'true',[],'','']
	],'',''],
	['PAGE','6136',jdecode('Bath+Accessibility'),jdecode(''), jdecode('%2F6136%2Findex.html'), 'true',[ 
		['PAGE','6157',jdecode('Walk-in+Tubs'),jdecode(''), jdecode('%2F6136%2F6157.html'), 'true',[],'',''],
		['PAGE','6178',jdecode('Walk-in+Showers'),jdecode(''), jdecode('%2F6136%2F6178.html'), 'true',[],'',''],
		['PAGE','6199',jdecode('Tub+Conversions'),jdecode(''), jdecode('%2F6136%2F6199.html'), 'true',[],'','']
	],'',''],
	['PAGE','6220',jdecode('Bathtub++Refinishing'),jdecode(''), jdecode('%2F6220%2Findex.html'), 'true',[ 
		['PAGE','6262',jdecode('Countertops'),jdecode(''), jdecode('%2F6220%2F6262.html'), 'true',[],'',''],
		['PAGE','6241',jdecode('Tubs+%26+Showers'),jdecode(''), jdecode('%2F6220%2F6241.html'), 'true',[],'',''],
		['PAGE','28512',jdecode('Refinishing+Makeover'),jdecode(''), jdecode('%2F6220%2F28512.html'), 'true',[],'','']
	],'',''],
	['PAGE','6283',jdecode('Specialty+Items'),jdecode(''), jdecode('%2F6283.html'), 'true',[],'',''],
	['PAGE','6304',jdecode('Contact+Us'),jdecode(''), jdecode('%2F6304.html'), 'true',[],'',''],
	['PAGE','11601',jdecode('Gallery'),jdecode(''), jdecode('%2F11601.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Akropolis';
theSitetree.paletteFamily='5E5E5E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10344';
theSitetree.graphicsetId='10448';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='5e5e5e';
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: 			'Akropolis',
				paletteFamily: 	'5E5E5E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10344',
				graphicsetId: 	'10448',
				contentColor: 	'FFFFFF',
				contentBGColor: '5e5e5e',
				a_color: 		'5E5E5E',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-2569']={
webappId:    '7008',
documentId:  '6304',
internalId:  '2569',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6001',
internalId:  '',
customField: '20120108-130245'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6052',
internalId:  '',
customField: '20100706-151129'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6136',
internalId:  '',
customField: '20100706-151545'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6220',
internalId:  '',
customField: '20100706-152507'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '6001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6073',
internalId:  '',
customField: '20100708-112230'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6094',
internalId:  '',
customField: '20100706-151453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6157',
internalId:  '',
customField: '20100706-152011'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6178',
internalId:  '',
customField: '20100706-152124'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6199',
internalId:  '',
customField: '20100706-152243'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6241',
internalId:  '',
customField: '20100706-152643'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6262',
internalId:  '',
customField: '20091118-103127'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6283',
internalId:  '',
customField: '20090107-101008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6304',
internalId:  '',
customField: '20120103-201458'
};
webappMappings['7060']=webappMappings['7060-94c0d723ce67e6d6049798a31871763d']={
webappId:    '7060',
documentId:  '11601',
internalId:  '94c0d723ce67e6d6049798a31871763d',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11601',
internalId:  '',
customField: '20091118-113829'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '28512',
internalId:  '',
customField: '20120108-130016'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVFL30INPEI0';
var companyName   = 'Denny%27s+Construction+Company%2C+Inc.';
var htmlTitle	  = 'Bathroom+Remodeling+Bathtub+Refinishing+Reglazing+Saginaw+Bay+City+';
var metaKeywords  = 'Bathroom+Remodeling%2C++Bathtub+Refinishing%2C++Bathroom+Repairs%2C++saginaw%2C+bay+city%2C+midland%2C+mid-michignan%2C+flint%2C+Bathtub%2C+Shower+%26+Tile+Reglazing%2C++bathtub+Repairs%2C++Fiberglass+Shower+Repair%2C++Ceramic+Tile%2C+Porcelian+Bathtub+refinishing%2C++Fiberglass+bathtub+refinishing%2C++bathroom+renovations%2C++claw+foot+tubs%2C+claw+foot+tub+reglazing%2C++antique+bathtub%2C+antique+bathtub+reglazing%2C+bathtub+replacement%2C+shower+replacement%2C+custom+showers%2C+custom+bathrooms%2C+';
var metaContents  = 'Denny%27s+Construction+is+fully+licensed+Residential+Builder+that+specializes+in+Bathroom+Remodeling.++From+economical+Bathtub+Refinishing+to+Custom+Luxury+Showers%2C+Denny%27s+Construction+has+the+knowlege+and+experience+to+complete+your+next+project.';
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();
};

