/* XSLT-Konfiguration ANFANG *************************************************************/

var marketKey = 'G3-18-371'; // '3-5-41';
var entriesPerPage = 10;
var cookieDays = 36500;
var allowNoPrice = false;

var vehicleTypes = [1, 3, 4, 5, 6, 8];
var preselect = {};

var showExtras = {
	aircondition: 8,
	leather: 99,
	boardcomputer: 50,
	central_locking: 43,
	sunroof: 38,
	seat_heater: 39,
	allwheel: 13,
	speed_control: 62,
	coupling: 73,
	particle_filter: 340,
	aux_heating: 60,
	navi: 36,
	vat: 'vat',
	metallic: 'metallic',
	has_pic: 'has_pic',
	private_ad: 'private_ad'
}

var contents = {
	result: {
		header: {
			xml: '/soap/kfz/?gw=search&count_only=1',
			xsl: modixDatadir + '/xsl/header_result.xsl',
			box: 'resultheader',
			callBack: [ viewSearchString, viewPinboardCounter ]
		},
		body: {
			xml: '/soap/kfz/?gw=search&sparse_mode=1&mdx_v1=250&logLimit=1000',
			xsl: modixDatadir + '/xsl/result_list.xsl',
			box: 'resultbody',
			callBack: [ setEntriesPerPage, setSort, copyPageNumbers, function() { window.scroll(0, 0); }, function () { if (document.getElementById("noVehiclesFound") == undefined) {
				if(!market) return;
				var param = market.b64decode(location.search.substr(1));
				if(param.match(/manufacturer=(\d+)/)) {
					contents['personal_offers1']['body']['xml'] = '/soap/kfz/?gw=search&sparse_mode=1&limit=1&mdx_v1=90&random=1&has_pic=1&manufacturer=' + RegExp.$1 + '&dkey=' + topoffer3_dkey;
				}
				if(param.match(/ctype=([0-9\|]+)/)) {
					var tab = 1;
					switch (param.match(/ctype=([0-9\|]+)/)[1])
					{
						case '5': tab = 2; break;
						case '4': tab = 3; break;
						case '3||6||7': tab = 4; break;
						case '8': tab = 5; break;
					}
					document.getElementById('mdxMenuP').style.display = (tab == 1 ? 'block' : 'none');
					document.getElementById('mdxMenuM').style.display = (tab == 2 ? 'block' : 'none');
					document.getElementById('mdxMenuW').style.display = (tab == 3 ? 'block' : 'none');
					document.getElementById('mdxMenuN').style.display = (tab == 4 ? 'block' : 'none');
					document.getElementById('mdxMenuA').style.display = (tab == 5 ? 'block' : 'none');

					market.carType = param.match(/ctype=([0-9\|]+)/)[1];
				}
				market.loadSection('personal_offers1');
			} } ]
		},
		footer: {
			xml: '/soap/kfz/?gw=search&count_only=1',
			xsl: modixDatadir + '/xsl/footer_result.xsl',
			box: 'resultfooter',
			callBack: [ viewPinboardCounter2, resultListPageSwitcher ]
		}
	},
	result_compare: {
		body: {
			xml: '/soap/kfz/?gw=search&limit=15',
			xsl: modixDatadir + '/xsl/result_compare.xsl',
			box: 'pinboard'
		}
	},
	total_cars: {
		body: {
			xml: '/soap/kfz/?gw=search&count_only=1',
			xsl: modixDatadir + '/xsl/total_cars.xsl',
			box: 'totalcars'
		}
	},
	details_result: {
		body: {
			xml: '/soap/kfz/?gw=search',
			xsl: modixDatadir + '/xsl/details_view.xsl',
			box: 'details',
			callBack: [ viewPinboardCounter, function () { document.getElementById('ad_banner').innerHTML = document.getElementById('nfy_banner_1').innerHTML; } ]
		}
	},
	details_print: {
		body: {
			xml: '/soap/kfz/?gw=search',
			xsl: modixDatadir + '/xsl/details_print.xsl',
			box: 'popup',
			width: 600,
			height: 510
		}
	},
	details_pinboard: {
		body: {
			xml: '/soap/kfz/?gw=search',
			xsl: modixDatadir + '/xsl/details_pinboard.xsl',
			box: 'details',
			callBack: [ viewPinboardCounter, function () { document.getElementById('ad_banner').innerHTML = document.getElementById('nfy_banner_1').innerHTML; } ]
		}
	},
	xxlpictures: {
		body: {
			xml: '/soap/kfz/?gw=search',
			xsl: modixDatadir + '/xsl/xxlpictures.xsl',
			box: 'popup',
			width: 750,
			height: 570
		}
	},
	searchmask_id: {
		body: {
			xml: '/soap/kfz/?gw=search_form',
			xsl: modixDatadir + '/xsl/searchmask_id.xsl',
			box: 'searchmask_id'
		}
	},
	searchmask_id2: {
		body: {
			xml: '/soap/kfz/?gw=search_form',
			xsl: modixDatadir + '/xsl/searchmask_id2.xsl',
			box: 'searchmask_id2',
			callBack: [ viewTotalCars, function () { if (document.getElementById("carsfound")) { document.getElementById("carsfoundq").innerHTML = document.getElementById("carsfound").innerHTML; } } ]
		}
	},
	searchmask_id3: {
		body: {
			xml: '/soap/kfz/?gw=search_form',
			xsl: modixDatadir + '/xsl/searchmask_id3.xsl',
			box: 'searchmask_id3',
			callBack: [ viewTotalCars ]
		}
	},
	searchmask_small: {
		body: {
			xml: '/soap/kfz/?gw=search_form&allManufacturers=1&allModels=1',
			xsl: modixDatadir + '/xsl/searchmask_small.xsl',
			box: 'searchmask_small',
			callBack: [ function () {
				if (location.search.substr(1).match(/suche=([a-z]+)/))
				{
					if (location.search.substr(1).match(/suche=([a-z]+)/)[1] != 'p')
					{
						document.getElementById('model').style.display = 'none';
						document.getElementById('modelReset').style.display = 'none';
						document.getElementById('modelTitle').style.display = 'none';
					}
				}
				else
				{
					var param = market.b64decode(location.search.substr(1));
					if(param.match(/ctype=([0-9\|]+)/)) {
						if (param.match(/ctype=([0-9\|]+)/)[1] != '1')
						{
							document.getElementById('model').style.display = 'none';
							document.getElementById('modelReset').style.display = 'none';
							document.getElementById('modelTitle').style.display = 'none';
						}
					}
				}

			} ]
		}
	},
	searchmask: {
		body: {
			xml: '/soap/kfz/?gw=search_form&allManufacturers=1&allModels=1',
			xsl: modixDatadir + '/xsl/searchmask.xsl',
			box: 'searchmask',
			callBack: [ viewTotalCars, updateBuildIcons, function () {
				if (document.getElementById("carsfoundq") && document.getElementById("carsfound")) { document.getElementById("carsfoundq").innerHTML = document.getElementById("carsfound").innerHTML; }
				if (maskExtrasBox) { expandExtras(); } 

				if (location.search.substr(1).match(/suche=([a-z]+)/))
				{
					if (location.search.substr(1).match(/suche=([a-z]+)/)[1] != 'p')
					{
						document.getElementById('model').style.display = 'none';
						document.getElementById('modelReset').style.display = 'none';
						document.getElementById('modelTitle').style.display = 'none';
//						document.getElementById('modelSearchstring').style.display = 'block';
//						document.getElementById('modelSearchstring').value = '';
					}
				}
				else
				{
					var param = market.b64decode(location.search.substr(1));
					if(param.match(/ctype=([0-9]+)/)) {
						if (param.match(/ctype=([0-9]+)/)[1] != '1')
						{
							document.getElementById('model').style.display = 'none';
							document.getElementById('modelReset').style.display = 'none';
							document.getElementById('modelTitle').style.display = 'none';
//							document.getElementById('modelSearchstring').style.display = 'block';
							if (param.match(/searchstring=([^&]+)/))
							{
//								document.getElementById('modelSearchstring').value = param.match(/searchstring=([^&]+)/)[1];
							}
						}
					}
				}

			} ]
		}
	},
	carbuild: {
		body: {
			xml: '/soap/kfz/?gw=build_list',
			xsl: modixDatadir + '/xsl/carbuild.xsl',
			box: 'carbuild',
			callBack: initType
		}
	},
	pinboard_view: {
		body: {
			xml: '/soap/kfz/?gw=pinboard&sparse_mode=1&action=get',
			xsl: modixDatadir + '/xsl/pinboard_view.xsl',
			box: 'pinboard'
		}
	},
	pinboard_print: {
		body: {
			xml: '/soap/kfz/?gw=pinboard&sparse_mode=1&action=get',
			xsl: modixDatadir + '/xsl/pinboard_print.xsl',
			box: 'popup',
			width: 700,
			height: 500
		}
	},
	pinboard_counter: {
		body: {
			xml: '/soap/kfz/?gw=pinboard&action=count',
			xsl: modixDatadir + '/xsl/pinboard_counter.xsl',
			box: 'pinboardcounter'
		}
	},
	pinboard_counter2: {
		body: {
			xml: '/soap/kfz/?gw=pinboard&action=count',
			xsl: modixDatadir + '/xsl/pinboard_counter.xsl',
			box: 'pinboardcounter2',
			reloadData: true
		}
	},
	pinboard_add: {
		body: {
			xml: '/soap/kfz/?gw=pinboard&action=add',
			xsl: modixDatadir + '/xsl/pinboard_counter.xsl',
			box: 'pinboardcounter'
		}
	},
	pinboard_remove: {
		body: {
			xml: '/soap/kfz/?gw=pinboard&action=remove',
			xsl: modixDatadir + '/xsl/pinboard_counter.xsl',
			box: 'pinboard'
		}
	},
	pinboard_remove_all: {
		body: {
			xml: '/soap/kfz/?gw=pinboard&action=remove_all',
			xsl: modixDatadir + '/xsl/pinboard_counter.xsl',
			box: 'pinboard'
		}
	},
	lastsearches: {
		body: {
			xml: '/soap/kfz/?gw=last_user_searches&limit=20',
			xsl: modixDatadir + '/xsl/lastsearches.xsl',
			box: 'lastsearches'
		}
	},
	personal_offers1: {
		body: {
			xml: '/soap/kfz/?gw=search&sparse_mode=1&limit=1&mdx_v1=90&random=1&has_pic=1&dkey=' + topoffer3_dkey,
			xsl: modixDatadir + '/xsl/personal_offers1.xsl',
			box: 'personaloffers1'
		}
	},
	personal_offers1b: {
		body: {
			xml: '/soap/kfz/?gw=search&sparse_mode=1&limit=1&mdx_v1=90&random=1&has_pic=1&dkey=' + topoffer3_dkey,
			xsl: modixDatadir + '/xsl/personal_offers1.xsl',
			box: 'personaloffers1'
		}
	},
	personal_offers2: {
		body: {
			xml: '/soap/kfz/?gw=search&limit=1&mdx_v1=150&random=1&has_pic=1&dkey=' + topoffer_dkey,
			xsl: modixDatadir + '/xsl/personal_offers2.xsl',
			box: 'personaloffers2'
		}
	},
	personal_offers3: {
		body: {
			xml: '/soap/kfz/?gw=search&sparse_mode=1&limit=3&mdx_v1=80&random=1&has_pic=1&dkey=' + topoffer2_dkey,
			xsl: modixDatadir + '/xsl/personal_offers3.xsl',
			box: 'personaloffers3'
		}
	},
	personal_offers4: {
		body: {
			xml: '/soap/kfz/?gw=search&sparse_mode=1&limit=1&mdx_v1=150&random=1&has_pic=1' + window.location.search.replace(/\?/g, "&"),
			xsl: modixDatadir + '/xsl/personal_offers4.xsl',
			box: 'personaloffers4',
			callBack: [ function () { if (document.getElementById("noVehiclesFound") != null) market.loadSection('personal_offers5'); } ]
		}
	},
	personal_offers5: {
		body: {
			xml: '/soap/kfz/?gw=search&sparse_mode=1&limit=1&mdx_v1=150&random=1&has_pic=1',
			xsl: modixDatadir + '/xsl/personal_offers4.xsl',
			box: 'personaloffers4'
		}
	},
	loadinfo: '<img src="' + modixDatadir + '/images/loading.gif" style="position:relative; z-index:100000; left:50%; top:50%; width:25px; height:25px; margin-left:-12px; margin-top:-12px;"/>',
	resultpages: 'resultPages'
}

cmMsg['pinboardVehicleSaved'] = 'Das Fahrzeug wurde auf der Merkliste hinterlegt.';
cmMsg['pinboardVehicleRemoved'] = 'Das Fahrzeug wurde von der Merkliste entfernt.';
cmMsg['pinboardCleared'] = 'Alle Fahrzeuge wurden von der Merkliste entfernt.';
cmMsg['recMailSubject'] = 'Interessantes Fahrzeug bei der Frankenpost';
cmMsg['recMailBody'] = 'Ich habe ein interessantes Fahrzeug gefunden:\n';

/* XSLT-Konfiguration ENDE ***************************************************************/
