/* [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','601',jdecode('Home'),jdecode(''),'/601.html','true',[],'',''],
	['PAGE','547613',jdecode('%C3%9Cber+uns'),jdecode(''),'/547613.html','true',[],'',''],
	['PAGE','547855',jdecode('News-Aktuell'),jdecode(''),'/547855.html','true',[],'',''],
	['PAGE','22201',jdecode('MF-Gallery'),jdecode(''),'/22201.html','true',[],'',''],
	['PAGE','17601',jdecode('MF-Global'),jdecode(''),'/17601.html','true',[],'',''],
	['PAGE','26901',jdecode('Lohnarbeiten'),jdecode(''),'/26901.html','true',[],'',''],
	['PAGE','27301',jdecode('MF-Modelle'),jdecode(''),'/27301.html','true',[],'',''],
	['PAGE','547813',jdecode('Gast+MF-Bilder'),jdecode(''),'/547813.html','true',[],'',''],
	['PAGE','547676',jdecode('Zu+verkaufen'),jdecode(''),'/547676.html','true',[],'',''],
	['PAGE','22222',jdecode('Schwingen'),jdecode(''),'/22222.html','true',[],'',''],
	['PAGE','547634',jdecode('Portugal'),jdecode(''),'/547634.html','true',[],'',''],
	['PAGE','17606',jdecode('G%C3%A4stebuch'),jdecode(''),'/17606.html','true',[],'',''],
	['PAGE','39901',jdecode('Kontakt+%26+Links'),jdecode(''),'/39901.html','true',[],'',''],
	['PAGE','547834',jdecode('Wir+suchen+...'),jdecode(''),'/547834.html','true',[],'',''],
	['PAGE','547655',jdecode('In+Bearbeitung-2'),jdecode(''),'/547655.html','true',[],'','']];
var siteelementCount=15;
theSitetree.topTemplateName='Circulation';
theSitetree.paletteFamily='FC2323';
theSitetree.keyvisualId='-1';
theSitetree.keyvisualName='keyv.jpg';
theSitetree.fontsetId='10587';
theSitetree.graphicsetId='10561';
theSitetree.contentColor='FFFFFF';
theSitetree.contentBGColor='000000';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Circulation',
				paletteFamily: 	'FC2323',
				keyvisualId: 	'-1',
				keyvisualName: 	'keyv.jpg',
				fontsetId: 		'10587',
				graphicsetId: 	'10561',
				contentColor: 	'FFFFFF',
				contentBGColor: '000000',
				a_color: 		'FFFFFF',
				b_color: 		'FFFFFF',
				c_color: 		'FFFFFF',
				d_color: 		'FFFFFF',
				e_color: 		'FFFFFF',
				f_color: 		'FFFFFF',
				hasCustomLogo: 	'true',
				contentFontFace:'Verdana, Arial, Helvetica, sans-serif',
				contentFontSize:'12',
				useFavicon:     'false'
			  };
var webappMappings = {};
webappMappings['1002']=webappMappings['1002-17606abw0x0inew2q']={
webappId:    '1002',
documentId:  '17606',
internalId:  '17606abw0x0inew2q',
customField: 'icq=false'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '601',
internalId:  '',
customField: '20091230-213722'
};
webappMappings['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '601',
internalId:  '1006',
customField: '1006'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22201',
internalId:  '',
customField: '20100130-213147'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '22222',
internalId:  '',
customField: '20091129-173402'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '26901',
internalId:  '',
customField: '20100302-161500'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '27301',
internalId:  '',
customField: '20100308-184921'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17606',
internalId:  '',
customField: '20080310-133954'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '17601',
internalId:  '',
customField: '20100308-191927'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '39901',
internalId:  '',
customField: '20100216-205007'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '547634',
internalId:  '',
customField: '20091208-203053'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '547655',
internalId:  '',
customField: '20091028-181400'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '547613',
internalId:  '',
customField: '20100118-203804'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '547676',
internalId:  '',
customField: '20100216-210030'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '547813',
internalId:  '',
customField: '20100228-174837'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '547834',
internalId:  '',
customField: '20100113-165009'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '547855',
internalId:  '',
customField: '20100221-100247'
};
var canonHostname = 'hptworkerdb01a.bluewin.ch';
var accountId     = 'ABW0X0INEW2Q';
var companyName   = 'Massey+Ferguson';
var htmlTitle	  = '';
var metaKeywords  = 'massey+ferguson++bruno+balmer+Traktoren';
var metaContents  = 'bruno+balmer+massey+ferguson+patrick+balmer+sabrina+balmer+traktoren+m%EF%BF%BDhdrescher+mffan+www.balmer-mf.ch++schneer%EF%BF%BDumung+ferguson+ferien+modelle++schwingen+mf-traktoren+Traktoren+Pfl%EF%BF%BDgen+Mulchen+Lohnarbeiten+Portugal+USA+Europa+Landmaschinen+MF8690+tractors+tractores+trecker+mf3065+';
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();
};
