/* [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','4477',jdecode('Home'),jdecode(''), jdecode('%2F4477.html'), 'true',[],'',''],
	['PAGE','13254',jdecode('Aktionen+%2F+Neuheiten'),jdecode(''), jdecode('%2F13254.html'), 'true',[],'',''],
	['PAGE','45628',jdecode('Traktoren'),jdecode(''), jdecode('%2F45628.html'), 'true',[],'',''],
	['PAGE','13281',jdecode('Mulchger%C3%A4te'),jdecode(''), jdecode('%2F13281.html'), 'true',[],'',''],
	['PAGE','13308',jdecode('Motorger%C3%A4te'),jdecode(''), jdecode('%2F13308.html'), 'true',[],'',''],
	['PAGE','13335',jdecode('Occasionen'),jdecode(''), jdecode('%2F13335.html'), 'true',[],'',''],
	['PAGE','13227',jdecode('%C3%9Cber+uns+%2F+Jobs'),jdecode(''), jdecode('%2F13227.html'), 'true',[],'',''],
	['PAGE','13362',jdecode('Kontakt'),jdecode(''), jdecode('%2F13362%2Findex.html'), 'true',[ 
		['PAGE','19702',jdecode('Feedback+%28Folgeseite%29'),jdecode(''), jdecode('%2F13362%2F19702.html'), 'false',[],'','']
	],'','']];
var siteelementCount=9;
theSitetree.topTemplateName='Match';
theSitetree.paletteFamily='2354B7';
theSitetree.keyvisualId='2698';
theSitetree.keyvisualName='kv_2698.jpg';
theSitetree.fontsetId='10404';
theSitetree.graphicsetId='10633';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='C6E2FE';
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: 			'Match',
				paletteFamily: 	'2354B7',
				keyvisualId: 	'2698',
				keyvisualName: 	'kv_2698.jpg',
				fontsetId: 		'10404',
				graphicsetId: 	'10633',
				contentColor: 	'000000',
				contentBGColor: 'C6E2FE',
				a_color: 		'000000',
				b_color: 		'000000',
				c_color: 		'000000',
				d_color: 		'2354B7',
				e_color: 		'707070',
				f_color: 		'707070',
				hasCustomLogo: 	'true',
				contentFontFace:'Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'true'
			  };
var webappMappings = {};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '4477',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '4477',
internalId:  '',
customField: '20111219-182218'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13281',
internalId:  '',
customField: '20110308-171559'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13227',
internalId:  '',
customField: '20120126-105647'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13254',
internalId:  '',
customField: '20111212-141407'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13308',
internalId:  '',
customField: '20110603-120659'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13335',
internalId:  '',
customField: '20120116-091540'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '45628',
internalId:  '',
customField: '20110610-122432'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13362',
internalId:  '',
customField: '20110210-174102'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '19702',
internalId:  '',
customField: '20030408-091421'
};
webappMappings['7008']=webappMappings['7008-2950']={
webappId:    '7008',
documentId:  '13362',
internalId:  '2950',
customField: 'language:de;country:CH;'
};
var webAppHostname = 'cgi.hpt001.bluewin.ch:80';
var canonHostname = 'hptworkerdb01b.bluewin.ch';
var accountId     = 'ABW0X0INXE4C';
var companyName   = '++++++++++++Herzlich+willkommen%21';
var htmlTitle	  = 'Lustenberger+Landtechnik+AG+-+Traktoren%2C+Landmaschinen%2C+Motorger%C3%A4te%2C+Mulchger%C3%A4te+Dragone+und+Agricom+Weidemulcher';
var metaKeywords  = 'Lustenberger%2CLandtechnik%2CLandmaschinen%2CMotorger%C3%A4te%2CHydraulik-Service%2CDragone%2CAgricom%2CMulchger%C3%A4te%2CWeidemulcher%2C+Honda%2CHusqvarna%2C+Holzspalter%2CFahrzeuge%2CTraktoren%2COccasionen%2CMaschinen%2CZetzwil%2CAargau%2CWerkstatt%2CService%2CAgrartechnik%2CSchweiz%2CLandmaschinenhandel%2CAgropool%2CVorf%C3%BChrger%C3%A4te%2CRuedi+R%C3%BCssel%2C+ch-motorist.ch';
var metaContents  = 'Lustenberger+Landtechnik+AG%2C+Zetzwil+-+Landmaschinen%2C+Traktoren+und+Motorger%C3%A4te+und+Hydraulik-Service.+Motorger%C3%A4te-Fachbetrieb+ch-motorist.+Importeur+von+Dragone+und+Agricom+Mulchger%C3%A4te.+Grosser+Landmaschinen-Occasionsmarkt%21+';
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();
};

