/* [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','4901',jdecode('Home'),jdecode(''), jdecode('%2F4901.html'), 'true',[],'',''],
	['PAGE','4952',jdecode('So+finden+Sie+uns'),jdecode(''), jdecode('%2F4952.html'), 'true',[],'',''],
	['PAGE','4973',jdecode('Wir+%C3%BCber+uns'),jdecode(''), jdecode('%2F4973.html'), 'true',[],'',''],
	['PAGE','5015',jdecode('Elektrotechnik'),jdecode(''), jdecode('%2F5015%2Findex.html'), 'true',[ 
		['PAGE','36701',jdecode('Photovoltaik'),jdecode(''), jdecode('%2F5015%2F36701.html'), 'true',[],'',''],
		['PAGE','5201',jdecode('Referenzen'),jdecode(''), jdecode('%2F5015%2F5201.html'), 'true',[],'',''],
		['PAGE','12101',jdecode('Partner'),jdecode(''), jdecode('%2F5015%2F12101.html'), 'true',[],'','']
	],'',''],
	['PAGE','5036',jdecode('Ausstellung+und+Kurse'),jdecode(''), jdecode('%2F5036%2Findex.html'), 'true',[ 
		['PAGE','26101',jdecode('Ausstellungsk%C3%BCche'),jdecode(''), jdecode('%2F5036%2F26101.html'), 'true',[],'',''],
		['PAGE','26143',jdecode('Kurse'),jdecode(''), jdecode('%2F5036%2F26143.html'), 'true',[],'','']
	],'',''],
	['PAGE','38301',jdecode('Rezepte'),jdecode(''), jdecode('%2F38301%2Findex.html'), 'true',[ 
		['PAGE','40601',jdecode('Rezepte+von+Kochkurse'),jdecode(''), jdecode('%2F38301%2F40601.html'), 'true',[],'','']
	],'',''],
	['PAGE','5057',jdecode('Tipps+%26+Tricks'),jdecode(''), jdecode('%2F5057.html'), 'true',[],'',''],
	['PAGE','39601',jdecode('Aktuell'),jdecode(''), jdecode('%2F39601%2Findex.html'), 'true',[ 
		['PAGE','47001',jdecode('Jobs'),jdecode(''), jdecode('%2F39601%2F47001.html'), 'true',[],'','']
	],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Sportive';
theSitetree.paletteFamily='E9EEF4';
theSitetree.keyvisualId='2657';
theSitetree.keyvisualName='architekt.jpg';
theSitetree.fontsetId='220';
theSitetree.graphicsetId='262';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='E9EEF4';
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: 			'Sportive',
				paletteFamily: 	'E9EEF4',
				keyvisualId: 	'2657',
				keyvisualName: 	'architekt.jpg',
				fontsetId: 		'220',
				graphicsetId: 	'262',
				contentColor: 	'000000',
				contentBGColor: 'E9EEF4',
				a_color: 		'E9EEF4',
				b_color: 		'C1C4D3',
				c_color: 		'000000',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4901',
internalId:  '',
customField: '20111031-195053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4952',
internalId:  '',
customField: '20100104-170351'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5057',
internalId:  '',
customField: '20101208-134827'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4901',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4973',
internalId:  '',
customField: '20120120-151807'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12101',
internalId:  '',
customField: '20110208-114802'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5015',
internalId:  '',
customField: '20091120-100914'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5036',
internalId:  '',
customField: '20100114-105156'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '5201',
internalId:  '',
customField: '20100114-110117'
};
webappMappings['7008']=webappMappings['7008-7885']={
webappId:    '7008',
documentId:  '26143',
internalId:  '7885',
customField: 'language:de;country:CH;'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26143',
internalId:  '',
customField: '20110428-141003'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26101',
internalId:  '',
customField: '20091120-160227'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '36701',
internalId:  '',
customField: '20120211-164026'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '38301',
internalId:  '',
customField: '20100818-143953'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39601',
internalId:  '',
customField: '20110502-130445'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '40601',
internalId:  '',
customField: '20101208-093851'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '47001',
internalId:  '',
customField: '20110816-154434'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0IN2A4S';
var companyName   = 'Marti+elektrische+Anlagen+AG';
var htmlTitle	  = 'Marti+elektrische+Anlagen+AG';
var metaKeywords  = 'Marti+elektrische+Anlagen+AG+Jegenstorf+Elektriker+Elektroinstallation+Baugewerbe+Beleuchtung+LED+EDV+Service+Piket+24+EIB+Geb%C3%A4udeautomation+Telekomunikation+Haushaltsger%C3%A4te';
var metaContents  = 'Marti+elektrische+Anlagen+AG++Ihr+Elektriker+mitten+in+Jegenstorf+Ihr+Partner+f%C3%BCr+Projektierung+und+Planung+Elektroinstallationen+Planung+%26+Beratung+Telematik+Haushaltsger%C3%A4te%2C+Service+und+Verkauf+Installations+Service+%26+24h+Notfall+-+Service+Photovoltaik+%26+Solaranlagen+Installationskontrollen+Geb%C3%A4udeautomation+Kurse+%26+Ausstellungen+Ladenlokal';
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();
};

