/* [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','32',jdecode('Home'),jdecode(''),'/32.html','true',[],''],
	['PAGE','375',jdecode('Rental+Unit+Photos'),jdecode(''),'/375/index.html','true',[ 
		['PAGE','362',jdecode('2nd+Floor+Apartment'),jdecode(''),'/375/362.html','true',[],''],
		['PAGE','581',jdecode('1st+Floor+Apartment'),jdecode(''),'/375/581.html','true',[],'']
	],''],
	['PAGE','504',jdecode('Views+Around+Town'),jdecode(''),'/504.html','true',[],''],
	['PAGE','651',jdecode('Places+to+Eat'),jdecode(''),'/651.html','true',[],''],
	['PAGE','315',jdecode('Guestbook'),jdecode(''),'/315/index.html','true',[ 
		['PAGE','314',jdecode('Read+Guestbook'),jdecode(''),'/315/314.html','false',[],'']
	],''],
	['PAGE','689',jdecode('Fees+-+2nd+Floor'),jdecode(''),'/689.html','true',[],''],
	['PAGE','698',jdecode('Fees+-+1st+Floor'),jdecode(''),'/698.html','true',[],''],
	['PAGE','1051',jdecode('Contact+Us'),jdecode(''),'/1051.html','true',[],'']];
var siteelementCount=11;
theSitetree.topTemplateName='Alpha';
theSitetree.paletteFamily='479949';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10461';
theSitetree.graphicsetId='10895';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var theTemplate={
				name: 			'Alpha',
				paletteFamily: 	'479949',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10461',
				graphicsetId: 	'10895',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'479949',
				e_color: 		'479949',
				f_color: 		'479949',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '32',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-315AHW050IN3WL2']={
webappId:    '1002',
documentId:  '315',
internalId:  '315AHW050IN3WL2',
customField: 'icq=false'
};
webappMappings['7060']=webappMappings['7060-f80b948304037883088128701ba9b4e9']={
webappId:    '7060',
documentId:  '362',
internalId:  'f80b948304037883088128701ba9b4e9',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-2084fc5a008af67114f4dd330be00bd3']={
webappId:    '7060',
documentId:  '504',
internalId:  '2084fc5a008af67114f4dd330be00bd3',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-7c1e4b6e5fcc99d3bfa3e3df6521484d']={
webappId:    '7060',
documentId:  '581',
internalId:  '7c1e4b6e5fcc99d3bfa3e3df6521484d',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-60c60d179c8e592b9bc7ef86e333887e']={
webappId:    '7060',
documentId:  '651',
internalId:  '60c60d179c8e592b9bc7ef86e333887e',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32',
internalId:  '',
customField: '20091103-202246'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '504',
internalId:  '',
customField: '20080131-204653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '651',
internalId:  '',
customField: '20060705-015957'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '375',
internalId:  '',
customField: '20080131-211908'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '362',
internalId:  '',
customField: '20060705-015333'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '581',
internalId:  '',
customField: '20060705-015401'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '315',
internalId:  '',
customField: '20060102-005951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '314',
internalId:  '',
customField: '20060102-005951'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '698',
internalId:  '',
customField: '20091017-210012'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '689',
internalId:  '',
customField: '20061203-211231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1051',
internalId:  '',
customField: '20091017-211157'
};
var canonHostname = 'wsc-worker01.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3WL2';
var companyName   = 'Ski+Vermont%21%21';
var htmlTitle	  = 'Ski-Vermont%21%21';
var metaKeywords  = 'Vermont+ski+rentals+okemo+ludlow+snowboard+snowmobile+VAST+snow+craigslist%2C+craigslist+vacation+rentals%2C+craigslist+vacation%2C+craigslist+apartment+rental%2C+veinter%2C+snow%2C+skiing%2C+snowboarding%2C+Vermont%2C+ludlow%2C+winter+rental%2C+snowboarding+rental%2C+';
var metaContents  = '';
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();
};
