/* [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','5501',jdecode('Home'),jdecode(''),'/5501.html','true',[],'',''],
	['PAGE','46212',jdecode('Bachelor+Parties+and+More'),jdecode(''),'/46212.html','true',[],'',''],
	['PAGE','41212',jdecode('Weekly+Happenings'),jdecode(''),'/41212.html','true',[],'',''],
	['PAGE','5552',jdecode('Bands+and+Events'),jdecode(''),'/5552.html','true',[],'',''],
	['PAGE','44712',jdecode('BEER+PONG%21%21%21%21'),jdecode(''),'/44712.html','true',[],'',''],
	['PAGE','38612',jdecode('Photos'),jdecode(''),'/38612.html','true',[],'',''],
	['PAGE','15112',jdecode('Menu'),jdecode(''),'/15112.html','true',[],'',''],
	['PAGE','5573',jdecode('Location'),jdecode(''),'/5573.html','true',[],'',''],
	['PAGE','14212',jdecode('In+Loving+Memory'),jdecode(''),'/14212.html','true',[],'',''],
	['PAGE','36812',jdecode('Get+our+updates+by+EMAIL'),jdecode(''),'/36812.html','true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Displace';
theSitetree.paletteFamily='2E2E2E';
theSitetree.keyvisualId='11075';
theSitetree.keyvisualName='kv_11075.jpg';
theSitetree.fontsetId='31958';
theSitetree.graphicsetId='13798';
theSitetree.contentColor='D8D8D5';
theSitetree.contentBGColor='2E2E2E';
var localeDef={
  language: 'en',
  country: 'US'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Displace',
				paletteFamily: 	'2E2E2E',
				keyvisualId: 	'11075',
				keyvisualName: 	'kv_11075.jpg',
				fontsetId: 		'31958',
				graphicsetId: 	'13798',
				contentColor: 	'D8D8D5',
				contentBGColor: '2E2E2E',
				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:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5501',
internalId:  '',
customField: '20100701-150823'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14212',
internalId:  '',
customField: '20100701-134844'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5573',
internalId:  '',
customField: '20100128-154509'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5552',
internalId:  '',
customField: '20100907-122501'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '41212',
internalId:  '',
customField: '20100802-194009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15112',
internalId:  '',
customField: '20090707-130008'
};
webappMappings['1501']=webappMappings['1501-21870699']={
webappId:    '1501',
documentId:  '5501',
internalId:  '21870699',
customField: '1501'
};
webappMappings['7008']=webappMappings['7008-23423']={
webappId:    '7008',
documentId:  '36812',
internalId:  '23423',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36812',
internalId:  '',
customField: '20091122-204559'
};
webappMappings['7060']=webappMappings['7060-9df9579c11129cd59c55779ea233920e']={
webappId:    '7060',
documentId:  '38612',
internalId:  '9df9579c11129cd59c55779ea233920e',
customField: 'language:en;country:US;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38612',
internalId:  '',
customField: '20091130-164404'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '44712',
internalId:  '',
customField: '20100315-194641'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '46212',
internalId:  '',
customField: '20100822-193607'
};
var canonHostname = 'cmworker03.yourhostingaccount.com';
var accountId     = 'AENDU0IN30KY';
var companyName   = 'Ball%27s+Sports+Bar+and+Grille';
var htmlTitle	  = 'Ball%27s+Sports+Bar+and+Grille';
var metaKeywords  = '';
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();
};
