/* [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','901',jdecode('STUDIENREISEN'),jdecode(''), jdecode('%2F901%2Findex.html'), 'true',[ 
		['PAGE','952',jdecode('%C3%9CBERSICHT+2012'),jdecode(''), jdecode('%2F901%2F952.html'), 'true',[],'','']
	],'',''],
	['PAGE','61623',jdecode('CORNWALL+2012'),jdecode(''), jdecode('%2F61623.html'), 'true',[],'',''],
	['PAGE','61723',jdecode('FLANDERN+2012'),jdecode(''), jdecode('%2F61723.html'), 'true',[],'',''],
	['PAGE','61744',jdecode('SCHOTTLAND+2012'),jdecode(''), jdecode('%2F61744.html'), 'true',[],'',''],
	['PAGE','6401',jdecode('KONTAKT+%26+BIOGRAFIE'),jdecode(''), jdecode('%2F6401%2Findex.html'), 'true',[ 
		['PAGE','16801',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''), jdecode('%2F6401%2F16801.html'), 'false',[],'','']
	],'','']];
var siteelementCount=7;
theSitetree.topTemplateName='Draft';
theSitetree.paletteFamily='2E5D32';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10619';
theSitetree.graphicsetId='10612';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='2E5D32';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2QE'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Draft',
				paletteFamily: 	'2E5D32',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10619',
				graphicsetId: 	'10612',
				contentColor: 	'FFFFFF',
				contentBGColor: '2E5D32',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'92BD96',
				e_color: 		'BFA45F',
				f_color: 		'BFA45F',
				hasCustomLogo: 	'false',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61744',
internalId:  '',
customField: '20111221-081016'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '901',
internalId:  '',
customField: '20111221-070111'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '952',
internalId:  '',
customField: '20111222-144514'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61723',
internalId:  '',
customField: '20111221-081959'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '61623',
internalId:  '',
customField: '20111221-082305'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6401',
internalId:  '',
customField: '20111221-081927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '16801',
internalId:  '',
customField: '20061023-101952'
};
webappMappings['7008']=webappMappings['7008-7777']={
webappId:    '7008',
documentId:  '6401',
internalId:  '7777',
customField: 'language:de;country:CH;'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN259Q';
var companyName   = 'S+T+U+D+I+E+N+R+E+I+S+E+N';
var htmlTitle	  = 'Englandreisen+Francis+Ross%C3%A9%2C+Bildungstour%2C+Bildungsreisen%2C+Studienreisen%2C+Kulturreisen%2C+Cornwall%2C+Lake+District%2C+Kent%2C+England';
var metaKeywords  = 'englandreisen++++englandreisen.ch++++Francis+Ross%C3%A9++++Cornwall++Lake+++District++England++++Cornwall++++Lake+District++++Volkshochschule++++Francis+Ross%C3%A9++++englandreisen.ch++++englandreisen+++englandreise+++Francis+Rosse++Grossbritannien+Reisen+Studienreisen+Gruppenreisen+Wanderferien+United+Kingdom+UK+GB+Glendurgan+Trebah+RNAS+Culdrose+St.+Ives+Ullswater+Meudon+Hotel+Beatrix+Potter+Ren%C3%A9e+Zellweger+Englandreisen%0D%0A%0D%0ABildungstour';
var metaContents  = 'Englandreisen++England++++Cornwall++++Lake+District++++Volkshochschule++++Francis+Ross%C3%A9++++englandreisen.ch++++englandreisen+++englandreise+++Francis+Rosse++Grossbritannien+Reisen+Studienreisen+Gruppenreisen+Wanderferien+United+Kingdom+UK+GB+Glendurgan+Trebah+RNAS+Culdrose+St.+Ives+Ullswater+Meudon+Hotel+Beatrix+Potter++Ren%C3%A9e+Zellweger+Englandreisen%0D%0A%0D%0ABildungstour';
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();
};

