/* [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','3101',jdecode('Home'),jdecode(''),'/3101.html','true',[],'',''],
	['PAGE','40101',jdecode('zum+adoptieren'),jdecode(''),'/40101.html','true',[],'',''],
	['PAGE','3173',jdecode('adoptierte'),jdecode(''),'/3173.html','true',[],'',''],
	['PAGE','3152',jdecode('G%C3%A4stebuch'),jdecode(''),'/3152.html','true',[],'',''],
	['PAGE','3401',jdecode('Kontakt'),jdecode(''),'/3401.html','true',[],'',''],
	['PAGE','3194',jdecode('Ausstellungen'),jdecode(''),'/3194.html','true',[],'',''],
	['PAGE','3422',jdecode('Links'),jdecode(''),'/3422.html','true',[],'',''],
	['PAGE','42201',jdecode('%D0%91%D0%B0%D0%BB%D0%B5%D1%80%D0%B8%D0%BD%D0%B0'),jdecode(''),'/42201.html','false',[],'',''],
	['PAGE','42222',jdecode('%D0%BF%D1%80%D0%AB%D0%BD%D1%86%D0%B5%D1%81%D1%81%D0%B0'),jdecode(''),'/42222.html','false',[],'',''],
	['PAGE','43101',jdecode('%D0%94%D0%B6%D0%B5%D0%B9%D0%BC%D1%81'),jdecode(''),'/43101.html','false',[],'',''],
	['PAGE','43901',jdecode('%D0%95%D1%84%D0%B8%D0%BC'),jdecode(''),'/43901.html','false',[],'','']];
var siteelementCount=11;
theSitetree.topTemplateName='Undulate';
theSitetree.paletteFamily='4A2F10';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='33118';
theSitetree.graphicsetId='14068';
theSitetree.contentColor='BA9F80';
theSitetree.contentBGColor='4A2F10';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Undulate',
				paletteFamily: 	'4A2F10',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'33118',
				graphicsetId: 	'14068',
				contentColor: 	'BA9F80',
				contentBGColor: '4A2F10',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3101',
internalId:  '',
customField: '20100608-212112'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3152',
internalId:  '',
customField: '20091027-141740'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '3101',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3173',
internalId:  '',
customField: '20100611-123529'
};
webappMappings['1002']=webappMappings['1002-3152abw330ine8it']={
webappId:    '1002',
documentId:  '3152',
internalId:  '3152abw330ine8it',
customField: 'icq=false'
};
webappMappings['7008']=webappMappings['7008-6894']={
webappId:    '7008',
documentId:  '3401',
internalId:  '6894',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43901',
internalId:  '',
customField: '20100611-144637'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3422',
internalId:  '',
customField: '20091027-134557'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3401',
internalId:  '',
customField: '20091027-140607'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '3194',
internalId:  '',
customField: '20100608-221144'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40101',
internalId:  '',
customField: '20100611-144805'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '43101',
internalId:  '',
customField: '20100611-143247'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42201',
internalId:  '',
customField: '20100611-141143'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42222',
internalId:  '',
customField: '20100611-141010'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW330INE8IT';
var companyName   = '+%22Funny+Mani+Toys%22';
var htmlTitle	  = 'Teddy+%2COlena+Mani%2CTeddyB%C3%A4r%2CMani+Olena%2C%D0%9C%D0%B0%D0%BD%D0%B8+%D0%9E%D0%BB%D0%B5%D0%BD%D0%B0%2C%D0%9C%D0%B0%D0%BD%D0%B8+%D0%95%D0%BB%D0%B5%D0%BD%D0%B0';
var metaKeywords  = '';
var metaContents  = 'Teddy+%2COlena+Mani%2CTeddyB%C3%A4r';
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();
};
