/* [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','4664',jdecode('HOME'),jdecode(''), jdecode('%2F4664.html'), 'true',[],'',''],
	['PAGE','4607',jdecode('Wir+%C3%BCber+uns'),jdecode(''), jdecode('%2F4607.html'), 'true',[],'',''],
	['PAGE','14201',jdecode('Aktuell'),jdecode(''), jdecode('%2F14201.html'), 'true',[],'',''],
	['PAGE','4718',jdecode('Termine'),jdecode(''), jdecode('%2F4718.html'), 'true',[],'',''],
	['PAGE','4745',jdecode('Fotos'),jdecode(''), jdecode('%2F4745.html'), 'true',[],'',''],
	['PAGE','5080',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F5080%2Findex.html'), 'true',[ 
		['PAGE','5081',jdecode('Eintr%C3%A4ge'),jdecode(''), jdecode('%2F5080%2F5081.html'), 'false',[],'','']
	],'',''],
	['PAGE','8001',jdecode('Fanclub+%2F+Kontakt+'),jdecode(''), jdecode('%2F8001.html'), 'true',[],'','']];
var siteelementCount=8;
theSitetree.topTemplateName='Blues';
theSitetree.paletteFamily='FC0707';
theSitetree.keyvisualId='2758';
theSitetree.keyvisualName='zieh.jpg';
theSitetree.fontsetId='10569';
theSitetree.graphicsetId='10701';
theSitetree.contentColor='0208FB';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2QE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Blues',
				paletteFamily: 	'FC0707',
				keyvisualId: 	'2758',
				keyvisualName: 	'zieh.jpg',
				fontsetId: 		'10569',
				graphicsetId: 	'10701',
				contentColor: 	'0208FB',
				contentBGColor: 'FFFFFF',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FC0707',
				e_color: 		'FC0707',
				f_color: 		'FC0707',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4664',
internalId:  '',
customField: '20111227-111856'
};
webappMappings['1002']=webappMappings['1002-5080ABW0X0INXSH5']={
webappId:    '1002',
documentId:  '5080',
internalId:  '5080ABW0X0INXSH5',
customField: 'icq=false'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4664',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4607',
internalId:  '',
customField: '20111227-112225'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14201',
internalId:  '',
customField: '20111227-112236'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4718',
internalId:  '',
customField: '20120118-212151'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4745',
internalId:  '',
customField: '20111229-094323'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5080',
internalId:  '',
customField: '20120115-164136'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5081',
internalId:  '',
customField: '20041228-160148'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8001',
internalId:  '',
customField: '20080831-100322'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXSH5';
var companyName   = 'PAOLOS+FRICKTAL+KRAINER';
var htmlTitle	  = 'PAOLOs+FRICKTAL+KRAINER';
var metaKeywords  = 'Oberkrainer%2C+Fr%C3%BChschoppen%2C+Stimmung%2C+Bariton%2C+Akkordeon%2C+Zeltfest%2C+Fetzig%2C';
var metaContents  = 'Paolos+Fricktal+Krainer%2C+die+Top-Unterhalter+aus+dem+Fricktal+%2F+Schweiz+begeistern+mit+starker%2C+fetziger+Oberkrainermusik.+Ideal+zum+feiern%2C+tanzen+und+geniessen.+Alles+live%2C+alles+echt.+Die+Spezialisten+f%C3%BCr+Fr%C3%BChschoppen%2C+Firmen-+und+Vereinsanlaesse.';
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();
};

