function netscapeCssFix()
{
 	if (document.WM.netscapeCssFix.initWindowWidth != window.innerWidth || document.WM.netscapeCssFix.initWindowHeight != window.innerHeight)
 	{
    	document.location = document.location;
	}
}

function netscapeCssFixCheckIn()
{
	// This function checks to make sure the version of Netscape
	// in use contains the bug; if so, it records the window's
	// width and height and sets all resize events to be handled
	// by the netscapeCssFix() function.
	if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4))
	{
    	if (typeof document.WM == 'undefined')
    	{
      		document.WM = new Object;
    	}
    	if (typeof document.WM.scaleFont == 'undefined')
    	{
      		document.WM.netscapeCssFix = new Object;
      		document.WM.netscapeCssFix.initWindowWidth = window.innerWidth;
      		document.WM.netscapeCssFix.initWindowHeight = window.innerHeight;
    	}
    	window.onresize = netscapeCssFix;
  	}
}

netscapeCssFixCheckIn()
 
function openBrWindow(theURL,winName,features)
{
	window.open(theURL,winName,features);
}
 
function centerWindow(theURL,winName,features, myWidth, myHeight, isCenter)
{
	if(document.all && navigator.appVersion.indexOf('Mac')!=-1){ myWidth -= 15; }
 
	if(window.screen)if(isCenter)if(isCenter=="true")
	{
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	return window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}
 
var arrChild1 = new Array();
 
function pd_child1(pd_lead, pd_child1)
{
	this.pd_lead = pd_lead;
	this.pd_child1 = pd_child1
}
 
function addChild1(pd_lead)
{
	pd_lead = unescape(pd_lead);
	for (var i = 1; i < arguments.length; i++)
	{
  		arrChild1[arrChild1.length] = new pd_child1(pd_lead, unescape(arguments[i]));
 	}
}

//var previousPd_lead = "-- Merk --"
 
function fillChild1(select, pd_lead, previousPd_lead)
{
	if (pd_lead == "-- Merk --") return;
	if (previousPd_lead == pd_lead)
	{
		//alert("geen change");
		return;
	}
	previousPd_lead = pd_lead;
	
	select.options.length = 1;
  	var count = 0;
 	for (var n = 0; n < arrChild1.length; n++)
 	{
  		if (arrChild1[n].pd_lead == pd_lead)
  		{
   			select.options[select.options.length] = new Option(arrChild1[n].pd_child1, arrChild1[n].pd_child1);
   			count++;
  		}
 	}
 	// set the values for the first topic and the value if no subitems where found
 	if (count == 0 && pd_lead != strLC_00206) //'Geen voorkeur'
 	{
  		select.options[0].text = strLC_00207; //'Geen modellen bekend';
 	}
 	else
 	{
  		select.options[0].text = strLC_00208;//'Maak een keuze';
  		select.options[0].value = '';	
 	}
}
 
if (document.layers && navigator.appVersion.indexOf('Mac')!=-1)
{
   document.write("<style>td{font-size:11px;}</style>");
}

var currentCarBrand;

function fnFindCars()
{
	var frmSearch = document.forms['Form1'];
	
	var lstBrand = document.getElementById("lstBrand")
	var lstModel = document.getElementById("lstModel")
	var lstType = document.getElementById("lstType")
	var lstYearFrom = document.getElementById("lstYearFrom")
	var lstYearTo = document.getElementById("lstYearTo")
	var lstKilometerFrom = document.getElementById("lstKilometerFrom")
	var lstKilometerTo = document.getElementById("lstKilometerTo")
	var lstColor = document.getElementById("lstColor")
	var lstGears = document.getElementById("lstGears")
	var lstPriceFrom = document.getElementById("lstPriceFrom")
	var lstPriceTo = document.getElementById("lstPriceTo")
	
	var rdoSortType = document.getElementById("rdoSortType")
	var rdoSortPrice = document.getElementById("rdoSortPrice")
	var rdoSortYear = document.getElementById("rdoSortYear")
	var rdoSortMileage = document.getElementById("rdoSortMileage")
	
	if (lstBrand != null) {
	    var intSelections  = lstBrand.selectedIndex;
	} else {
	    var intSelections = currentCarBrand;
	}
	intSelections += lstModel.selectedIndex;
	intSelections += lstType.selectedIndex;
	intSelections += lstYearFrom.selectedIndex;
	intSelections += lstYearTo.selectedIndex;
	intSelections += lstKilometerFrom.selectedIndex;
	intSelections += lstKilometerTo.selectedIndex;
	intSelections += lstColor.selectedIndex;
	intSelections += lstGears.selectedIndex;
	intSelections += lstPriceFrom.selectedIndex;
	intSelections += lstPriceTo.selectedIndex;
	if(intSelections == 0) 
	{
		alert(strLC_00209);
		return false;
	}
	else 
	{

	    var strUrl = "/zoekwagens/zoeken.aspx?strLang=" + escape(strLang)
	    if (lstBrand != null) {
	        if (lstBrand.selectedIndex > 0)
	            strUrl += "&strCarBrand=" + escape(lstBrand.value)
	    }
		if (lstModel.selectedIndex > 0)
		    strUrl += "&strCarType=" + escape(lstModel.value)
		if (lstType.selectedIndex > 0)
			strUrl += "&Uitvoering=" + escape(lstType.value)
		
		if (lstYearFrom.selectedIndex > 0)
			strUrl += "&BouwJaarVan=" + escape(lstYearFrom.value)
		if (lstYearTo.selectedIndex > 0)
			strUrl += "&BouwJaarTot=" + escape(lstYearTo.value)

		if (lstKilometerFrom.selectedIndex > 0)
			strUrl += "&KilometersVan=" + escape(lstKilometerFrom.value)
		if (lstKilometerTo.selectedIndex > 0)
			strUrl += "&KilometersTot=" + escape(lstKilometerTo.value)

		if (lstColor.selectedIndex > 0)
			strUrl += "&lstKleur=" + escape(lstColor.value)
		
		if (lstGears.selectedIndex > 0)
			strUrl += "&lstVersnelling=" + escape(lstGears.value)
		if (lstPriceFrom.selectedIndex > 0)
			strUrl += "&PrijsKlasseVan=" + escape(lstPriceFrom.value)
		if (lstPriceTo.selectedIndex > 0)
			strUrl += "&PrijsKlasseTot=" + escape(lstPriceTo.value)
		
		if (rdoSortType.checked)
			strUrl += "&Sort=" + rdoSortType.value
		if (rdoSortPrice.checked)
			strUrl += "&Sort=" + rdoSortPrice.value
		if (rdoSortYear.checked)
			strUrl += "&Sort=" + rdoSortYear.value
		if (rdoSortMileage.checked)
			strUrl += "&Sort=" + rdoSortMileage.value
					
		 location.href=strUrl
		return true;
	 }
}
