/* [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','2001',jdecode('Cabo+Fish+Dogs'),jdecode(''),'/2001.html','true',[],'',''],
	['PAGE','2101',jdecode('BOATS+%26+Services'),jdecode(''),'/2101.html','true',[],'',''],
	['PAGE','2122',jdecode('Contact+US%2FPricing'),jdecode(''),'/2122.html','true',[],'','']];
var siteelementCount=3;
theSitetree.topTemplateName='Grace';
theSitetree.paletteFamily='FBB044';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='32049';
theSitetree.graphicsetId='13869';
theSitetree.contentColor='484848';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Grace',
				paletteFamily: 	'FBB044',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'32049',
				graphicsetId: 	'13869',
				contentColor: 	'484848',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['8010']=webappMappings['8010-197']={
webappId:    '8010',
documentId:  '2001',
internalId:  '197',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-3719']={
webappId:    '7008',
documentId:  '2122',
internalId:  '3719',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2001',
internalId:  '',
customField: '20100926-201541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2101',
internalId:  '',
customField: '20100926-200814'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '2001',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2122',
internalId:  '',
customField: '20100926-201131'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2001',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2101',
internalId:  '',
customField: 'language:en;country:US;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '2122',
internalId:  '',
customField: 'language:en;country:US;'
};
var canonHostname = 'wscwrk02.ehost-services.com';
var accountId     = 'AEN340INFVJX';
var companyName   = 'Got+Caught+In+Cabo+Charters%3B+%28Cabo+Fish+Dogs%29';
var htmlTitle	  = 'Cabo%27s+Most+Honest%2C+Effective+and+Safe+Charter+Service';
var metaKeywords  = 'baja+california+fishing%2C%0Abaja+fishing+mexico%2C%0Abaja+fishing+report%2C%0Abaja+fishing%2C%0ABaja+Raider%2C%0ABaja+Raiders%0Abaja+sport+fishing+%2C%0ABajaRaider%2C%0ABajaRaiders%2C%0Abisbee%2C%0Ablue+marlin+fishing+in+cabo%2C%0Ablue+marlin+fishing%2C%0Acabo+charters%2C%0Acabo+fish+dogs%2C%0Acabo+fish+tournaments%2C%0Acabo+fishing+charter%2C%0ACabo+Fishing+Charters%2C%0Acabo+fishing+report%2C%0ACabo+Fishing+Tournament%2C%0Acabo+fishing+tournaments%2C%0Acabo+fishing%2C%0Acabo+fishing%2C%0ACabo+Magic+sport+fishing%2C%0Acabo+marlin+fishing%2C%0Acabo+properties%2C%0Acabo+real+estate%2C%0Acabo+san+lucas+charter+fishing%2C%0Acabo+san+lucas+deep+sea+fishing%2C%0Acabo+san+lucas+fishing+report%2C%0Acabo+san+lucas+fishing%2C%0Acabo+san+lucas+mexico+fishing%2C%0Acabo+san+lucas+Mexico%2C%0Acabo+san+lucas+sport+fishing%2C%0Acabo+san+lucas%2C%0Acabo+san+lucas%2C%0Acabo+sport+fishing%2C%0Acabo+sports+fishing%2C%0Acabo+sportsfishing%2C%0ACabo+tuna+tournament%0Acabo%2C%0Acharters+in+cabo%2C%0Adeep+sea+fishing+mexico%2C%0Adorado+fishing+in+cabo%2C%0Adorado+fishing%2C%0AEl+Budster%0AEl+Budster+charter+fishing%0AEl+Budster+charters%0AFiesta+Sport+Fishing%2C%0AFiesta+SportFishing%2C%0Afishing+charters+in+cabo%2C%0AFishing+Charters%2C%0Afishing+in+cabo+san+lucas%2C%0Afishing+in+cabo%2C%0Afishing+trip+mexico%2C%0Afly+fishing+baja%2C%0ALos+Cabo%27s+Fishing%2C%0Amarlin+fishing+cabo%2C%0Amarlin+fishing%2C%0Amexico+fishing+trip%2C%0APicante+sport+fishing%2C%0APicante+Sport%2C%0APicante+sportfishing%2C%0APisces+sport+fishing%2C%0APisces+sport%2C%0APisces+sportfishing%2C%0Areal+estate+in+cabo+fishing+boats%2C%0ARed+Rum+Cabo%2C%0ARed+Rum+Sport+fishing%2C%0ARed+Rum+Sportfishing%2C%0ARed+Rum%2C%0ARedRum%2C%0ARedRumCabo%2C%0ARenegade+Mike%0ARenegade+mike+Sport+fishing%0ARenegade+Mike+Sportfishing%0Asea+of+cortez+fishing%2C%0Asilverado+sport+fishing%2C%0Asilverado+sport%2C%0Asilverado+sportfishing%2C%0Asilverados+sport+fishing%2C%0ASilverados+sport%2C%0Asilverados+sportfishing%2C%0Asport+fishing+boats+in+Cabo%2C%0Astripe+marlin+fishing+in+cabo%2C%0Astripe+marlin+fishing%2C%0Astriped+marlin+fishing+in+cabo%2C%0Astriped+marlin+fishing%2C%0ATodd+Hochstedler%2C%0ATuna+fishing+in+cabo%2C%0Atuna+fishing%2C%0Atuna+tournament%2C%0Awon+tuna+fishing+tournament%2C%0AWON+tuna+tournament%2C%0A';
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();
};

