/* [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','90101',jdecode('English'),jdecode(''),'/90101/index.html','true',[ 
		['PAGE','90122',jdecode('Apartments'),jdecode(''),'/90101/90122.html','true',[],'',''],
		['PAGE','90401',jdecode('Services'),jdecode(''),'/90101/90401.html','true',[],'',''],
		['PAGE','90422',jdecode('Rates%2FTerms'),jdecode(''),'/90101/90422.html','true',[],'',''],
		['PAGE','90443',jdecode('Contact'),jdecode(''),'/90101/90443.html','true',[],'',''],
		['PAGE','90464',jdecode('Location'),jdecode(''),'/90101/90464.html','true',[],'',''],
		['PAGE','90485',jdecode('Travel'),jdecode(''),'/90101/90485.html','true',[],'','']
	],'',''],
	['PAGE','4613',jdecode('Deutsch'),jdecode(''),'/4613/index.html','true',[ 
		['PAGE','4751',jdecode('Wohnungen'),jdecode(''),'/4613/4751.html','true',[],'',''],
		['PAGE','9803',jdecode('Service'),jdecode(''),'/4613/9803.html','true',[],'',''],
		['PAGE','4697',jdecode('Tarife%2FKonditionen'),jdecode(''),'/4613/4697.html','true',[],'',''],
		['PAGE','27301',jdecode('Kontakt'),jdecode(''),'/4613/27301.html','true',[],'',''],
		['PAGE','4805',jdecode('Standort'),jdecode(''),'/4613/4805.html','true',[],'',''],
		['PAGE','85001',jdecode('Anfahrt'),jdecode(''),'/4613/85001.html','true',[],'','']
	],'','']];
var siteelementCount=14;
theSitetree.topTemplateName='Ragtime';
theSitetree.paletteFamily='DD8C85';
theSitetree.keyvisualId='3572';
theSitetree.keyvisualName='kv_3572.jpg';
theSitetree.fontsetId='10737';
theSitetree.graphicsetId='10851';
theSitetree.contentColor='666666';
theSitetree.contentBGColor='FFFFFF';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Ragtime',
				paletteFamily: 	'DD8C85',
				keyvisualId: 	'3572',
				keyvisualName: 	'kv_3572.jpg',
				fontsetId: 		'10737',
				graphicsetId: 	'10851',
				contentColor: 	'666666',
				contentBGColor: 'FFFFFF',
				a_color: 		'DD8C85',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'7D7E7D',
				e_color: 		'AB6A65',
				f_color: 		'000000',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '90101',
internalId:  '1006',
customField: '1006'
};
webappMappings['7008']=webappMappings['7008-2933']={
webappId:    '7008',
documentId:  '27301',
internalId:  '2933',
customField: 'language:de;country:CH;'
};
webappMappings['7008']=webappMappings['7008-2932']={
webappId:    '7008',
documentId:  '90443',
internalId:  '2932',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90122',
internalId:  '',
customField: '20080707-164348'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90401',
internalId:  '',
customField: '20080707-163513'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90422',
internalId:  '',
customField: '20081223-103930'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90101',
internalId:  '',
customField: '20080707-164224'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90443',
internalId:  '',
customField: '20080429-154733'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90464',
internalId:  '',
customField: '20080619-113946'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '90485',
internalId:  '',
customField: '20080501-074423'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4613',
internalId:  '',
customField: '20080707-163826'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4751',
internalId:  '',
customField: '20080424-180638'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9803',
internalId:  '',
customField: '20090630-091130'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4697',
internalId:  '',
customField: '20090630-091110'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27301',
internalId:  '',
customField: '20080424-181825'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4805',
internalId:  '',
customField: '20080429-142131'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '85001',
internalId:  '',
customField: '20080429-155126'
};
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXEAU';
var companyName   = 'apartments+elite+ag+basel';
var htmlTitle	  = 'Apartments+Elite+AG+Basel';
var metaKeywords  = 'Apartment+Basel+Hotel+Flat+m%C3%B6bliert+furnished+Schlafmaschine+wohnen+Messe+fair+Appartement+Zimmer+Room+Chambre+Stage+Bale+Flughafen+airport+a%C3%A9roport+residence+Residenz+loding';
var metaContents  = 'Vermietung+von+Apartment+%2F+Wohnungen+in+der+N%C3%A4he+der+Messe+Basel+und+des+Flughafens+%2F+Rent+of+apartments+%2F+lofts+near+the+fair+of+basel+und+the+airport+%2F+location+des+appartements+%2F+logement+pr%C3%A8s+de+la+foire+de+bale+et+da%C3%A9roport';
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();
};
