/* [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','3414',jdecode('Home'),jdecode(''),'/3414.html','true',[],'',''],
	['PAGE','4001',jdecode('Catalog'),jdecode(''),'/4001.html','true',[],'',''],
	['PAGE','4022',jdecode('FREE+Shipping'),jdecode(''),'/4022.html','true',[],'',''],
	['PAGE','4043',jdecode('Repair+Services'),jdecode(''),'/4043.html','true',[],'',''],
	['PAGE','4064',jdecode('14%22+Cutting+%26+Video'),jdecode(''),'/4064.html','true',[],'',''],
	['PAGE','9201',jdecode('Questions+%26+Answers'),jdecode(''),'/9201.html','true',[],'',''],
	['PAGE','14623',jdecode('Links'),jdecode(''),'/14623.html','true',[],'',''],
	['PAGE','4085',jdecode('About+Us'),jdecode(''),'/4085.html','true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Qben';
theSitetree.paletteFamily='AA7138';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='17182';
theSitetree.graphicsetId='12656';
theSitetree.contentColor='2E2E2E';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'true',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'true',
				hasCompanyname: 'false',
				name: 			'Qben',
				paletteFamily: 	'AA7138',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'17182',
				graphicsetId: 	'12656',
				contentColor: 	'2E2E2E',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'FFFFFF',
				d_color: 		'A7E333',
				e_color: 		'D28C7F',
				f_color: 		'A7E333',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3414',
internalId:  '',
customField: '20100405-182744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4001',
internalId:  '',
customField: '20110223-021356'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4022',
internalId:  '',
customField: '20090914-104854'
};
webappMappings['1501']=webappMappings['1501-22308036']={
webappId:    '1501',
documentId:  '3414',
internalId:  '22308036',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4043',
internalId:  '',
customField: '20090914-013824'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4064',
internalId:  '',
customField: '20100222-002933'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4085',
internalId:  '',
customField: '20090922-125854'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9201',
internalId:  '',
customField: '20090914-023016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14623',
internalId:  '',
customField: '20100405-183321'
};
var canonHostname = 'cmworker02.yourhostingaccount.com';
var accountId     = 'AENDU0INVMIA';
var companyName   = 'Eddies+Welding+Equipment';
var htmlTitle	  = 'Eddie%27s+Welding+Equipment';
var metaKeywords  = 'eddies+welding+equipment+eddies+torch+regulator+tip+glove+victor+harris+arcair+long+cutting+torches+safety+free+shipping++bulldog+hose+lance+rod+abrasive+chop+saw+grinder+sander+drill+bit+plasma+weld+hood+face+protection+glasses+respirator+3M+protective+clothing+leather+bib+raincoat+work+gloves+fire+blanket+soap+stone+striker+Gatorade+blade';
var metaContents  = 'Eddies+Welding+Equipment+-+Stocking+350+Long+Torches%21%2C+Free+Shipping%2C+Repair+Services%2C+Family-owned+and+operated+since+1948';
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();
};

