/* [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','5401',jdecode('SUNDOWN%26%23x27%3BS++HOME+'),jdecode(''), jdecode('%2F5401.html'), 'true',[],'',''],
	['PAGE','7201',jdecode('+CHARTER+INFO'),jdecode(''), jdecode('%2F7201.html'), 'true',[],'',''],
	['PAGE','97971',jdecode('++NEW+PHOTOS'),jdecode(''), jdecode('%2F97971.html'), 'true',[],'',''],
	['PAGE','7243',jdecode('FULLDAY+OFFSHORE'),jdecode(''), jdecode('%2F7243.html'), 'true',[],'',''],
	['PAGE','15953',jdecode('HALF+DAY+INSHORE'),jdecode(''), jdecode('%2F15953.html'), 'true',[],'',''],
	['PAGE','32453',jdecode('RECENT+PHOTOS'),jdecode(''), jdecode('%2F32453.html'), 'true',[],'',''],
	['PAGE','117719',jdecode('SUNDOWN+T-SHIRTS'),jdecode(''), jdecode('%2F117719.html'), 'true',[],'',''],
	['PAGE','7601',jdecode('%22Charter+Request+Form%22'),jdecode(''), jdecode('%2F7601.html'), 'true',[],'',''],
	['PAGE','7222',jdecode('+BOAT+PICS'),jdecode(''), jdecode('%2F7222.html'), 'true',[],'',''],
	['PAGE','7285',jdecode('+CONTACT+US'),jdecode(''), jdecode('%2F7285.html'), 'true',[],'',''],
	['PAGE','79262',jdecode('MOTEL+LISTINGS'),jdecode(''), jdecode('%2F79262.html'), 'true',[],'',''],
	['PAGE','19653',jdecode('WEATHER+LINKS'),jdecode(''), jdecode('%2F19653.html'), 'true',[],'',''],
	['PAGE','50753',jdecode('FACEBOOK+LINK'),jdecode(''), jdecode('%2F50753.html'), 'true',[],'',''],
	['PAGE','37053',jdecode('HATTERAS+MAP'),jdecode(''), jdecode('%2F37053.html'), 'true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Caribic';
theSitetree.paletteFamily='7050FA';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10419';
theSitetree.graphicsetId='10707';
theSitetree.contentColor='FDFBA6';
theSitetree.contentBGColor='B63636';
var localeDef={
  language: 'en',
  country: 'US'
};
var prodDef={
  wl_name: 'hostway_generic',
  product: 'WSCSYSSSSLYTC245'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Caribic',
				paletteFamily: 	'7050FA',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10419',
				graphicsetId: 	'10707',
				contentColor: 	'FDFBA6',
				contentBGColor: 'B63636',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5401',
internalId:  '',
customField: '20111225-071231'
};
webappMappings['7060']=webappMappings['7060-772c56568722270a85b08eef56bca5e5']={
webappId:    '7060',
documentId:  '32453',
internalId:  '772c56568722270a85b08eef56bca5e5',
customField: 'language:en;country:US;'
};
webappMappings['7060']=webappMappings['7060-2a42a67d1a6d09b495c7b784c8da3f0a']={
webappId:    '7060',
documentId:  '7243',
internalId:  '2a42a67d1a6d09b495c7b784c8da3f0a',
customField: 'language:en;country:US;'
};
webappMappings['7008']=webappMappings['7008-6641']={
webappId:    '7008',
documentId:  '7601',
internalId:  '6641',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7601',
internalId:  '',
customField: '20110330-101555'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7243',
internalId:  '',
customField: '20111107-101137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7285',
internalId:  '',
customField: '20111107-102628'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20111107-102304'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7222',
internalId:  '',
customField: '20110330-102801'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5401',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19653',
internalId:  '',
customField: '20110809-130712'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15953',
internalId:  '',
customField: '20111107-101221'
};
webappMappings['7060']=webappMappings['7060-a97b84f5499b20e947c457dc410a90d1']={
webappId:    '7060',
documentId:  '15953',
internalId:  'a97b84f5499b20e947c457dc410a90d1',
customField: 'language:en;country:US;'
};
webappMappings['1501']=webappMappings['1501-6479643']={
webappId:    '1501',
documentId:  '5401',
internalId:  '6479643',
customField: '1501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '32453',
internalId:  '',
customField: '20110418-164425'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50753',
internalId:  '',
customField: '20110330-103034'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '79262',
internalId:  '',
customField: '20110330-102916'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '97971',
internalId:  '',
customField: '20111202-151653'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '37053',
internalId:  'location',
customField: 'language:en;country:US;isIncluded:true;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '37053',
internalId:  '',
customField: '20110330-103109'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '117719',
internalId:  '',
customField: '20110706-130016'
};
var webAppHostname = 'cgi-wsc.chi.us.siteprotect.com:80';
var canonHostname = 'wsc-worker04.chi.us.siteprotect.com';
var accountId     = 'AHW050INZ49P';
var companyName   = 'SUNDOWN+CHARTER+FISHING+HATTERAS';
var htmlTitle	  = '';
var metaKeywords  = 'hatteras%2C+charters%2Cfishing%2Coffshore%2Cnorth+carolina%2C';
var metaContents  = 'offshore+charter+fishing%2C+north+carolina+charter+fishing+%2Couter+banks+charter+fishing%2Chatteras+charter+fishing%2Chatteras+harbor+fishing';
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();
};

