/* [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','1801',jdecode('Home'),jdecode(''), jdecode('%2F1801.html'), 'true',[],'',''],
	['PAGE','1852',jdecode('Free+Estimate'),jdecode(''), jdecode('%2F1852.html'), 'true',[],'',''],
	['PAGE','4301',jdecode('Gutters'),jdecode(''), jdecode('%2F4301.html'), 'true',[],'',''],
	['PAGE','4501',jdecode('Gutter+Protection+Systems'),jdecode(''), jdecode('%2F4501.html'), 'true',[],'',''],
	['PAGE','11001',jdecode('The+Rain+Gutter+Store'),jdecode(''), jdecode('%2F11001.html'), 'true',[],'',''],
	['PAGE','1873',jdecode('Reviews'),jdecode(''), jdecode('%2F1873.html'), 'true',[],'',''],
	['PAGE','1894',jdecode('Links'),jdecode(''), jdecode('%2F1894.html'), 'true',[],'',''],
	['PAGE','1915',jdecode('Contact'),jdecode(''), jdecode('%2F1915.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Trend';
theSitetree.paletteFamily='3F70CF';
theSitetree.keyvisualId='7933';
theSitetree.keyvisualName='kv_7933.jpg';
theSitetree.fontsetId='16912';
theSitetree.graphicsetId='12323';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'grp13-cbeyon',
  product: 'WSCSYSSSSLYTC2ZA'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Trend',
				paletteFamily: 	'3F70CF',
				keyvisualId: 	'7933',
				keyvisualName: 	'kv_7933.jpg',
				fontsetId: 		'16912',
				graphicsetId: 	'12323',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-26893']={
webappId:    '7008',
documentId:  '1852',
internalId:  '26893',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1801',
internalId:  '',
customField: '20111028-125608'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1915',
internalId:  '',
customField: '20111024-181534'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1852',
internalId:  '',
customField: '20111025-145240'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1873',
internalId:  '',
customField: '20111107-173535'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1894',
internalId:  '',
customField: '20111107-181453'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4301',
internalId:  '',
customField: '20111024-174635'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4501',
internalId:  '',
customField: '20111025-145622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20111227-161623'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I79MSH';
var companyName   = 'Gutter+King+Inc.';
var htmlTitle	  = 'Gutter+King+Inc';
var metaKeywords  = 'Gutter+King%2C+Gutter+King+difference%2C+seamless+rain+gutter+business%2C+homeowners+and+contractors%2C+homeowners%2C+contractors%2C+install%2C+gutters+and+downspouts%2C+gutters%2C+downspouts%2C+top+local+builders%2C+contractors%2C+residential+customers%2C+residential%2C+guarantee%2C+guarantee+our+products%2C+workmanship%2C+five-year+warranty%2C+warranty%2C+installations%2C+aluminum%2C+aluminum+gutters%2C+40+year+warranty%2C+licensed%2C+bonded%2C+guaranteed%2C+homes%2C+commercial+buildings%2C+Puget+sound%2C+full-service+company%2C+rain+gutter+needs%2C+year+round+installation%2C+repair%2C+cleaning+services%2C+cleaning%2C+do-it-yourselfer%2C+measurements%2C+gutter+king+stocks%2C+full-line+of+accessories%2C+trap-door+strainers%2C+downspout+strainers%2C+gutter+guards%2C+heavy+duty+installation+hangers%2C+free+estimate%2C+425+776-0884%2C+gutter+and+downspout+cleaning%2C+carnation%2C+seattle%2C+construction+contractor%2C+angies+list%2C+seattle+homeowner%2C+eastside%2C+toll+free%2C+gutterking75%2C+mountlake+terrace%2C+WA%2C+98043%2C+today%E2%80%99s+homeowner%2C+fine+homebuilding+online%2C+gutter+king+inc%2C+5%E2%80%9D+k-style+gutter%2C+5%E2%80%9D+k-style%2C+6%E2%80%9D+k-style+gutter%2C+6%E2%80%9D+k-style%2C+hidden+hangers+with+screws%2C+2x3+downspout%2C+3x4+downspout%2C+3%E2%80%9D+round+downspout%2C+Gutter+protection%2C+gutter+protection+systems%2C+E-Z+Lock+Guard%2C+';
var metaContents  = 'We+provide+professional+gutter+installation+or+we+can+save+you+money+with+our+cut+%26+drop+service%2C+including+FREE+professional+advice+for+installation.';
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();
};

