/* [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','601',jdecode('Cars+and+4x4+For+Sale'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','93001',jdecode('Classic+Cars+%2F+Boats'),jdecode(''),'/93001.html','true',[],'',''],
	['PAGE','124201',jdecode('Email%2FContact+Us'),jdecode(''),'/124201.html','true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Inspiration';
theSitetree.paletteFamily='000000';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='105';
theSitetree.graphicsetId='123';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Inspiration',
				paletteFamily: 	'000000',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'105',
				graphicsetId: 	'123',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'000000',
				b_color: 		'669999',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20100303-213311'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93001',
internalId:  '',
customField: '20100105-003541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '124201',
internalId:  '',
customField: '20100226-191321'
};
webappMappings['7008']=webappMappings['7008-303']={
webappId:    '7008',
documentId:  '124201',
internalId:  '303',
customField: 'language:en;country:US;'
};
var canonHostname = 'wscwrk01.ehost-services.com';
var accountId     = 'AEN020IN2308';
var companyName   = '+++++++++++++++++++++++++WWW.4X4CARYARD.COM';
var htmlTitle	  = '4x4+Car+Yard+%7C+4wd+Car+Sales+%7C+Used+Cars+and+4wd+Vehicles+For+Sale++%7C+Wholesale+Auction+Cars';
var metaKeywords  = '4wd+For+Sale%2C+4x4+For+Sale%2C+Car+Sales%2C+Used+Cars+and+4wd+Vehicles+For+Sale%2C+Wholesale+Auction+Cars%2C+Used+Car+Sales%2C+Used+Cars%2C+For+Sale%2C+4wd+sales%2C+sell+my+car%2C+Car+Value%2C+Cheap+Cars%2C++SUV%2C+car+yard%2C+4wd%2C+4x4%2C+Auto+Sales%2C+Car+Dealer%2C+used+Car+Dealer%2C+Auto+Dealership%2C+Toyota+Land+Cruiser%2C+Nissan+Patrol%2C+Mitsubishi+Pajero%2C+Jeep+Cherokee%2C+Jeep+Wrangler%2C+Ford+Falcon%2C+Holden+Rodeo%2C+Range+Rover%2C+Land+Rover+Discovery%2C+Suzuki%2C+Jackaroo%2C+Motor+Homes%2C+Caravans%2C+Buses%2C+V8%2C+cars%2C+Auto%2C+station+wagons%2C+pick+up+trucks%2C+4x4%2C+4wd%2C+four+wheel+drive+vehicle+for+sale%2C+tray+trucks%2C+4wd+sales%2C+4wd%2C+4x4+sales%2C+4x4.com%2C+carsales%2C+4x4sales%2C+4x4%2C+auction+cars%2C+4x4+auction%2C+4wd+auction+cars%2C+4x4+car+sales%2C+maryborough+4wd+and+car+sales%2C+queensland%2C+queensland+cars%2C+queensland+car+sales%2C+4x4+sales%2C+wide+bay+cars%2C+wide+bay+car+sales%2C+wide+bay+4wd%2C+wide+bay+4x4+sales%2C+wholesale+cars%2C+queensland+4x4%2C+maryborough+4x4%2C++queensland+4wd%2C+hervey+bay+cars%2C+Cars+and+4wds%2C+4WD+SALES%2C+USED+CARS%2C+4WD%2C+FOUR+WHEEL+DRIVE%2C+TOYOTA%2C+LAND+CRUISER%2C+HILUX%2C+MITSUBISHI%2C+DELICA%2C+PAJERO%2C+JEEP%2C+GRAND+CHEROKEE%2C+JEEP+%2CLTD%2C+LAND+ROVER%2C+DISCOVERY%2C+DEFENDER%2C+RANGE+ROVER%2C+NISSAN%2C+PATROL%2C+NAVARA%2C+SUV%2C+STATION+WAGONS%2C+UTES%2C+TRAYBACKS%2C+DUAL+CABS%2C+CREW+CABS%2C+FOUR+WHEEL+DRIVES%2C+OFF+ROAD+4X4%2C+JAPANESE+SPORTS+CARS%2C+300+ZX%2C+NISSAN+GT%2C+CAR+YARD%2C+THE+CAR+YARD%2C+CAR+SALES%2C+car+and+4wd+sales%2C+4x4+car+yard%2C+4WD%2C+4x4%2C+Used+4x4%2C+Auto+Sales%2C+4x4+Sales%2C+4wd+Sales%2C+four+wheel+drive%2C+tray+trucks%2C+4wd+sales%2C+4wd%2C+4x4+sales%2C+4x4+com%2C+carsales%2C+carpoint%2C+4x4+sales%2C+4x4%2C+auction+cars%2C+4x4+auction%2C+4wd+auction+cars%2C+4x4+car+sales%2C+4wd%2C+%2C+queensland+cars%2C+queensland+carsales%2C+4x4sales%2C+wide+bay+cars%2C+widebay+cars%2C+wide+bay+4wd+sales%2C+wide+bay+4x4%2C+wholesale+cars%2C+queensland+4x4%2C+maryborough+4x4+and+car+sales%2C++queensland+4wd%2C+maryborough+4wd%2C+maryborough+cars%2C+hervey+bay+cars%2C+country+cars%2C+4X4%2C+4WD+SALES%2C+USED+CARS%2C+4WD';
var metaContents  = '4x4+Car+Yard+%7C+4wd+Car+Sales%2C+Used+Cars+and+4wd+Vehicles+For+Sale%2C+Wholesale+Auction+Cars%2C+Can+Arrange+Delivery+To+Anywhere+In+Australia';
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();
};
