/* [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','301',jdecode('Home'),jdecode(''), jdecode('%2F301.html'), 'true',[],'',''],
	['PAGE','4701',jdecode('Big+Ben+Pub'),jdecode(''), jdecode('%2F4701.html'), 'true',[],'',''],
	['PAGE','4722',jdecode('Pizzeria+'),jdecode(''), jdecode('%2F4722.html'), 'true',[],'',''],
	['PAGE','4743',jdecode('Caff%C3%A8Lounge'),jdecode(''), jdecode('%2F4743.html'), 'true',[],'',''],
	['PAGE','4764',jdecode('Events'),jdecode(''), jdecode('%2F4764.html'), 'true',[],'',''],
	['PAGE','9101',jdecode('LPP-Membership'),jdecode(''), jdecode('%2F9101.html'), 'true',[],'',''],
	['PAGE','4785',jdecode('Kontakt'),jdecode(''), jdecode('%2F4785%2Findex.html'), 'true',[ 
		['PAGE','15301',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''), jdecode('%2F4785%2F15301.html'), 'true',[],'','']
	],'',''],
	['PAGE','9122',jdecode('Jobs'),jdecode(''), jdecode('%2F9122.html'), 'true',[],'',''],
	['PAGE','31406',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F31406%2Findex.html'), 'true',[ 
		['PAGE','31401',jdecode('Eintr%C3%A4ge'),jdecode(''), jdecode('%2F31406%2F31401.html'), 'true',[],'','']
	],'',''],
	['PAGE','34101',jdecode('Bilderarchiv'),jdecode(''), jdecode('%2F34101.html'), 'true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Eatdrink';
theSitetree.paletteFamily='AF8F56';
theSitetree.keyvisualId='3364';
theSitetree.keyvisualName='kv_3364.jpg';
theSitetree.fontsetId='10425';
theSitetree.graphicsetId='10740';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Eatdrink',
				paletteFamily: 	'AF8F56',
				keyvisualId: 	'3364',
				keyvisualName: 	'kv_3364.jpg',
				fontsetId: 		'10425',
				graphicsetId: 	'10740',
				contentColor: 	'000000',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'47320C',
				e_color: 		'47320C',
				f_color: 		'47320C',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '34101',
internalId:  '',
customField: '20091108-191934'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '301',
internalId:  '1006',
customField: '1006'
};
webappMappings['1002']=webappMappings['1002-31406abw0x0inekzk']={
webappId:    '1002',
documentId:  '31406',
internalId:  '31406abw0x0inekzk',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '301',
internalId:  '',
customField: '20111109-172948'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4764',
internalId:  '',
customField: '20111212-161638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4701',
internalId:  '',
customField: '20111109-182023'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31406',
internalId:  '',
customField: '20081214-135922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4722',
internalId:  '',
customField: '20111109-185151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4743',
internalId:  '',
customField: '20111109-184517'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9101',
internalId:  '',
customField: '20111109-185601'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4785',
internalId:  '',
customField: '20080205-140421'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '15301',
internalId:  '',
customField: '20080114-143332'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9122',
internalId:  '',
customField: '20101108-141624'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '31401',
internalId:  '',
customField: '20081214-135922'
};
webappMappings['7008']=webappMappings['7008-4223']={
webappId:    '7008',
documentId:  '4785',
internalId:  '4223',
customField: 'language:de;country:CH;'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INEKZK';
var companyName   = 'Herzlich+willkommen+im+Limone%27s%21';
var htmlTitle	  = 'Limone%27s+-+Big+Ben+Pub+-+Pizzeria+-+Caff%C3%A8Lounge%2C+9050+Appenzell';
var metaKeywords  = 'Big+Ben+Pub%2C+Pizzeria%2C+Caff%C3%A8Lounge%2C+Limone%27s%2C+Bankgasse+6%2C+9050+Appenzell%2C+Restaurant%2C+Pizzeria%2C+Mittagsmenu%2C+Grapperia%2C+Sonnenterrasse%2C+Wireless+Lan%2C+Pizza+und+Kaffe+to+go%2C+Michele+%26+Daniele+Limone-Weibel';
var metaContents  = 'Limone%27s+-+Big+Ben+Pub+-+Pizzeria+-+Caff%C3%A8Lounge+%2F+Pizza+to+go%2C+Sonnenterrasse%2C+Guinness+im+Offenausschank.+Dienstag+%26+Mittwoch+Ruhetag+%2F+Tel.+%2B41+71+787+41+22+%2F+info%40limones-bigben.ch';
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();
};

