/* [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','27501',jdecode('Home'),jdecode(''), jdecode('%2F27501%2Findex.html'), 'true',[ 
		['PAGE','48212',jdecode('Neuigkeiten'),jdecode(''), jdecode('%2F27501%2F48212.html'), 'true',[],'','']
	],'',''],
	['PAGE','14394',jdecode('Yonina'),jdecode(''), jdecode('%2F14394%2Findex.html'), 'true',[ 
		['PAGE','50112',jdecode('Der+Toller'),jdecode(''), jdecode('%2F14394%2F50112.html'), 'true',[],'',''],
		['PAGE','62023',jdecode('Wurfplanung'),jdecode(''), jdecode('%2F14394%2F62023.html'), 'true',[],'',''],
		['PAGE','65723',jdecode('Fotoalbum'),jdecode(''), jdecode('%2F14394%2F65723.html'), 'true',[],'','']
	],'',''],
	['PAGE','25301',jdecode('Nala'),jdecode(''), jdecode('%2F25301.html'), 'true',[],'',''],
	['PAGE','14436',jdecode('Katzen'),jdecode(''), jdecode('%2F14436.html'), 'true',[],'',''],
	['PAGE','14352',jdecode('%C3%9Cber+uns'),jdecode(''), jdecode('%2F14352.html'), 'true',[],'',''],
	['PAGE','56123',jdecode('Berichte'),jdecode(''), jdecode('%2F56123.html'), 'false',[],'',''],
	['PAGE','66223',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F66223.html'), 'true',[],'',''],
	['PAGE','25322',jdecode('Links'),jdecode(''), jdecode('%2F25322.html'), 'true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Vienna';
theSitetree.paletteFamily='D6D2C5';
theSitetree.keyvisualId='11886';
theSitetree.keyvisualName='kv_11886.jpg';
theSitetree.fontsetId='33180';
theSitetree.graphicsetId='14088';
theSitetree.contentColor='696146';
theSitetree.contentBGColor='ebe8df';
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: 			'Vienna',
				paletteFamily: 	'D6D2C5',
				keyvisualId: 	'11886',
				keyvisualName: 	'kv_11886.jpg',
				fontsetId: 		'33180',
				graphicsetId: 	'14088',
				contentColor: 	'696146',
				contentBGColor: 'ebe8df',
				a_color: 		'EBE8DF',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27501',
internalId:  '',
customField: '20120205-125331'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14352',
internalId:  '',
customField: '20111025-165307'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14394',
internalId:  '',
customField: '20120205-121437'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '14436',
internalId:  '',
customField: '20120205-122458'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '27501',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25301',
internalId:  '',
customField: '20120205-122229'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '25322',
internalId:  '',
customField: '20110910-172311'
};
webappMappings['7060']=webappMappings['7060-f52b900f18e8203ebdcd156af290d307']={
webappId:    '7060',
documentId:  '65723',
internalId:  'f52b900f18e8203ebdcd156af290d307',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '62023',
internalId:  '',
customField: '20120205-124546'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '56123',
internalId:  '',
customField: '20111113-203714'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '48212',
internalId:  '',
customField: '20120205-123724'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '50112',
internalId:  '',
customField: '20111025-163303'
};
webappMappings['1002']=webappMappings['1002-66223abw330ine69l']={
webappId:    '1002',
documentId:  '66223',
internalId:  '66223abw330ine69l',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '65723',
internalId:  '',
customField: '20110919-164032'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '66223',
internalId:  '',
customField: '20110919-163951'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW330INE69L';
var companyName   = 'Okaloosa';
var htmlTitle	  = 'Anishinaabe%27s+Yonina+-+Nova+Scotia+Duck+Tolling+Retriever';
var metaKeywords  = 'Nova+Scotia+Duck+Tolling+Retriever%2C+Toller%2C+Anishinaabe%27s+Yonina';
var metaContents  = 'Nova+Scotia+Duck+Tolling+Retriever+-+Anishinaabe%27s+Yonina';
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();
};

