/* [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','4519',jdecode('Home'),jdecode(''), jdecode('%2F4519.html'), 'true',[],'',''],
	['PAGE','73001',jdecode('suche+liebevolles+Zuhause'),jdecode(''), jdecode('%2F73001.html'), 'true',[],'',''],
	['PAGE','50079',jdecode('News'),jdecode(''), jdecode('%2F50079.html'), 'true',[],'',''],
	['PAGE','5001',jdecode('Jungtiere'),jdecode(''), jdecode('%2F5001.html'), 'true',[],'',''],
	['PAGE','50144',jdecode('Zuchtkatzen'),jdecode(''), jdecode('%2F50144.html'), 'true',[],'',''],
	['PAGE','50153',jdecode('Zuchtkater'),jdecode(''), jdecode('%2F50153.html'), 'true',[],'',''],
	['PAGE','50162',jdecode('Kastratinen'),jdecode(''), jdecode('%2F50162.html'), 'true',[],'',''],
	['PAGE','80201',jdecode('Kastraten'),jdecode(''), jdecode('%2F80201.html'), 'true',[],'',''],
	['PAGE','5082',jdecode('Hauskatzen'),jdecode(''), jdecode('%2F5082.html'), 'true',[],'',''],
	['PAGE','5028',jdecode('Siamesen'),jdecode(''), jdecode('%2F5028.html'), 'true',[],'',''],
	['PAGE','5055',jdecode('verkaufte+Jungtiere'),jdecode(''), jdecode('%2F5055.html'), 'true',[],'',''],
	['PAGE','73701',jdecode('Ausstellungserfolge'),jdecode(''), jdecode('%2F73701.html'), 'true',[],'',''],
	['PAGE','5136',jdecode('Kontakt'),jdecode(''), jdecode('%2F5136.html'), 'true',[],'',''],
	['PAGE','17807',jdecode('Eintr%C3%A4ge'),jdecode(''), jdecode('%2F17807.html'), 'false',[],'',''],
	['PAGE','17806',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F17806.html'), 'true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Roses';
theSitetree.paletteFamily='FFFBF2';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10444';
theSitetree.graphicsetId='10823';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='FFFBF2';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MS'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Roses',
				paletteFamily: 	'FFFBF2',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10444',
				graphicsetId: 	'10823',
				contentColor: 	'000000',
				contentBGColor: 'FFFBF2',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'787878',
				e_color: 		'9D584B',
				f_color: 		'9D584B',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4519',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50079',
internalId:  '',
customField: '20101002-100141'
};
webappMappings['1002']=webappMappings['1002-17806ABW0X0INX25H']={
webappId:    '1002',
documentId:  '17806',
internalId:  '17806ABW0X0INX25H',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4519',
internalId:  '',
customField: '20101002-100031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5001',
internalId:  '',
customField: '20101002-120858'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50144',
internalId:  '',
customField: '20100201-082016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50153',
internalId:  '',
customField: '20100201-082033'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50162',
internalId:  '',
customField: '20101002-100541'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5082',
internalId:  '',
customField: '20091018-124231'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5028',
internalId:  '',
customField: '20080107-225519'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5055',
internalId:  '',
customField: '20080324-233101'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5136',
internalId:  '',
customField: '20080118-193031'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17807',
internalId:  '',
customField: '20040817-151644'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17806',
internalId:  '',
customField: '20050122-181730'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73001',
internalId:  '',
customField: '20110604-181514'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73701',
internalId:  '',
customField: '20110604-184703'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '80201',
internalId:  '',
customField: '20110823-150704'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INX25H';
var companyName   = 'Siamesen+von-Tamangur';
var htmlTitle	  = 'von-Tamangur';
var metaKeywords  = 'SiamesenKatzenzuchtSiamesenJungtierevonTamangurTamangurSiamesenKatzenzucht';
var metaContents  = 'Die+Katzen+werden+mit+Fotos+vorgestellt+und+%C3%BCber+W%C3%BCrfe+informiert.';
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();
};

