/* [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','88',jdecode('Cancun+Casa+Main'),jdecode(''),'/88.html','true',[],''],
	['PAGE','243',jdecode('Dangers%26%23x27%3B+Blog'),jdecode(''),'/243.html','true',[],''],
	['PAGE','225',jdecode('Cancun+Casa+Focus'),jdecode(''),'/225.html','true',[],''],
	['PAGE','5701',jdecode('Alerts%2C+Events+%26+News'),jdecode(''),'/5701.html','true',[],''],
	['PAGE','8801',jdecode('About%2F+Contact'),jdecode(''),'/8801.html','true',[],''],
	['PAGE','14201',jdecode('Links'),jdecode(''),'/14201.html','true',[],''],
	['PAGE','14222',jdecode('Maya+World'),jdecode(''),'/14222.html','true',[],''],
	['PAGE','14243',jdecode('Tropical+Weather'),jdecode(''),'/14243.html','true',[],''],
	['PAGE','14264',jdecode('Eco+Tourism'),jdecode(''),'/14264.html','true',[],''],
	['PAGE','14285',jdecode('Isla+Mujeres'),jdecode(''),'/14285.html','true',[],''],
	['PAGE','38129',jdecode('New+page'),jdecode(''),'/38129.html','true',[],'']];
var siteelementCount=11;
theSitetree.topTemplateName='Porthole';
theSitetree.paletteFamily='064B91';
theSitetree.keyvisualId='6730';
theSitetree.keyvisualName='kv_6730.jpg';
theSitetree.fontsetId='11200';
theSitetree.graphicsetId='12013';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E9F3FF';
var theTemplate={
				name: 			'Porthole',
				paletteFamily: 	'064B91',
				keyvisualId: 	'6730',
				keyvisualName: 	'kv_6730.jpg',
				fontsetId: 		'11200',
				graphicsetId: 	'12013',
				contentColor: 	'000000',
				contentBGColor: 'E9F3FF',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'000000',
				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:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '88',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '88',
internalId:  '',
customField: '20090329-123008'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '243',
internalId:  '',
customField: '20090329-191553'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '225',
internalId:  '',
customField: '20090216-200442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5701',
internalId:  '',
customField: '20090329-133106'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8801',
internalId:  '',
customField: '20090216-181146'
};
webappMappings['5003']=webappMappings['5003-tid:1;pid:WSCSYSSSSLYTCPXC']={
webappId:    '5003',
documentId:  '88',
internalId:  'tid:1;pid:WSCSYSSSSLYTCPXC',
customField: 'en:US::;language:en;country:US;'
};
webappMappings['1501']=webappMappings['1501-4238856']={
webappId:    '1501',
documentId:  '88',
internalId:  '4238856',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14201',
internalId:  '',
customField: '20090216-194041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14222',
internalId:  '',
customField: '20090216-194041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14243',
internalId:  '',
customField: '20090329-183428'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14264',
internalId:  '',
customField: '20090216-194041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14285',
internalId:  '',
customField: '20090216-194041'
};
webappMappings['7050']=webappMappings['7050-670']={
webappId:    '7050',
documentId:  '38129',
internalId:  '670',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38129',
internalId:  '',
customField: '20090405-125820'
};
var canonHostname = 'wsc-worker03.chi.us.siteprotect.com';
var accountId     = 'AHW050IN3EVF';
var companyName   = 'Cancun+Casa%2C+a+Visitor%27s+Guide+to+Cancun';
var htmlTitle	  = 'Cancun+Casa%2C+A+Virtual+Visitor%27s+Guide+to+Cancun';
var metaKeywords  = 'Cancun+Casa%2C+visitor%2C+tourist%2C+guide%2C+Mexico%2C+Beaches%2C+Blog%2C+Cenotes%2C+Cancun+Airport%2C+Dangers+Hotels%2C+Insider+Tips%2C+Islands%2C+Maya+Ruins%2C+Nightclubs%2C+Restaurants%2CScuba%2C+Snorkeling%2C+Tropical%2C+Weather%2CHurricanes%2C+Vacations%2C+Mexican%2C+Caribbean%2C+Isla+Mujeres%2C+Playa+Del+Carmen%2C+Cozumel%2CTulum%2CChichen+Itza+';
var metaContents  = 'Cancun+Casa+is+a+virtual+visitor+and+tourist+guide+and+Dangers+Blog+to+Cancun%2C+Mexico+focusing+on+Beaches%2C+Cenotes%2C+the+Cancun+Airport%2C+Hotels%2C+Insider+Tips%2C+Islands%2C+Maya+Ruins%2C+Nightclubs%2C+Restaurants%2CScuba+and+Snorkeling%2C+Tropical+Weather+including+Hurricanes%2C+and+Vacations+in+and+around+the+Mexican+Caribbean+from+Isla+Mujeres+to+Playa+Del+Carmen+to+Cozumel+to+Tulum+and+Chichen+Itza.+';
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();
};

