/* [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','2701',jdecode('Our+Condo'),jdecode(''),'/2701/index.html','true',[ 
		['PAGE','5201',jdecode('Living+Room+%26+Kitchen'),jdecode(''),'/2701/5201.html','true',[],'',''],
		['PAGE','10001',jdecode('Bedrooms+%26+Bathrooms'),jdecode(''),'/2701/10001.html','true',[],'',''],
		['PAGE','24101',jdecode('Views+%26+Pools'),jdecode(''),'/2701/24101.html','true',[],'','']
	],'',''],
	['PAGE','2722',jdecode('Amenities'),jdecode(''),'/2722.html','true',[],'',''],
	['PAGE','17801',jdecode('Activities'),jdecode(''),'/17801/index.html','true',[ 
		['PAGE','8001',jdecode('Golf+%26+Tennis'),jdecode(''),'/17801/8001.html','true',[],'','']
	],'',''],
	['PAGE','41001',jdecode('Local+Dining'),jdecode(''),'/41001.html','true',[],'',''],
	['PAGE','7501',jdecode('Kauai%26%23x27%3Bs+History'),jdecode(''),'/7501.html','true',[],'',''],
	['PAGE','7901',jdecode('Kauai%26%23x27%3Bs+Beaches'),jdecode(''),'/7901.html','true',[],'',''],
	['PAGE','8401',jdecode('Weather+%26+Location'),jdecode(''),'/8401.html','true',[],'',''],
	['PAGE','2922',jdecode('Prices+and+Availability'),jdecode(''),'/2922.html','true',[],'',''],
	['PAGE','2943',jdecode('Contact+Us+to+Inquire'),jdecode(''),'/2943.html','true',[],'','']];
var siteelementCount=13;
theSitetree.topTemplateName='Americanlife';
theSitetree.paletteFamily='50529E';
theSitetree.keyvisualId='4238';
theSitetree.keyvisualName='kv_4238.jpg';
theSitetree.fontsetId='10674';
theSitetree.graphicsetId='11188';
theSitetree.contentColor='2A2C6E';
theSitetree.contentBGColor='7B7CB4';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Americanlife',
				paletteFamily: 	'50529E',
				keyvisualId: 	'4238',
				keyvisualName: 	'kv_4238.jpg',
				fontsetId: 		'10674',
				graphicsetId: 	'11188',
				contentColor: 	'2A2C6E',
				contentBGColor: '7B7CB4',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2722',
internalId:  '',
customField: '20100419-161805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2701',
internalId:  '',
customField: '20100419-154700'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '8401',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['7008']=webappMappings['7008-7215']={
webappId:    '7008',
documentId:  '2943',
internalId:  '7215',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2922',
internalId:  '',
customField: '20100420-113150'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17801',
internalId:  '',
customField: '20100417-192507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20100419-160403'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100417-182605'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2943',
internalId:  '',
customField: '20100322-185723'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7501',
internalId:  '',
customField: '20100420-114552'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7901',
internalId:  '',
customField: '20100419-153659'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20100324-141553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8401',
internalId:  '',
customField: '20100417-192927'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2701',
internalId:  '1006',
customField: '1006'
};
webappMappings['1501']=webappMappings['1501-7020876']={
webappId:    '1501',
documentId:  '2701',
internalId:  '7020876',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '24101',
internalId:  '',
customField: '20100419-161550'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41001',
internalId:  '',
customField: '20100416-121306'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050INZM8C';
var companyName   = 'Beautiful+2+Bedroom+Condo+at+Bargain+Prices%21';
var htmlTitle	  = 'Luxury+Princeville+Kauai+Hawaii+OceanView+Vacation+Rental';
var metaKeywords  = 'Condo%2CVacation+Rental%2CHome+Rental%2COcean+View%2COceanview%2CPrinceville%2CKauai%2CHawaii%2CHawaiian%2CLuxury%2C+Bargain%2CDiscount%2CAlii+Kai%2CAlii+Kai+II%2CRomantic%2CHoneymoon%2CCouples%2C2+Bedroom%2CEconomical%2CGolf%2CRelax%2CTennis%2CBird+Watch%2CWhale+Watch%2CFishing%2CTrekking%2CHiking%2CNapali+Coast%2CKayaking%2CSurfing%2Cweddings%2CFamilies%2Cretirees%2CHanalei%2CHanalei+Bay%2Csnorkeling%2C';
var metaContents  = 'A+Spacious+2+Bedroom%2F2+Bathroom+Vacation+Rental+Condo+with+Incredible+Ocean+and+Bali+Hai+Views+in+Princeville%2C+Kauai';
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();
};
