/* [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','54',jdecode('Home'),jdecode(''),'/54.html','true',[],'',''],
	['PAGE','4375',jdecode('Westin+Resort+Amenities'),jdecode(''),'/4375.html','true',[],'',''],
	['PAGE','84',jdecode('Rates+and+Availability'),jdecode(''),'/84.html','true',[],'',''],
	['PAGE','93',jdecode('Contacting+Us'),jdecode(''),'/93.html','true',[],'',''],
	['PAGE','4249',jdecode('Villa+Photos'),jdecode(''),'/4249/index.html','true',[ 
		['PAGE','4258',jdecode('Studio+Villas'),jdecode(''),'/4249/4258.html','true',[],'',''],
		['PAGE','4267',jdecode('1+Bedroom+Townhouse+Villas'),jdecode(''),'/4249/4267.html','true',[],'',''],
		['PAGE','4276',jdecode('2+Bedroom+Villas'),jdecode(''),'/4249/4276.html','true',[],'',''],
		['PAGE','4285',jdecode('3+Bedroom+Pool+Villas'),jdecode(''),'/4249/4285.html','true',[],'',''],
		['PAGE','11001',jdecode('Bay+Vista+Villas'),jdecode(''),'/4249/11001.html','true',[],'','']
	],'',''],
	['PAGE','75',jdecode('Villa+Descriptions'),jdecode(''),'/75/index.html','true',[ 
		['PAGE','4294',jdecode('Studio+Villas'),jdecode(''),'/75/4294.html','true',[],'',''],
		['PAGE','4303',jdecode('1+Bedroom+Townhouse+Villas'),jdecode(''),'/75/4303.html','true',[],'',''],
		['PAGE','4312',jdecode('2+Bedroom+%22Hill%22+Villas'),jdecode(''),'/75/4312.html','true',[],'',''],
		['PAGE','6123',jdecode('2+Bedroom+%22Bay+Vista%22Villas'),jdecode(''),'/75/6123.html','true',[],'',''],
		['PAGE','4321',jdecode('3+Bedroom+%22Pool%22+Villas'),jdecode(''),'/75/4321.html','true',[],'',''],
		['PAGE','6132',jdecode('3+Bedroom+%22Bay+Vista%22+Villas'),jdecode(''),'/75/6132.html','true',[],'','']
	],'',''],
	['PAGE','4494',jdecode('Getting+to+the+Westin+St+John'),jdecode(''),'/4494.html','true',[],'',''],
	['PAGE','4979',jdecode('Westin+and+St+John+Photos'),jdecode(''),'/4979.html','true',[],'',''],
	['PAGE','5712',jdecode('Virgin+Islands+National+Park'),jdecode(''),'/5712.html','true',[],'',''],
	['PAGE','29045',jdecode('Villa+Floorplans'),jdecode(''),'/29045.html','true',[],'','']];
var siteelementCount=21;
theSitetree.topTemplateName='Aeskulap';
theSitetree.paletteFamily='012253';
theSitetree.keyvisualId='2495';
theSitetree.keyvisualName='empty.jpg';
theSitetree.fontsetId='435';
theSitetree.graphicsetId='483';
theSitetree.contentColor='006633';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Aeskulap',
				paletteFamily: 	'012253',
				keyvisualId: 	'2495',
				keyvisualName: 	'empty.jpg',
				fontsetId: 		'435',
				graphicsetId: 	'483',
				contentColor: 	'006633',
				contentBGColor: 'FFFFFF',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				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:  '54',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-8555c05937cfdc13792297b43daaa185']={
webappId:    '7060',
documentId:  '4979',
internalId:  '8555c05937cfdc13792297b43daaa185',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54',
internalId:  '',
customField: '20100217-141112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '84',
internalId:  '',
customField: '20100730-134713'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4375',
internalId:  '',
customField: '20070917-003416'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '93',
internalId:  '',
customField: '20100114-215605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4249',
internalId:  '',
customField: '20070916-235853'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4258',
internalId:  '',
customField: '20070917-210525'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4267',
internalId:  '',
customField: '20070917-210701'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4276',
internalId:  '',
customField: '20070917-210808'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4285',
internalId:  '',
customField: '20070917-211343'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '75',
internalId:  '',
customField: '20100217-140925'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4294',
internalId:  '',
customField: '20100225-095928'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4303',
internalId:  '',
customField: '20100225-100033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4312',
internalId:  '',
customField: '20091014-092505'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6123',
internalId:  '',
customField: '20100225-095458'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4321',
internalId:  '',
customField: '20100226-090129'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6132',
internalId:  '',
customField: '20100225-095657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '29045',
internalId:  '',
customField: '20100303-081438'
};
webappMappings['7060']=webappMappings['7060-34b2b3dc168487657b87b67d42331db7']={
webappId:    '7060',
documentId:  '29045',
internalId:  '34b2b3dc168487657b87b67d42331db7',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4494',
internalId:  '',
customField: '20080218-153637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4979',
internalId:  '',
customField: '20100303-081219'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5712',
internalId:  '',
customField: '20080811-081026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20081121-191050'
};
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050IN2SKK';
var companyName   = 'ST+JOHN+WESTIN+VILLAS';
var htmlTitle	  = 'www.stjohnresortvillas.com';
var metaKeywords  = 'St+John+USVI%2C+villa+rental%2C+condo%2C+Virgin+Islands%2C+vacation+rental%2C+Caribbean+vacation%2C+Caribbean%2C+tropical+vacation%2C+beaches%2C+snorkelling%2C+scuba%2C+Westin+Resort%2C+st+johns%2C+Westin+resort%2C+Trunk+Bay%2C+Waterlemon%2C+Gallows+Point%2C+Caneel%2C+Cruz+Bay%2C+Westin+St+John%2C+';
var metaContents  = 'St+John+US+Virgin+Islands+Rental+Villa+at+Westin+Resort';
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();
};
