/* [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','2201',jdecode('Lincoln+County%2C+Nevada'),jdecode(''), jdecode('%2F2201.html'), 'true',[],'',''],
	['PAGE','2252',jdecode('Land+and+Water+Rights+'),jdecode(''), jdecode('%2F2252.html'), 'true',[],'',''],
	['PAGE','2294',jdecode('Water+Rights'),jdecode(''), jdecode('%2F2294.html'), 'true',[],'',''],
	['PAGE','2273',jdecode('Contact+Us+Here'),jdecode(''), jdecode('%2F2273.html'), 'true',[],'',''],
	['PAGE','4901',jdecode('Food+and+Water+News'),jdecode(''), jdecode('%2F4901.html'), 'true',[],'',''],
	['PAGE','4801',jdecode('Blogs%2C+Land+%26+Water'),jdecode(''), jdecode('%2F4801.html'), 'true',[],'',''],
	['PAGE','2315',jdecode('Local+Communitees'),jdecode(''), jdecode('%2F2315.html'), 'true',[],'',''],
	['PAGE','2336',jdecode('Today+and+Tomorrow'),jdecode(''), jdecode('%2F2336.html'), 'true',[],'',''],
	['PAGE','5001',jdecode('Land+For+Sale'),jdecode(''), jdecode('%2F5001.html'), 'false',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Blog';
theSitetree.paletteFamily='649B30';
theSitetree.keyvisualId='11531';
theSitetree.keyvisualName='kv_11531.jpg';
theSitetree.fontsetId='32865';
theSitetree.graphicsetId='13949';
theSitetree.contentColor='212121';
theSitetree.contentBGColor='989696';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'endurance',
  product: 'WSCSYSSSSLY0XRNC'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Blog',
				paletteFamily: 	'649B30',
				keyvisualId: 	'11531',
				keyvisualName: 	'kv_11531.jpg',
				fontsetId: 		'32865',
				graphicsetId: 	'13949',
				contentColor: 	'212121',
				contentBGColor: '989696',
				a_color: 		'FFB434',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-32780']={
webappId:    '7008',
documentId:  '2273',
internalId:  '32780',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2201',
internalId:  '',
customField: '20120108-120309'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2252',
internalId:  '',
customField: '20120108-120438'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2294',
internalId:  '',
customField: '20120108-120622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2273',
internalId:  '',
customField: '20120108-120946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2315',
internalId:  '',
customField: '20120108-121344'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2336',
internalId:  '',
customField: '20120108-121536'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20120108-121143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4801',
internalId:  '',
customField: '20120108-121249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20110106-222114'
};
webappMappings['7008']=webappMappings['7008-33370']={
webappId:    '7008',
documentId:  '4801',
internalId:  '33370',
customField: 'language:en;country:US;'
};
var webAppHostname = 'cgiwsc.enhancedsitebuilder.com:80';
var canonHostname = 'cmworker01.yourhostingaccount.com';
var accountId     = 'AENDU0INZYDR';
var companyName   = 'Lincoln+County+Land+and+Water+Rights+Market';
var htmlTitle	  = '';
var metaKeywords  = 'Lincoln+County+Nevada%2Cland+for+sale%2CNevada+ranchland%2Cfarm+land+with+water+rights+for+sale%2Cirrigated+land+with+water+rights%2Cgorund+water+rights+in+Nevada%2Csurface+water+rights+in+Nevada%2CColorado+River+Basin+water+rights+listed+for+sale%2Ccatlle+ranches%2C+farm+land%2Ctransition+land+for+development+with+water+rights%2Caffordable+solar+cottages+for+sale%2CEureka+County%2CWhite+Pine+County%2CLander+County%2CNye+County%2C+Humboldt+County%2C+Nevada+ranch+land+for+sale.';
var metaContents  = 'Nevada+Ranch+and+Farm+Land+with+Water+Rights+in+Lincoln+County+Nevada.+Land%2C+Farms%2C+Ranches%2C+and+Water+Rights+Listed+For+Sale%2C+MLS+listings%2C+BLM+grazing+allotments%2CMeadow+Valley%2C+Lake+Valley%2C+Rainbow+Canyon+Land+and+Ranches+For+Sale+in+Lincoln+County+Nevada.+Serving+Eureka+County%2CWhite+Pine+County%2CLander+County%2CNye+County%2C+Humboldt+County%2C+Nevada+Ranch+Land+Listed+For+Sale.';
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();
};

