/* [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','401',jdecode('Familien-Hompage'),jdecode(''), jdecode('%2F401.html'), 'true',[],'',''],
	['PAGE','11222',jdecode('Meine+Familie'),jdecode(''), jdecode('%2F11222.html'), 'true',[],'',''],
	['PAGE','515',jdecode('Wir+%C3%BCber+uns'),jdecode(''), jdecode('%2F515.html'), 'true',[],'',''],
	['PAGE','155801',jdecode('Fotos+Berlin+2011'),jdecode(''), jdecode('%2F155801.html'), 'true',[],'',''],
	['PAGE','20601',jdecode('Wer+bin+ich'),jdecode(''), jdecode('%2F20601.html'), 'true',[],'',''],
	['PAGE','2006',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F2006.html'), 'true',[],'',''],
	['PAGE','11243',jdecode('Interessante+Links'),jdecode(''), jdecode('%2F11243.html'), 'true',[],'',''],
	['PAGE','105101',jdecode('Spezialfotos'),jdecode(''), jdecode('%2F105101.html'), 'true',[],'',''],
	['PAGE','107801',jdecode('Anfragen'),jdecode(''), jdecode('%2F107801.html'), 'true',[],'',''],
	['PAGE','172201',jdecode('Hotel+Titanic+Lara+Antalya'),jdecode(''), jdecode('%2F172201.html'), 'true',[],'','']];
var siteelementCount=10;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='2FAF66';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10381';
theSitetree.graphicsetId='10565';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Circulation',
				paletteFamily: 	'2FAF66',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10381',
				graphicsetId: 	'10565',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-2006abw0x0in27ci']={
webappId:    '1002',
documentId:  '2006',
internalId:  '2006abw0x0in27ci',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20120110-225557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '2006',
internalId:  '',
customField: '20061114-120124'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '515',
internalId:  '',
customField: '20120110-230031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '107801',
internalId:  '',
customField: '20090306-230742'
};
webappMappings['7008']=webappMappings['7008-2196']={
webappId:    '7008',
documentId:  '107801',
internalId:  '2196',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '105101',
internalId:  '',
customField: '20090307-231524'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11222',
internalId:  '',
customField: '20120110-230533'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11243',
internalId:  '',
customField: '20090306-140858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20601',
internalId:  '',
customField: '20120110-161829'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['7060']=webappMappings['7060-88416b6fa333a83505d7dba9aa9d7cc5']={
webappId:    '7060',
documentId:  '155801',
internalId:  '88416b6fa333a83505d7dba9aa9d7cc5',
customField: 'language:de;country:CH;'
};
webappMappings['1003']=webappMappings['1003-abw0x0in27ci134c7b00b3e']={
webappId:    '1003',
documentId:  '401',
internalId:  'abw0x0in27ci134c7b00b3e',
customField: 'de:CH'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '155801',
internalId:  '-',
customField: '20120110-160505'
};
webappMappings['7060']=webappMappings['7060-d9144058b5f50bd6df3ade5a5df1dd5f']={
webappId:    '7060',
documentId:  '172201',
internalId:  'd9144058b5f50bd6df3ade5a5df1dd5f',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000--']={
webappId:    '5000',
documentId:  '172201',
internalId:  '-',
customField: '20120122-203750'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN27CI';
var companyName   = 'Rolf+Kretz';
var htmlTitle	  = 'Rolf+Kretz+';
var metaKeywords  = '';
var metaContents  = '';
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();
};

