/* [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 theSitetree=[ 
	['PAGE','4518',jdecode('Home'),jdecode(''),'/4518.html','true',[],''],
	['PAGE','4982',jdecode('Infos'),jdecode(''),'/4982.html','true',[],''],
	['PAGE','5009',jdecode('Bilder'),jdecode(''),'/5009.html','true',[],''],
	['PAGE','42601',jdecode('Bilder'),jdecode(''),'/42601.html','true',[],''],
	['PAGE','5036',jdecode('Haltung'),jdecode(''),'/5036.html','true',[],''],
	['PAGE','5063',jdecode('Verkauf'),jdecode(''),'/5063.html','true',[],''],
	['PAGE','5090',jdecode('Anfahrt'),jdecode(''),'/5090.html','true',[],''],
	['PAGE','5117',jdecode('Kontakt'),jdecode(''),'/5117.html','true',[],''],
	['PAGE','14703',jdecode('Links'),jdecode(''),'/14703.html','true',[],''],
	['PAGE','6102',jdecode('G%C3%A4stebuch'),jdecode(''),'/6102.html','true',[],''],
	['PAGE','6103',jdecode('Eintr%C3%A4ge'),jdecode(''),'/6103.html','true',[],''],
	['PAGE','54601',jdecode('Film'),jdecode(''),'/54601.html','true',[],'']];
var siteelementCount=12;
theSitetree.topTemplateName='Movement';
theSitetree.paletteFamily='AC2323';
theSitetree.keyvisualId='1737';
theSitetree.keyvisualName='blumen.jpg';
theSitetree.fontsetId='289';
theSitetree.graphicsetId='356';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='AC2323';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				name: 			'Movement',
				paletteFamily: 	'AC2323',
				keyvisualId: 	'1737',
				keyvisualName: 	'blumen.jpg',
				fontsetId: 		'289',
				graphicsetId: 	'356',
				contentColor: 	'FFFFFF',
				contentBGColor: 'AC2323',
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				a_color: 		'AC2323',
				b_color: 		'480F0F',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4518',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4982',
internalId:  '',
customField: '20090223-094549'
};
webappMappings['1002']=webappMappings['1002-6102ABW0X0INXLMP']={
webappId:    '1002',
documentId:  '6102',
internalId:  '6102ABW0X0INXLMP',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4518',
internalId:  '',
customField: '20090729-151922'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5009',
internalId:  '',
customField: '20090331-095632'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5036',
internalId:  '',
customField: '20090510-111253'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5063',
internalId:  '',
customField: '20090810-144007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5090',
internalId:  '',
customField: '20090123-083108'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5117',
internalId:  '',
customField: '20090324-070312'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14703',
internalId:  '',
customField: '20041123-121355'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6102',
internalId:  '',
customField: '20041103-140825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6103',
internalId:  '',
customField: '20080407-113156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '42601',
internalId:  '',
customField: '20090608-115749'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '54601',
internalId:  '',
customField: '20090330-173839'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXLMP';
var companyName   = 'Damwild-+%2F+Mufflonzucht+Paspels';
var htmlTitle	  = 'Herzlich+willkommen+bei+www.damwild.ch';
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();
};

