/* [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','4606',jdecode('Home'),jdecode(''), jdecode('%2F4606.html'), 'true',[],'',''],
	['PAGE','6201',jdecode('Adresse%2C+Telefon'),jdecode(''), jdecode('%2F6201.html'), 'true',[],'',''],
	['PAGE','4663',jdecode('Wir+%C3%BCber+uns'),jdecode(''), jdecode('%2F4663%2Findex.html'), 'true',[ 
		['PAGE','4690',jdecode('Unser+Team'),jdecode(''), jdecode('%2F4663%2F4690.html'), 'true',[],'',''],
		['PAGE','4717',jdecode('So+finden+Sie+uns'),jdecode(''), jdecode('%2F4663%2F4717.html'), 'true',[],'','']
	],'',''],
	['PAGE','4744',jdecode('Service'),jdecode(''), jdecode('%2F4744.html'), 'true',[],'',''],
	['PAGE','4771',jdecode('Angebote'),jdecode(''), jdecode('%2F4771.html'), 'true',[],'',''],
	['PAGE','4798',jdecode('Aktuelles'),jdecode(''), jdecode('%2F4798%2Findex.html'), 'true',[ 
		['PAGE','4825',jdecode('Neuigkeiten'),jdecode(''), jdecode('%2F4798%2F4825.html'), 'true',[],'','']
	],'',''],
	['PAGE','103101',jdecode('Sonderaktionen'),jdecode(''), jdecode('%2F103101.html'), 'true',[],'',''],
	['PAGE','5802',jdecode('Anfahrt'),jdecode(''), jdecode('%2F5802.html'), 'true',[],'',''],
	['PAGE','5902',jdecode('Ihr+Weg+zu+uns'),jdecode(''), jdecode('%2F5902.html'), 'true',[],'',''],
	['PAGE','6228',jdecode('Tipps+%26+Tricks'),jdecode(''), jdecode('%2F6228.html'), 'true',[],'',''],
	['PAGE','20102',jdecode('G%C3%A4stebuch'),jdecode(''), jdecode('%2F20102%2Findex.html'), 'true',[ 
		['PAGE','20103',jdecode('Eintr%C3%A4ge'),jdecode(''), jdecode('%2F20102%2F20103.html'), 'false',[],'','']
	],'',''],
	['PAGE','73768',jdecode('neu'),jdecode(''), jdecode('%2F73768.html'), 'true',[],'','']];
var siteelementCount=16;
theSitetree.topTemplateName='Match';
theSitetree.paletteFamily='FF3333';
theSitetree.keyvisualId='2720';
theSitetree.keyvisualName='kv_2720.jpg';
theSitetree.fontsetId='10404';
theSitetree.graphicsetId='10635';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='CCCCCC';
var localeDef={
  language: 'de',
  country: 'CH'
};
var prodDef={
  wl_name: 'bluewin',
  product: 'WSCBLUSSSLYTC2MX'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Match',
				paletteFamily: 	'FF3333',
				keyvisualId: 	'2720',
				keyvisualName: 	'kv_2720.jpg',
				fontsetId: 		'10404',
				graphicsetId: 	'10635',
				contentColor: 	'000000',
				contentBGColor: 'CCCCCC',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'FF3333',
				e_color: 		'545353',
				f_color: 		'545353',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '5802',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '5902',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4663',
internalId:  '',
customField: '20100526-104858'
};
webappMappings['1002']=webappMappings['1002-20102ABW0X0INXSE6']={
webappId:    '1002',
documentId:  '20102',
internalId:  '20102ABW0X0INXSE6',
customField: 'icq=false'
};
webappMappings['1501']=webappMappings['1501-299788']={
webappId:    '1501',
documentId:  '4606',
internalId:  '299788',
customField: '1501'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4606',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4606',
internalId:  '',
customField: '20111123-122149'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6201',
internalId:  '',
customField: '20110407-191201'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4690',
internalId:  '',
customField: '20110108-101706'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4717',
internalId:  '',
customField: '20070109-183753'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4744',
internalId:  '',
customField: '20111014-154705'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '103101',
internalId:  '',
customField: '20111207-153602'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4771',
internalId:  '',
customField: '20111104-154729'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4798',
internalId:  '',
customField: '20111123-121906'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4825',
internalId:  '',
customField: '20111014-155834'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5802',
internalId:  '',
customField: '20070420-134117'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5902',
internalId:  '',
customField: '20040616-133736'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6228',
internalId:  '',
customField: '20040814-152442'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20102',
internalId:  '',
customField: '20040814-132351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '20103',
internalId:  '',
customField: '20040814-132351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '73768',
internalId:  '',
customField: '20070109-182208'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXSE6';
var companyName   = 'Sport+Service+Bannwart%2C+Zug';
var htmlTitle	  = 'Sport+Service+Bannwart%2C+Zug+Verkauf+-Service-Vermietung';
var metaKeywords  = 'Sportgesch%C3%A4ft%2C+Sportartikel%2C+Fussball%2C+Inlineskate%2C+Tennis%2C+Walking%2C+Wassersport%2C+Fitnessger%C3%A4te%2C+Verkauf%2C+Service%2C+Skivermietung%2C+Rental%2C+Zug%2C+Bannwart%2C+Ski%2C+';
var metaContents  = 'Sportgesch%C3%A4ft%2C+Sportartikel%2C+Skivermietung%2C+Skiservice%2C+Tennis%2C+Bespannservice%2C+Sonderangebote%2C+Aktionen%2C+Serviceleistungen%2C+Fitnessger%C3%A4te%2C+Runningcenter';
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();
};

