/* [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','447',jdecode('Home'),jdecode(''), jdecode('%2F447.html'), 'true',[],'',''],
	['PAGE','1870',jdecode('Attractions+%26+Recreation'),jdecode(''), jdecode('%2F1870.html'), 'true',[],'',''],
	['PAGE','877',jdecode('Facilities+%26+Area+Events'),jdecode(''), jdecode('%2F877.html'), 'true',[],'',''],
	['PAGE','2064',jdecode('Cabins%2FCampsites'),jdecode(''), jdecode('%2F2064.html'), 'true',[],'',''],
	['PAGE','1103',jdecode('Rates%2FCheck-In%2FRules'),jdecode(''), jdecode('%2F1103.html'), 'true',[],'',''],
	['PAGE','1879',jdecode('Directions+%26+Campsite+Map'),jdecode(''), jdecode('%2F1879.html'), 'true',[],'',''],
	['PAGE','1757',jdecode('Online+Reservations'),jdecode(''), jdecode('%2F1757.html'), 'true',[],'',''],
	['PAGE','1861',jdecode('Contact+us'),jdecode(''), jdecode('%2F1861.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Bombay';
theSitetree.paletteFamily='8B0B22';
theSitetree.keyvisualId='7535';
theSitetree.keyvisualName='kv_7535.jpg';
theSitetree.fontsetId='16582';
theSitetree.graphicsetId='12199';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='AEC6B8';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hps_testtown',
  product: 'WSCSYSSSSLYTC241'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Bombay',
				paletteFamily: 	'8B0B22',
				keyvisualId: 	'7535',
				keyvisualName: 	'kv_7535.jpg',
				fontsetId: 		'16582',
				graphicsetId: 	'12199',
				contentColor: 	'000000',
				contentBGColor: 'AEC6B8',
				a_color: 		'8B0B22',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '447',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '447',
internalId:  '',
customField: '20110904-071008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1103',
internalId:  '',
customField: '20111008-141956'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2064',
internalId:  '',
customField: '20110825-130741'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1870',
internalId:  '',
customField: '20110803-142959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '877',
internalId:  '',
customField: '20110609-184059'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1879',
internalId:  '',
customField: '20101218-122058'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1757',
internalId:  '',
customField: '20110416-093805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1861',
internalId:  '',
customField: '20110604-101851'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker02.chi.us.siteprotect.com';
var accountId     = 'AHW050INX343';
var companyName   = 'Kalkaska+RV+Park+%26+Campground+...nature+at+its+best%21';
var htmlTitle	  = 'Kalkaska+Michigan+Camping+Kalkaska+Michigan+Camp+Grounds+Michigan+RV+Park';
var metaKeywords  = 'Camping+Michigan+%2CTraverse+City+Campgrounds%2CTraverse+City+Michigan+Camping%2C+Kalkaska+Michigan+Camping%2C+Kalkaska+Michigan+Park%2C++Kalkaska+Michigan+RV+Park%2C+Traverse+City+Michigan+RV+Park%2C+Kalkaska+Michigan+Camper%2C+Kalkaska+Michigan+Vacation%2C+Kalkaska+Michigan+Vacations%2C+Traverse+City+Vacations%2C+Kalkaska+Michigan+Camping+trips%2C+Kalkaska+Michigan+Family+Camping%2C+Kalkaska+Michigan+RV+Camping%2C+RV+Camping+Kalkaska+Michigan%2C+Kalkaska+Michigan+Family+Camping+Trips%2C+Kalkaska+Michigan+Family+RV+Camping+Trips%2C+Kalkaska+Michigan+Campground%2CTraverse+City+Area+camping%2Ccampgrounds%2CTorch+Lake+campgrounds%2C+Torch+Lake+RV+Park%2CTorch+Lake+camping%2CSeasonal+campsites%2C+Seasonal+camping%2CKalkaska+cabins%2CTraverse+City+area+camping%2CNational+Trout+Festival%2C+Kalkaska+National+Trout+Festival%2C';
var metaContents  = 'Kalkaska+RV+Park+and+Campground+is+a+Kalkaska+Michigan+Camping+Kalkaska+Michigan+Camp+Grounds+Michigan+RV+Park+++++meta+name%3Drobots+content%3Dindex%2Cfollow++meta+name%3Drevisit-after+content%3D14+days++meta+name%3Dgooglebot+content%3Dindex%2Cfollow++';
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();
};

