/* [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','5001',jdecode('Home'),jdecode(''),'/5001.html','true',[],'',''],
	['PAGE','5052',jdecode('Leistungen'),jdecode(''),'/5052.html','true',[],'',''],
	['PAGE','5073',jdecode('Kontakt'),jdecode(''),'/5073.html','true',[],'',''],
	['PAGE','5094',jdecode('Links+%26+Partner'),jdecode(''),'/5094.html','true',[],'',''],
	['PAGE','5901',jdecode('G%C3%A4stebuch'),jdecode(''),'/5901.html','true',[],'','']];
var siteelementCount=5;
theSitetree.topTemplateName='Disco';
theSitetree.paletteFamily='62213C';
theSitetree.keyvisualId='1866';
theSitetree.keyvisualName='party01.jpg';
theSitetree.fontsetId='307';
theSitetree.graphicsetId='366';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='62213C';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Disco',
				paletteFamily: 	'62213C',
				keyvisualId: 	'1866',
				keyvisualName: 	'party01.jpg',
				fontsetId: 		'307',
				graphicsetId: 	'366',
				contentColor: 	'FFFFFF',
				contentBGColor: '62213C',
				a_color: 		'62213C',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['7008']=webappMappings['7008-1413']={
webappId:    '7008',
documentId:  '5073',
internalId:  '1413',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20090928-231622'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5073',
internalId:  '',
customField: '20090928-225443'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5052',
internalId:  '',
customField: '20090928-225653'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5094',
internalId:  '',
customField: '20090928-230319'
};
webappMappings['1002']=webappMappings['1002-5901ahp340inv561']={
webappId:    '1002',
documentId:  '5901',
internalId:  '5901ahp340inv561',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5901',
internalId:  '',
customField: '20090928-225929'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '5001',
internalId:  '1006',
customField: '1006'
};
var canonHostname = 'webomat02.hostpoint.ch';
var accountId     = 'AHP340INV561';
var companyName   = 'Der+perfekte+Polterabend';
var htmlTitle	  = 'Der+perfekte+Polterabend+-+Wir+organisieren+-+Sie+feiern';
var metaKeywords  = 'Junggesellenabschied%2C+Junggesellenabend%2C+Spr%C3%BCche%2C+Aufgaben%2C+Spiele%2C+T-Shirt%2C+T-Shirts%2C+Ideen%2C+Tips%2C+Tipps%2C+Verkleidung%2C+Polterabend%2C+Br%C3%A4utigam%2C+Party%2C+Verabschiedung%2C+Junggeselle%2C+Strupperin%2C+Limousine%2C+Essen%2C+Trinken%2C+Restaurant%2C+Reservation%2C+Club%2C+Disco%2C+Fete';
var metaContents  = 'Wir+organisieren+Ihren+individuellen+Polterabend%21+Vorschl%C3%A4ge+f%C3%BCr+Aufgaben+und+Spiele%2C+Reservationen+in+Clubs+und+Restaurants%2C+StripperInnen-Bookings%2C+passende+T-Shirts...+alles+was+es+braucht+um+den+perfekten+Junggesellenabend+zu+geniessen+-+wir+besorgen+es%21';
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();
};
