/* [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','4394',jdecode('Karaoke'),jdecode(''), jdecode('%2F4394.html'), 'true',[],'',''],
	['PAGE','1089327',jdecode('Kontaktformular'),jdecode(''), jdecode('%2F1089327.html'), 'true',[],'','']];
var siteelementCount=2;
theSitetree.topTemplateName='Party';
theSitetree.paletteFamily='0035E0';
theSitetree.keyvisualId='3519';
theSitetree.keyvisualName='kv_3519.jpg';
theSitetree.fontsetId='10441';
theSitetree.graphicsetId='10806';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='0035E0';
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: 			'Party',
				paletteFamily: 	'0035E0',
				keyvisualId: 	'3519',
				keyvisualName: 	'kv_3519.jpg',
				fontsetId: 		'10441',
				graphicsetId: 	'10806',
				contentColor: 	'FFFFFF',
				contentBGColor: '0035E0',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'E6FFAB',
				e_color: 		'E6FFAB',
				f_color: 		'E6FFAB',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4394',
internalId:  '1006',
customField: '1006'
};
webappMappings['1009']=webappMappings['1009-6738911']={
webappId:    '1009',
documentId:  '948427',
internalId:  '6738911',
customField: 'isFollowupPage:true;documentId:948360;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4394',
internalId:  '',
customField: '20120113-132336'
};
webappMappings['1009']=webappMappings['1009-5847407']={
webappId:    '1009',
documentId:  '948699',
internalId:  '5847407',
customField: 'isFollowupPage:true;documentId:948667;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '948427',
internalId:  '',
customField: '20060627-164402'
};
webappMappings['1009']=webappMappings['1009-6317129']={
webappId:    '1009',
documentId:  '776043',
internalId:  '6317129',
customField: 'isFollowupPage:true;documentId:774886;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '948699',
internalId:  '',
customField: '20060627-170313'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '776043',
internalId:  '',
customField: '20060216-031934'
};
webappMappings['7008']=webappMappings['7008-13213']={
webappId:    '7008',
documentId:  '1089327',
internalId:  '13213',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '1089327',
internalId:  '',
customField: '20111202-083830'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '4394',
internalId:  '',
customField: 'language:de;country:CH;'
};
webappMappings['5001']=webappMappings['5001-']={
webappId:    '5001',
documentId:  '1089327',
internalId:  '',
customField: 'language:de;country:CH;'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXSY7';
var companyName   = 'Alex%27s+Karaoke+-+Show';
var htmlTitle	  = 'Karaoke+in+der+Schweiz+%7C+Alex%27s+Karaoke+-+Show+Schweiz+mit+Alex+Wild+der+Karaoke+Entertainer+f%C3%BCr+Ihren+Anlass-Event+in+der+Schweiz';
var metaKeywords  = 'Karaoke+%2C+Attraktion+%2C+Show+%2C+Musik+%2C+Music+%2C+Fest+%2C+Feier+%2C+Event+%2C+Anlass+%2C+Geburtstag+%2C+Hochzeit+%2C+Disco+%2C+Dancing+%2C+Club+%2C+Lounge+%2C+Bar+%2C+Restaurant+%2C+Hotel+%2C+Party+%2C+Firmenevent+%2C+Mitarbeiterfest+%2C+Firmenjubilaeum+%2C+Jubilaeum+%2C+Ausstellung+%2C+Messe+%2C+Promotion+%2C+Personalabend+%2C+Weihnachtsessen+%2C+Festzeltanlass+%2C+Privatfest+%2C+Privatanlass+%2C+Firma+%2C+Personalanlass+%2C+Firmenanlass';
var metaContents  = 'Karaoke+DJ+Schweiz+Mitarbeiteranlass+%2C+Geburtstagsfest+%2C+Hochzeit+%2C+Weihnachtsfeier+%2C+Weihnachtsessen+Musik+Music+f%C3%BCr+ihren+Anlass+Event+Karaoke-Show+Schweiz+f%C3%BCr+Ihren+Event+mit+Alexs+Karaoke-Show++Personalfest+%2C+Firmenevent+%2C+Geburtstag+%2C+Vereinsanlass+%2C+Club+%2C+Dancing+%2C+Disco+%2C+Bar+%2C+Lounge+%2C+Stadtfest+%2C+Hochzeit';
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();
};

