/* [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','4473',jdecode('Home'),jdecode(''),'/4473/index.html','true',[ 
		['PAGE','8573',jdecode('Home+%28Folgeseite%29'),jdecode(''),'/4473/8573.html','false',[],'','']
	],'',''],
	['PAGE','4745',jdecode('Rosenschau'),jdecode(''),'/4745.html','true',[],'',''],
	['PAGE','52899',jdecode('Rosenwoche+2011'),jdecode(''),'/52899.html','true',[],'',''],
	['PAGE','4961',jdecode('Konzerte'),jdecode(''),'/4961.html','true',[],'',''],
	['PAGE','7429',jdecode('Ausstellungen'),jdecode(''),'/7429.html','true',[],'',''],
	['PAGE','7456',jdecode('Unsere+Partner'),jdecode(''),'/7456.html','true',[],'',''],
	['PAGE','4880',jdecode('Events'),jdecode(''),'/4880.html','true',[],'',''],
	['PAGE','21574',jdecode('Nachtw%C3%A4chterei'),jdecode(''),'/21574.html','true',[],'',''],
	['PAGE','5096',jdecode('Kontaktadresse'),jdecode(''),'/5096/index.html','true',[ 
		['PAGE','6273',jdecode('G%C3%A4stebuch'),jdecode(''),'/5096/6273.html','true',[],'',''],
		['PAGE','6274',jdecode('Eintr%C3%A4ge'),jdecode(''),'/5096/6274.html','false',[],'','']
	],'',''],
	['PAGE','43518',jdecode('Medien%2FPresse'),jdecode(''),'/43518.html','true',[],'',''],
	['PAGE','52645',jdecode('Bildergalerie'),jdecode(''),'/52645.html','true',[],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Roses';
theSitetree.paletteFamily='FFE5E5';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10743';
theSitetree.graphicsetId='10825';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFE5E5';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Roses',
				paletteFamily: 	'FFE5E5',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10743',
				graphicsetId: 	'10825',
				contentColor: 	'000000',
				contentBGColor: 'FFE5E5',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'787878',
				e_color: 		'9D584B',
				f_color: 		'9D584B',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4473',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4961',
internalId:  '',
customField: '20100619-074946'
};
webappMappings['1002']=webappMappings['1002-6273ABW0X0INXE69']={
webappId:    '1002',
documentId:  '6273',
internalId:  '6273ABW0X0INXE69',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4473',
internalId:  '',
customField: '20100628-082041'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7429',
internalId:  '',
customField: '20100406-154158'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4745',
internalId:  '',
customField: '20100611-145220'
};
webappMappings['7008']=webappMappings['7008-2831']={
webappId:    '7008',
documentId:  '4473',
internalId:  '2831',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7456',
internalId:  '',
customField: '20100528-071755'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4880',
internalId:  '',
customField: '20100421-054532'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '21574',
internalId:  '',
customField: '20100527-184445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '8573',
internalId:  '',
customField: '20040512-224931'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5096',
internalId:  '',
customField: '20090531-174719'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6273',
internalId:  '',
customField: '20080418-074446'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6274',
internalId:  '',
customField: '20031014-145900'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43518',
internalId:  '',
customField: '20080418-074523'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52645',
internalId:  '',
customField: '20100313-090657'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '52899',
internalId:  '',
customField: '20100416-171329'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INXE69';
var companyName   = 'Rosen-+und+Kulturwoche';
var htmlTitle	  = 'Bischofszeller+Rosen-+und+Kulturwoche+19.+bis+27.+Juni+2010';
var metaKeywords  = 'RosenwocheNachtw%C3%A4chterNachtw%C3%A4chterzunft';
var metaContents  = 'RosenNachtw%C3%A4chtereiRosenwoche+Bischofszell';
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();
};
