/* [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 theSitetree=[ 
	['PAGE','401',jdecode('Home'),jdecode(''),'/401.html','true',[],''],
	['PAGE','452',jdecode('Service'),jdecode(''),'/452.html','true',[],''],
	['PAGE','16401',jdecode('Industry+Links'),jdecode(''),'/16401.html','true',[],'']];
var siteelementCount=3;
theSitetree.topTemplateName='Fluent';
theSitetree.paletteFamily='4A714E';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10644';
theSitetree.graphicsetId='10521';
theSitetree.contentColor='757675';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Fluent',
				paletteFamily: 	'4A714E',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10644',
				graphicsetId: 	'10521',
				contentColor: 	'757675',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'A4A5A4',
				e_color: 		'4971AD',
				f_color: 		'26487C',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20081007-143744'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16401',
internalId:  '',
customField: '20081110-095806'
};
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN010IN3RR1';
var companyName   = 'Roberts+Diesel+Works+Inc.+407+246-1597';
var htmlTitle	  = 'Crane%2C+Cranes%2C+Custom+Built+for+Every+Application.';
var metaKeywords  = 'Drywall+Cranes%2CRoofing+Cranes%2CCrane%2CPM+Cranes%2CConveyors%2C+Fassi%2CCormach%2CPrentice%2CPM%2CHiab%2CPalfinger%2CDrywall%2CWallboard%2CKinshofer%2Cforks%2CDrywall%2C+Wallboard%2C+Sheetrock%2C+Sheet+Rock%2C+Roofing+Cranes%2C+Conveyors%2C+Knuckleboom%2C+Jib%2C+Truck+Mounted%2C+Construction%2C+Knuckle+Boom%2C+Articulated%2C+Articulating%2C+Boomtruck%2C+Boom+Truck%2C+Stick+Boom%2C+Truck+Mounted++Material+Handling+Equipment%2C+Bulk+Material+Handling%2C+Conveyor+Trucks%2C+Forklifts%2C+Navigator%2C+Manitou%2C+Piggy+Back%2C+Rough+Terrain%2C+Truck+Mounted+Cranes+and+Kinshofer%2C+Forks%2C+Fork%2C+Pallet+fork%2C+Precast%2C+Concrete%2C+Poured+Wall%2C+Oil+Rig%2C+Oil+Field%2C+Rigging%2C+Septic+Tank%2C+Monument%2C+Sign%2C+Man+Basket%2C+Log+Loader%2C+Pipe+Handler%2C+Pole+Handler%2C+Trash%2C+Debris%2C+Scrap%2C+Waste%2C+Concrete%2C+Crane+Equipment%2C+Sales%2C+Repairs%2C+Services+and+Parts.';
var metaContents  = 'We+offer+a+full+line+of+custom+cranes+including%3A+Drywall+Cranes%2C+Roofing+Cranes%2C+Authorized+PM+Crane+dealer.+New+used+and+rebuilt+parts+for%3A+Fassi%2C+Prentice%2C+IMT%2C+Palfinger%2C+Amco+Veba%2C+Cormach%2C+Hiab+cranes+and+equipment.+Service%2C+Parts%2C+Repairs+and+Sales.+Custom+Built+Cranes+for+any+industry+or+application.';
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();
};
