/* [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','4394',jdecode('Home'),jdecode(''),'/4394.html','true',[],'',''],
	['PAGE','99437',jdecode('Welcome%21'),jdecode(''),'/99437.html','false',[],'',''],
	['PAGE','4532',jdecode('Need+a+room%3F'),jdecode(''),'/4532.html','true',[],'',''],
	['PAGE','4640',jdecode('History'),jdecode(''),'/4640.html','true',[],'',''],
	['PAGE','17428',jdecode('Links'),jdecode(''),'/17428.html','false',[],'',''],
	['PAGE','5493',jdecode('Guestbook'),jdecode(''),'/5493.html','true',[],'',''],
	['PAGE','73227',jdecode('Contact'),jdecode(''),'/73227.html','true',[],'',''],
	['PAGE','4451',jdecode('%28Zimmer+anbieten%29'),jdecode(''),'/4451.html','true',[],'',''],
	['PAGE','99516',jdecode('Zimmervermittlung'),jdecode(''),'/99516.html','false',[],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Undulate';
theSitetree.paletteFamily='040404';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='33116';
theSitetree.graphicsetId='14070';
theSitetree.contentColor='A0A0A0';
theSitetree.contentBGColor='404040';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Undulate',
				paletteFamily: 	'040404',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'33116',
				graphicsetId: 	'14070',
				contentColor: 	'A0A0A0',
				contentBGColor: '404040',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'000000',
				e_color: 		'000000',
				f_color: 		'000000',
				hasCustomLogo: 	'false',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4394',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4451',
internalId:  '',
customField: '20090504-183831'
};
webappMappings['1002']=webappMappings['1002-5493ABW0X0INX245']={
webappId:    '1002',
documentId:  '5493',
internalId:  '5493ABW0X0INX245',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4394',
internalId:  '',
customField: '20100423-172145'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4532',
internalId:  '',
customField: '20100423-170507'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '99437',
internalId:  '',
customField: '20090412-212434'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '99516',
internalId:  '',
customField: '20090412-221456'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4640',
internalId:  '',
customField: '20100423-171850'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17428',
internalId:  '',
customField: '20081127-231137'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5493',
internalId:  '',
customField: '20080212-170140'
};
webappMappings['7008']=webappMappings['7008-5396']={
webappId:    '7008',
documentId:  '4532',
internalId:  '5396',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73227',
internalId:  '',
customField: '20100217-144846'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INX245';
var companyName   = 'sleepinzurich.ch+-+the+inexpensive+alternative+to+hotels';
var htmlTitle	  = 'sleepinzurich.ch+-+the+affordable+alternative+to+expensive+hotels...';
var metaKeywords  = 'backpacker%2C+backpackers%2C+Rucksacktouristen%2C+bed+breakfast%2C+bed+breakfast+inn%2C+bed+breakfasts%2C+cheap+holidays%2C+cheap+hotel%2C+cheap+hotels%2C+cheap+stay%2C+city%2C+credit+cards%2C+currency+converter%2C+ferienwohnung%2C+free+internet%2C+guesthouse%2C+hostel%2C+hostels%2C+hotel%2C+hotels%2C+inn%2C+long+stay%2C+public+transportation%2C+real+estate%2C+real+property%2C+relocation%2C+rooms+for+rent%2C+swiss%2C+swiss+watch%2C+switzerland%2C+switzerland+travel%2C+austria%2C+trips%2C+zurich%2C+airport%2C+ferien%2C+schweizer%2C+hotel+schweiz%2C+zimmervermittlung%2C+privatzimmer%2C+zimmer%2C+ipr+guesthouse%2C+';
var metaContents  = 'sleepinzurich+is+a+room+agency+to+offer+affordable+accomodation+in+the+city+of+Zurich+at+lower+rates+then+hotels';
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();
};
