/* [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','301',jdecode('Home'),jdecode(''),'/301.html','true',[],'',''],
	['PAGE','352',jdecode('About+us'),jdecode(''),'/352.html','true',[],'',''],
	['PAGE','373',jdecode('Contact'),jdecode(''),'/373.html','true',[],'',''],
	['PAGE','20601',jdecode('KITCHEN+PHOTO+GALLERY'),jdecode(''),'/20601.html','true',[],'',''],
	['PAGE','20801',jdecode('BATHROOM+PHOTOS'),jdecode(''),'/20801.html','true',[],'',''],
	['PAGE','42501',jdecode('ROOM+ADDITIONS%2C+DECKS+%26+OTHER+REMODELING+PHOTOS'),jdecode(''),'/42501.html','true',[],'',''],
	['PAGE','415',jdecode('Featured+article'),jdecode(''),'/415.html','true',[],'',''],
	['PAGE','457',jdecode('Tips+%26+Forum'),jdecode(''),'/457.html','true',[],'',''],
	['PAGE','478',jdecode('Interesting+links'),jdecode(''),'/478.html','true',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Rectangle';
theSitetree.paletteFamily='FFFFFF';
theSitetree.keyvisualId='2505';
theSitetree.keyvisualName='blanko.jpg';
theSitetree.fontsetId='451';
theSitetree.graphicsetId='506';
theSitetree.contentColor='033568';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Rectangle',
				paletteFamily: 	'FFFFFF',
				keyvisualId: 	'2505',
				keyvisualName: 	'blanko.jpg',
				fontsetId: 		'451',
				graphicsetId: 	'506',
				contentColor: 	'033568',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '415',
internalId:  '',
customField: '20081007-194801'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '457',
internalId:  '',
customField: '20081016-212411'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '373',
internalId:  '',
customField: '20080211-173412'
};
webappMappings['7008']=webappMappings['7008-6671']={
webappId:    '7008',
documentId:  '373',
internalId:  '6671',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '478',
internalId:  '',
customField: '20081016-212513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20091107-103740'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20601',
internalId:  '',
customField: '20081016-212053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '352',
internalId:  '',
customField: '20091107-104845'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-8ecac54880eccf1771c9616a97156151']={
webappId:    '7060',
documentId:  '20801',
internalId:  '8ecac54880eccf1771c9616a97156151',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-5e7b93f54b80e0dbd1c81e4e9a6ee16a']={
webappId:    '7060',
documentId:  '20601',
internalId:  '5e7b93f54b80e0dbd1c81e4e9a6ee16a',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20801',
internalId:  '',
customField: '20081016-212234'
};
webappMappings['1003']=webappMappings['1003-aendu0in298g11cd9b8df56']={
webappId:    '1003',
documentId:  '457',
internalId:  'aendu0in298g11cd9b8df56',
customField: 'en:US'
};
webappMappings['1501']=webappMappings['1501-3895302']={
webappId:    '1501',
documentId:  '301',
internalId:  '3895302',
customField: '1501'
};
webappMappings['7060']=webappMappings['7060-939a522fa12921b6bf25858470f8c45c']={
webappId:    '7060',
documentId:  '42501',
internalId:  '939a522fa12921b6bf25858470f8c45c',
customField: 'language:en;country:US;'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0IN298G';
var companyName   = 'RIGGS+REMODELING+%26+DESIGN%2C+INC.';
var htmlTitle	  = 'RIGGS+REMODELING';
var metaKeywords  = 'HOME+IMPROVEMENT+REMODELING+KITCHEN+BATH+BASEMENT+COLUMBUS+OHIO+GRANVILLE+PATASKALA+REYNOLDSBURG+UPPER+ARLINGTON+POWELL+GAHANNA+++FRANKLIN+COUNTY+DELAWARE+COUNTY+LICKING+COUNTY+ROOM+ADDITIONS+BATH+DESIGN+KITCHEN+DESIGN+BASEMENT+FINISHING+TILE+DRYWALL+ELECTRIC+KITCHEN+DESIGN+KITCHNE+REMODELING+BATH+DESIGN+BASEMENT+DESIGN+BASEMENT+REMODEL+BATH+REMODEL+HOME+IMPROVEMENT+RESIDENTIAL+BUILDING+RESIDENTIAL+REMODELING+HOME+IMPROVEMENT';
var metaContents  = 'A+HOME+IMPROVEMENT+COMPANY+SPECIALIZING+IN+KITCHEN%2C+BATHROOMS%2C++BASEMENTS';
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();
};
