/* [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','401',jdecode('WebCreator'),jdecode(''),'/401.html','true',[],'',''],
	['PAGE','7201',jdecode('Unser+Service'),jdecode(''),'/7201.html','true',[],'',''],
	['PAGE','452',jdecode('Unser+Angebot'),jdecode(''),'/452/index.html','true',[ 
		['PAGE','12901',jdecode('Unser+Angebot+%28Folgeseite%29'),jdecode(''),'/452/12901.html','false',[],'',''],
		['PAGE','494',jdecode('Gebrauchtwagen'),jdecode(''),'/452/494.html','true',[],'',''],
		['PAGE','6801',jdecode('Rarit%C3%A4ten'),jdecode(''),'/452/6801.html','true',[],'','']
	],'',''],
	['PAGE','725',jdecode('Kontakt'),jdecode(''),'/725/index.html','true',[ 
		['PAGE','10001',jdecode('Kontakt+%28Folgeseite%29'),jdecode(''),'/725/10001.html','false',[],'','']
	],'',''],
	['PAGE','9701',jdecode('Anfahrtsplan'),jdecode(''),'/9701.html','true',[],'',''],
	['PAGE','11001',jdecode('Routenplaner'),jdecode(''),'/11001.html','true',[],'',''],
	['PAGE','830',jdecode('Impressum'),jdecode(''),'/830.html','true',[],'',''],
	['PAGE','13201',jdecode('...+weiteres+...'),jdecode(''),'/13201.html','true',[],'','']];
var siteelementCount=12;
theSitetree.topTemplateName='Sportive';
theSitetree.paletteFamily='F6F6E6';
theSitetree.keyvisualId='2660';
theSitetree.keyvisualName='auto3.jpg';
theSitetree.fontsetId='220';
theSitetree.graphicsetId='260';
theSitetree.contentColor='000000';
theSitetree.contentBGColor='F6F6E6';
var localeDef={
  language: 'de',
  country: 'CH'
};
var theTemplate={
				hasFlashNavigation: 'false',
				hasFlashLogo: 	'false',
				hasFlashCompanyname: 'false',
				hasFlashElements: 'false',
				hasCompanyname: 'false',
				name: 			'Sportive',
				paletteFamily: 	'F6F6E6',
				keyvisualId: 	'2660',
				keyvisualName: 	'auto3.jpg',
				fontsetId: 		'220',
				graphicsetId: 	'260',
				contentColor: 	'000000',
				contentBGColor: 'F6F6E6',
				a_color: 		'F6F6E6',
				b_color: 		'CCCCC0',
				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['1006']=webappMappings['1006-1006']={
webappId:    '1006',
documentId:  '401',
internalId:  '1006',
customField: '1006'
};
webappMappings['2001']=webappMappings['2001-location']={
webappId:    '2001',
documentId:  '9701',
internalId:  'location',
customField: 'language:de;country:CH;isIncluded:false;'
};
webappMappings['7008']=webappMappings['7008-1108']={
webappId:    '7008',
documentId:  '452',
internalId:  '1108',
customField: 'language:de;country:CH;'
};
webappMappings['2002']=webappMappings['2002-routing']={
webappId:    '2002',
documentId:  '11001',
internalId:  'routing',
customField: 'de_CH'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '401',
internalId:  '',
customField: '20090416-102422'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '7201',
internalId:  '',
customField: '20070712-094326'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '452',
internalId:  '',
customField: '20070712-100449'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '494',
internalId:  '',
customField: '20070712-100544'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '6801',
internalId:  '',
customField: '20070710-105249'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '725',
internalId:  '',
customField: '20070710-112708'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '9701',
internalId:  '',
customField: '20070710-112521'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '11001',
internalId:  '',
customField: '20070712-100627'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '830',
internalId:  '',
customField: '20070712-100727'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '13201',
internalId:  '',
customField: '20090416-102815'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '12901',
internalId:  '',
customField: '20070712-100159'
};
webappMappings['5000']=webappMappings['5000-']={
webappId:    '5000',
documentId:  '10001',
internalId:  '',
customField: '20070710-112107'
};
webappMappings['7008']=webappMappings['7008-1107']={
webappId:    '7008',
documentId:  '725',
internalId:  '1107',
customField: 'language:de;country:CH;'
};
var canonHostname = 'wsc-lin-224-186.genotec.ch';
var accountId     = 'AGT010IN21BV';
var companyName   = 'Auto+Occasionen-Finder';
var htmlTitle	  = 'Homepage%2FWebseite+f%C3%BCr+das+Garagengewerbe%2C+Occasion-H%C3%A4ndler%2C+Auto-Liebhaber%2C+Auto%2C+Garage%2C+Homepage';
var metaKeywords  = 'webcreator%2C+cm4all%2C+webseite%2C+website%2C+homepage%2C+erstellen%2C+auto%2C+autogewerbe%2C+garage%2C+autoh%C3%A4ndler%2C+occasion%2C+gebrauchtfahrzeug%2C+gebrauchtfahrzeuge%2C+rarit%C3%A4t%2C+rarit%C3%A4ten%2C+oldtimer%2C+auto-club%2C+fan%2C+club';
var metaContents  = 'Homepage-Tool+WebCreator+-+Ihre+Homepage+ohne+html-Kenntnisse%21+Der+Auto-Occasionen-Finder+sucht+f%C3%BCr+Sie+ausgesuchte+Rarit%C3%A4ten+auf+dem+Weltmarkt+der+Oldtimer';
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();
};

