/* [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','4801',jdecode('Home'),jdecode(''), jdecode('%2F4801.html'), 'true',[],'',''],
	['PAGE','10801',jdecode('About+us'),jdecode(''), jdecode('%2F10801%2Findex.html'), 'true',[ 
		['PAGE','10822',jdecode('Service'),jdecode(''), jdecode('%2F10801%2F10822.html'), 'true',[],'','']
	],'',''],
	['PAGE','10843',jdecode('Air+Tool+Repair'),jdecode(''), jdecode('%2F10843.html'), 'true',[],'',''],
	['PAGE','10864',jdecode('Electric+Tool+Repair'),jdecode(''), jdecode('%2F10864.html'), 'true',[],'',''],
	['ITEM','10885',jdecode('Store'),jdecode(''), jdecode('http%3A%2F%2Fwww.toolrepairsvc.com%2Fstore%2Findex.html'), 'true',[],'','_blank'],
	['PAGE','10886',jdecode('Contact'),jdecode(''), jdecode('%2F10886.html'), 'true',[],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Pixelprofi';
theSitetree.paletteFamily='77222A';
theSitetree.keyvisualId='1090';
theSitetree.keyvisualName='dachdecker2.jpg';
theSitetree.fontsetId='187';
theSitetree.graphicsetId='225';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='77222A';
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: 			'Pixelprofi',
				paletteFamily: 	'77222A',
				keyvisualId: 	'1090',
				keyvisualName: 	'dachdecker2.jpg',
				fontsetId: 		'187',
				graphicsetId: 	'225',
				contentColor: 	'FFFFFF',
				contentBGColor: '77222A',
				a_color: 		'77222A',
				b_color: 		'341117',
				c_color: 		'000000',
				d_color: 		'501721',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4801',
internalId:  '',
customField: '20111120-200036'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10886',
internalId:  '',
customField: '20111120-194045'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10864',
internalId:  '',
customField: '20111120-195026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10843',
internalId:  '',
customField: '20111120-194954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10801',
internalId:  '',
customField: '20111120-195800'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10822',
internalId:  '',
customField: '20110819-043952'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4801',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-26219']={
webappId:    '7008',
documentId:  '10886',
internalId:  '26219',
customField: 'language:en;country:US;'
};
var webAppHostname = 'diycgi.cluster.stngva01.us.diy-servers.net:80';
var canonHostname = 'diywk02.verio.stngva01.us.diy-servers.net';
var accountId     = 'AVF340I7KPSG';
var companyName   = '+TOOL++REPAIR++HOUSTON+++713-472-3883++';
var htmlTitle	  = 'we+repair+all+air+electric+and+hydraulic+tools+';
var metaKeywords  = 'milwaukee+tool+%2C+dewalt+tool+%2C++bosch+tool+%2C+makita+++%2C++ridgid++%2C+wacker+equipment+%2C+nail+gun+repair+%2C+air+impact+repair+%2C++compressor+repair+%2C++metabo+%2C+hoist+repair%2C+electric+tool+repair+%2C+power+tool+repair+%2C+power+tool+parts+%2C+hydraulic+cylinder+repair+%2C+houston+%2C+pasedena+%2C+texas+%2C+ir+%2C+cleco%2C+%0D%0Acp+air+tool+repair%2C+torque+wrench+repair+%2C+calibration.+hitachi+%2C+duo+fast+%2C+pasode+%2C+framing+gun+%2C+siding+gun+%2C+roofing+nailer';
var metaContents  = 'electric+%2C++air+and+hydraulic+tool+repair+houston+and+surrounding+areas';
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();
};

