	var MAC = ( navigator.appVersion.indexOf("Macintosh") != -1 )
	var IE = ( navigator.appVersion.indexOf("MSIE") != -1 )

// Resultaat_Refine.asp
		function Change( oSelect )
		{
			oInput.value = oSelect[oSelect.selectedIndex].text
		}

// Zoek_Uitgebreid_Adres.asp

		function CheckFormAdres()
		{
			document.zoeken.sfPostcode.value
			document.zoeken.sfHuisnr.value
			document.zoeken.plaatspostcode.value
			document.zoeken.sfStraatnaam.value
			
			if ( (document.zoeken.plaatspostcode.value == '' || document.zoeken.sfStraatnaam.value == '') && (document.zoeken.sfPostcode.value == '' || document.zoeken.sfHuisnr.value == '') )
			{
				if ( document.zoeken.plaatspostcode.value != '' && document.zoeken.sfPostcode.value == '' )
				{
					alert('Vul de combinatie plaatsnaam en straatnaam in')
				}
				else if ( document.zoeken.plaatspostcode.value == '' && document.zoeken.sfPostcode.value != '' )
				{
					alert('Vul de combinatie postcode en huisnummer in')
				}
				else
				{
					alert('Vul de combinatie postcode - huisnummer of plaatsnaam - straatnaam in')
				}
				return false
			}
			return true
		}

// Zoek_Uitgebreid_Plaats.asp

		var aCatSoorten = new Array
								(
									[0,'',''],
									[1, 'WA', 'Bovenwoning'],
									[2, 'WW', 'Eengezinswoning'],
									[3, 'WA', 'Benedenwoning'],
									[4, 'WW', 'Eenvoudige woning'],
									[5, 'WA', 'Maisonnette'],
									[6, 'WW', 'Herenhuis'],
									[7, 'WA', 'Galerijflat'],
									[8, 'WW', 'Villa'],
									[9, 'WA', 'Portiekflat'],
									[10, 'WW', 'Landhuis'],
									[11, 'WA', 'Beneden + bovenwoning'],
									[12, 'WW', 'Bungalow'],
									[13, 'WA', 'Verzorgingsflat'],
									[14, 'WW', 'Woonboerderij'],
									[15, 'WW', 'Grachtenpand'],
									[16, 'WW', 'Woonboot'],
									[17, 'WW', 'Stacaravan'],
									[18, 'WW', 'Landgoed']
									//[19, 'WW', 'Recreatiewoning'],
								)

		function initPlaats()
		{
			sPlaatsenLinks = document.getElementById('SELECTBOX').innerHTML
			aPlaatsnamen = document.zoeken.plaatsnamen.value.split(',')
			//aPlaatsIDs = document.zoeken.mplaats.value.split(',')
			for ( i=1; i<aPlaatsnamen.length-1; i++ )
			{
				//sValue = ( aPlaatsIDs.length > i ? aPlaatsIDs[i] : aPlaatsnamen[i] )
				sValue = aPlaatsnamen[i];
				document.zoeken.plaats_dest.options[document.zoeken.plaats_dest.options.length] = new Option(aPlaatsnamen[i], sValue)
			}
			RemoveDouble()
		}
		
		function NaarRechts()
		{
			oVan = document.zoeken.plaats_src
			oNaar = document.zoeken.plaats_dest
			nMax = 5
			if ( CheckTransaction(oVan, oNaar, nMax, true) == false )
			{
				alert('U kunt niet meer dan 5 plaatsen selecteren')
			}
			if ( document.zoeken.plaats_dest.length > 1 )
			{
				// Straal niet mogelijk bij meerdere plaatsen
				//document.zoeken.straal.selectedIndex = 0
				//document.zoeken.straal.disabled = true
			}
		}
		
		function NaarLinks()
		{
			oVan = document.zoeken.plaats_dest
			oNaar = document.zoeken.plaats_src
			for( ii=oVan.options.length-1; ii>-1; ii-- )
			{
				sPlaats = oVan.options[ii].text
				sID = oVan.options[ii].value
				if ( oVan.options[ii].selected == true && sPlaatsenLinks.indexOf('>' + sPlaats + '<') == -1 )
				{
					oVan.options[ii] = null
					//document.zoeken.mplaats.value = document.zoeken.mplaats.value.replace(',' + sID + ',',',')
					document.zoeken.plaatsnamen.value = document.zoeken.plaatsnamen.value.replace(',' + sPlaats + ',',',')
				}
			}
			nMax = 10000
			CheckTransaction(oVan, oNaar, nMax, false)
			if ( document.zoeken.plaats_dest.length < 2 )
			{
				// Straal niet mogelijk bij meerdere plaatsen
				//document.zoeken.straal.disabled = false
			}
		}
		
		function CheckTransaction(oVan, oNaar, nMax, bSelect)
		{
			var ii
			aSelected = new Array()
			oSelect = document.zoeken.plaats_src
			for( ii=oVan.options.length-1; ii>-1; ii-- )
			{
				if ( oVan.options[ii].selected == true )
				{
					aSelected[aSelected.length] = ii
				}
			}
			if ( aSelected.length + oNaar.options.length <= nMax )
			{
				StartTransaction(oVan, oNaar, aSelected, bSelect)
				return true
			}
			else
			{
				return false
			}
		}
		
		function StartTransaction(oVan, oNaar, aSelected, bSelect)
		{
			var ii
			for( ii=0; ii<aSelected.length; ii++ )
			{
				oOption = oVan.options[aSelected[ii]]
				if ( bSelect )
				{
					//document.zoeken.mplaats.value += oOption.value + ','
					document.zoeken.plaatsnamen.value += oOption.text + ','
				}
				else
				{
					//document.zoeken.mplaats.value = document.zoeken.mplaats.value.replace(',' + oOption.value + ',',',')
					document.zoeken.plaatsnamen.value = document.zoeken.plaatsnamen.value.replace(',' + oOption.text + ',',',')
				}
				oNew = new Option(oOption.text, oOption.value)
				n = 0
				for(j=0;j<oNaar.options.length;j++)
				{
					if ( MakeCap(oNaar.options[j].text) < MakeCap(oOption.text) )
					{
						n = j+1
					}
				}
				InsertOption(oNaar, oNew, n)
				oVan.options[aSelected[ii]] = null
				oNaar.selectedIndex = n
			}
		}
		
		function InsertOption(oNaar, oNew, nPlace)
		{
			oNaar.options.length ++
			var ii
			for( ii=oNaar.options.length-1; ii>nPlace; ii--)
			{
				oNaar.options[ii].text = oNaar.options[ii-1].text
				oNaar.options[ii].value = oNaar.options[ii-1].value
			}
			oNaar.options[nPlace] = oNew
		}
		
		function MakeCap(s)
		{
			while ( s.indexOf('\'') > -1 )
			{
				s = s.replace('\'','')
			}
			return s
		}
		
		function provincieChange(oProvincieSelect)
		{
			sProvincieCode = oProvincieSelect.options[oProvincieSelect.selectedIndex].value
			oXMLHTTP = false
			if ( sProvincieCode != '' )
			{
				// IE mac moet meteen geredirect worden
				if ( MAC && IE )
				{
					//document.zoeken.action = 'zoeken_uitgebreid_plaats.asp'
					document.zoeken.submit()
				}

				// ActiveXObject voor IE, XMLHttpRequest voor firefox
				if ( window.ActiveXObject ) oXMLHTTP = new ActiveXObject("Microsoft.XMLHTTP")
				if ( window.XMLHttpRequest ) oXMLHTTP = new XMLHttpRequest()

				if ( !oXMLHTTP )
				{
					// pagina verversen voor antieke browsers
					//document.zoeken.action = 'zoeken_uitgebreid_plaats.asp'
					document.zoeken.submit()
				}
				else
				{
					oXMLHTTP.onreadystatechange = function()
					{
						if (oXMLHTTP.readyState == 4)
						{
							document.getElementById('SELECTBOX').innerHTML = oXMLHTTP.responseText
							sPlaatsenLinks = oXMLHTTP.responseText
							RemoveDouble()
						}
					}

					//oXMLHTTP.open("GET", "plaatsen_provincie.asp?projectProvincie=" + sProvincieCode , true)
					oXMLHTTP.send(null)
				}
			}
		}
		
		function CheckFormPlaats()
		{
			if ( document.zoeken.plaats_dest.length == 0 )
			{
				/*if ( document.zoeken.provincie.selectedIndex == 0 )
				{
					alert('Kies eerst provincie, kies dan een plaatsnaam en klik op de pijl om de plaats te selecteren.')
					return false
				}
				else
				{*/
					alert('Kies een plaatsnaam en klik op de pijl naar rechts.')
					return false
				/*}*/
			}
			/*if ( document.zoeken.plaats_dest.length > 1 && document.zoeken.straal.selectedIndex > 0 )
			{
				alert('Zoeken op meerdere plaatsen en straal is niet mogelijk.')
				return false
			}*/
			//SetCurrentChoices()
			return true
		}
		
		function RemoveDouble()
		{
			for ( i=0; i<document.zoeken.plaats_src.options.length; i++ )
			{
				for ( j=0; j<document.zoeken.plaats_dest.options.length; j++ )
				{
					if ( document.zoeken.plaats_src.options[i].text == document.zoeken.plaats_dest.options[j].text )
					{
						document.zoeken.plaats_src.options[i] = null
					}
				}
			}
		}
		
		function ChangeSoortObject(oSelect)
		{
			var i, n
			sValue = oSelect.value
			nSelectedValue = document.zoeken.soort_woning.value
			bUpdate = (document.zoeken.soort_woning.options.length <= 1)
			
			for(i=1; i<document.zoeken.soort_woning.options.length; i++)
			{
				for(j=0; j<aCatSoorten.length; j++)
				{
					
					if ( aCatSoorten[j][0] == document.zoeken.soort_woning.options[i].value*1 && aCatSoorten[j][1] != sValue )
					{
						bUpdate = true
					}
				}
			}
			if ( bUpdate == true )
			{
				for(i=document.zoeken.soort_woning.options.length-1; i>-1; i--)
				{
					document.zoeken.soort_woning.options[i] = null
				}
				document.zoeken.soort_woning.options.length = 0
				n = 0
				document.zoeken.soort_woning.options[n] = new Option('Geen voorkeur', '')
				document.zoeken.soort_woning.selectedIndex = 0
				for ( i=1; i<aCatSoorten.length; i++ )
				{
					if ( aCatSoorten[i][1] == sValue || sValue == '' )
					{
						n++
						document.zoeken.soort_woning.options[n] = new Option(aCatSoorten[i][2], aCatSoorten[i][0])
						if ( nSelectedValue == aCatSoorten[i][0] )
						{
							document.zoeken.soort_woning.selectedIndex = n
						}
					}
				}
			}
			bDisabled = ( oSelect.value != 'WA' && oSelect.value != 'WW' && oSelect.value != '' )
			
			document.zoeken.soort_woning.disabled = ( oSelect.value != 'WA' && oSelect.value != 'WW' )
			document.zoeken.type_woning.disabled = ( oSelect.value != 'WW' )
			document.zoeken.bouwperiode.disabled = ( oSelect.value == 'WB' )
			document.zoeken.opp_woon.disabled = bDisabled
			document.zoeken.opp_perc.disabled = bDisabled
			document.zoeken.kamers.disabled = bDisabled
			document.zoeken.tuin.disabled = bDisabled
			document.zoeken.balkon.disabled = bDisabled
			document.zoeken.garage.disabled = bDisabled
			document.zoeken.berging.disabled = bDisabled
			document.zoeken.cv.disabled = bDisabled
			document.zoeken.openhaard.disabled = bDisabled
			document.zoeken.zwembad.disabled = bDisabled
			document.zoeken.airco.disabled = bDisabled
			//document.zoeken.gestoffeerd.disabled = bDisabled
			//document.zoeken.gemeubileerd.disabled = bDisabled
		}
		
		function ChangeSoortWoning(oSelect)
		{
			//document.zoeken.SoortWoningText.value = oSelect.options[oSelect.selectedIndex].text
			sValue = oSelect.value
			if ( sValue == '' ) return
			sValue = aCatSoorten[sValue*1][1]
			
			for(i=0; i<document.zoeken.soort_object.options.length; i++)
			{
				if ( document.zoeken.soort_object.options[i].value == sValue )
				{
					document.zoeken.soort_object.selectedIndex = i
				}
			}
			
		}
		
		function ChangeTypeWoning(oSelect)
		{
			//document.zoeken.TypeWoningText.value = oSelect.options[oSelect.selectedIndex].text
		}
		
		function ChangeLigging(oSelect)
		{
			//document.zoeken.liggingtext.value = document.zoeken.ligging.options[document.zoeken.ligging.selectedIndex].text
		}
		
		function ChangePrijsMax()
		{
			if ( document.zoeken.sfPrijsMin.selectedIndex > document.zoeken.sfPrijsMax.selectedIndex )
			{
				document.zoeken.sfPrijsMin.selectedIndex = document.zoeken.sfPrijsMax.selectedIndex
			}
		}
		function ChangePrijsMin()
		{
			if ( document.zoeken.sfPrijsMin.selectedIndex > document.zoeken.sfPrijsMax.selectedIndex )
			{
				document.zoeken.sfPrijsMax.selectedIndex = document.zoeken.sfPrijsMin.selectedIndex
			}
		}
		
		function OnLoadPlaats()
		{
			/*ChangeSoortObject(document.zoeken.soort_object)
			if ( document.zoeken.provincie.selectedIndex > 0 && document.zoeken.plaats_src.options.length == 0 )
			{
				provincieChange(document.zoeken.provincie.value)
			}*/
			initPlaats()
			if ( document.zoeken.plaats_dest.length > 1 )
			{
				// Straal niet mogelijk bij meerdere plaatsen
				//document.zoeken.straal.selectedIndex = 0
				//document.zoeken.straal.disabled = true
			}
			//document.zoeken.SoortWoningText.value = document.zoeken.soort_woning.options[document.zoeken.soort_woning.selectedIndex].text
			//document.zoeken.TypeWoningText.value = document.zoeken.type_woning.options[document.zoeken.type_woning.selectedIndex].text
			//document.zoeken.liggingtext.value = document.zoeken.ligging.options[document.zoeken.ligging.selectedIndex].text
		}
		
		function SubmitZoekPlaats()
		{
			if ( document.zoeken.plaats_dest.length == 0 )
			{
				/*if ( document.zoeken.provincie.selectedIndex == 0 )
				{
					alert('Kies eerst provincie, kies dan een plaatsnaam en klik op de pijl om de plaats te selecteren.')
					return false
				}
				else
				{*/
					alert('Kies een plaatsnaam en klik op de pijl naar rechts.')
					return false
				/*}*/
			}
			/*if ( document.zoeken.plaats_dest.length > 1 && document.zoeken.straal.selectedIndex > 0 )
			{
				alert('Zoeken op meerdere plaatsen en straal is niet mogelijk.')
				return false
			}*/
			//SetCurrentChoices()
			return true
		}
		
// Zoek_Uitgebreid_Postcode.asp

		function CheckFormPostcode()
		{
			//SetCurrentChoices()
			if ( document.zoeken.postcode[0].value == '' && document.zoeken.postcode[1].value == '' && document.zoeken.postcode[2].value == '' && document.zoeken.postcode[3].value == '' )
			{
				alert('Vul een postcode in.')
				return false
			}
			if ( document.zoeken.straal.selectedIndex > 0 )
			{
				n = 0
				for(i=0; i<4; i++)
				{
					if ( document.zoeken['postcode'][i].value != '' ) n++
				}
				if ( n > 1 )
				{
					alert('Zoeken op meerdere plaatsen en straal is niet mogelijk.')
					return false
				}
			}
			bFormOK = true
			bFormOK = ( CheckPostcode(0) == false ? false : bFormOK )
			bFormOK = ( CheckPostcode(1) == false ? false : bFormOK )
			bFormOK = ( CheckPostcode(2) == false ? false : bFormOK )
			bFormOK = ( CheckPostcode(3) == false ? false : bFormOK )
			VulPostcode()
			return bFormOK
		}
		
		function VulPostcode()
		{
			var s = ''
			for(i=0; i<4; i++)
			{
				if ( document.zoeken['postcode'][i].value != '' )
				{
					s += ( s != '' ? ',' : '' ) + document.zoeken['postcode'][i].value
				}
			}
			if ( s.indexOf(',') > -1 )
			{
				document.zoeken.mpc.value = s
				document.zoeken.plaatspostcode.value = ''
			}
			else
			{
				document.zoeken.mpc.value = ''
				document.zoeken.plaatspostcode.value = s
			}
		}
		
		function CheckPostcode(n)
		{
			sPostcode = document.zoeken['postcode'][n].value
			if ( sPostcode != '' )
			{
				Cijfers = parseInt(sPostcode)+''
				if ( Cijfers.length < 4 )
				{
					alert('Vul bij postcode ' + (n+1) + ' minimaal 4 cijfers in.')
					return false
				}
			}
			return true
		}
		
		function OnLoadPostcode()
		{
			ChangeSoortObject(document.zoeken.soort_object)
			//document.zoeken.SoortWoningText.value = document.zoeken.soort_woning.options[document.zoeken.soort_woning.selectedIndex].text
			//document.zoeken.TypeWoningText.value = document.zoeken.type_woning.options[document.zoeken.type_woning.selectedIndex].text
			//document.zoeken.liggingtext.value = document.zoeken.ligging.options[document.zoeken.ligging.selectedIndex].text
		}
		
// Zoek_Uitgebreid_Postcode.asp EN Zoek_Uitgebreid_Plaats.asp

		function SetCurrentChoices()
		{
			var sCurrentChoices = ''
			sCurrentChoices += CheckSelect('soort_bouw', 'b', '0201')
			sCurrentChoices += CheckSelect('soort_bouw', 'n', '0202')
			sCurrentChoices += CheckSelect('soort_object', 'WW', '0301')
			sCurrentChoices += CheckSelect('soort_object', 'WA', '0302')
			sCurrentChoices += CheckSelect('soort_object', 'WB', '0303')
			sCurrentChoices += CheckSelect('soort_object', 'WG', '0304')
			
			sCurrentChoices += CheckSelect('soort_woning', '2', '0401')
			sCurrentChoices += CheckSelect('soort_woning', '4', '0402')
			sCurrentChoices += CheckSelect('soort_woning', '6', '0403')
			sCurrentChoices += CheckSelect('soort_woning', '8', '0404')
			sCurrentChoices += CheckSelect('soort_woning', '10', '0405')
			sCurrentChoices += CheckSelect('soort_woning', '12', '0406')
			sCurrentChoices += CheckSelect('soort_woning', '14', '0407')
			sCurrentChoices += CheckSelect('soort_woning', '15', '0408')
			sCurrentChoices += CheckSelect('soort_woning', '16', '0409')
			sCurrentChoices += CheckSelect('soort_woning', '17', '0410')
			sCurrentChoices += CheckSelect('soort_woning', '18', '0411')
			sCurrentChoices += CheckSelect('soort_woning', '19', '0412')
			sCurrentChoices += CheckSelect('soort_woning', '23', '0413')
			
			sCurrentChoices += CheckSelect('type_woning', '1', '0501')
			sCurrentChoices += CheckSelect('type_woning', '2', '0502')
			sCurrentChoices += CheckSelect('type_woning', '3', '0503')
			sCurrentChoices += CheckSelect('type_woning', '4', '0504')
			sCurrentChoices += CheckSelect('type_woning', '5', '0505')
			sCurrentChoices += CheckSelect('type_woning', '999', '0506')

			sCurrentChoices += CheckSelect('soort_woning', '1', '0601')
			sCurrentChoices += CheckSelect('soort_woning', '3', '0602')
			sCurrentChoices += CheckSelect('soort_woning', '5', '0603')
			sCurrentChoices += CheckSelect('soort_woning', '7', '0604')
			sCurrentChoices += CheckSelect('soort_woning', '9', '0605')
			sCurrentChoices += CheckSelect('soort_woning', '11', '0606')
			sCurrentChoices += CheckSelect('soort_woning', '13', '0607')
			sCurrentChoices += CheckSelect('soort_woning', '20', '0608')

			sCurrentChoices += CheckSelect('ligging', '7', '1201')
			sCurrentChoices += CheckSelect('ligging', '8', '1202')
			sCurrentChoices += CheckSelect('ligging', '9', '1203')
			sCurrentChoices += CheckSelect('ligging', '10', '1204')
			sCurrentChoices += CheckSelect('ligging', '11', '1205')
			sCurrentChoices += CheckSelect('ligging', '12', '1206')
			sCurrentChoices += CheckSelect('ligging', '13', '1207')
			sCurrentChoices += CheckSelect('ligging', '14', '1208')
			sCurrentChoices += CheckSelect('ligging', '15', '1209')
			sCurrentChoices += CheckSelect('ligging', '16', '1210')
			sCurrentChoices += CheckSelect('ligging', '17', '1211')
			
			sCurrentChoices += CheckSelect('kamers', '1', '0702')
			sCurrentChoices += CheckSelect('kamers', '2', '0703')
			sCurrentChoices += CheckSelect('kamers', '3', '0704')
			sCurrentChoices += CheckSelect('kamers', '4', '0705')
			sCurrentChoices += CheckSelect('kamers', '5', '0706')
			sCurrentChoices += CheckSelect('opp_woon', '-50', '0901')
			sCurrentChoices += CheckSelect('opp_woon', '50', '0902')
			sCurrentChoices += CheckSelect('opp_woon', '75', '0903')
			sCurrentChoices += CheckSelect('opp_woon', '100', '0904')
			sCurrentChoices += CheckSelect('opp_woon', '150', '0905')
			sCurrentChoices += CheckSelect('opp_woon', '250', '0906')
			sCurrentChoices += CheckSelect('opp_perc', '-250', '1001')
			sCurrentChoices += CheckSelect('opp_perc', '250', '1002')
			sCurrentChoices += CheckSelect('opp_perc', '500', '1003')
			sCurrentChoices += CheckSelect('opp_perc', '1000', '1004')
			sCurrentChoices += CheckSelect('opp_perc', '2500', '1005')
			sCurrentChoices += CheckSelect('opp_perc', '5000', '1006')
			sCurrentChoices += CheckSelect('bouwperiode', '13', '0801')
			sCurrentChoices += CheckSelect('bouwperiode', '12', '0802')
			sCurrentChoices += CheckSelect('bouwperiode', '11', '0803')
			sCurrentChoices += CheckSelect('bouwperiode', '10', '0804')
			sCurrentChoices += CheckSelect('bouwperiode', '9', '0805')
			sCurrentChoices += CheckSelect('bouwperiode', '8', '0806')
			sCurrentChoices += CheckSelect('bouwperiode', '7', '0807')
			sCurrentChoices += CheckSelect('bouwperiode', '6', '0808')
			sCurrentChoices += CheckSelect('bouwperiode', '5', '0809')

			sCurrentChoices += CheckCheckBox('tuin', '1101')
			sCurrentChoices += CheckCheckBox('balkon', '1106')
			sCurrentChoices += CheckCheckBox('garage', '1107')
			sCurrentChoices += CheckCheckBox('berging', '1105')
			sCurrentChoices += CheckCheckBox('cv', '1103')
			sCurrentChoices += CheckCheckBox('openhaard', '1104')
			sCurrentChoices += CheckCheckBox('zwembad', '1108')
			sCurrentChoices += CheckCheckBox('airco', '1102')

			document.zoeken.crrentChoices.value = sCurrentChoices
		}
		
		function CheckSelect(sName, sValue, sCurrentChoice)
		{
			oSelect = document.zoeken[sName]
			return ( oSelect[oSelect.selectedIndex].value == sValue ? sCurrentChoice : '' )
		}
		
		function CheckCheckBox(sName, sCurrentChoice)
		{
			return ( document.zoeken[sName].checked == true ? sCurrentChoice : '' )
		}
		
		function GoTab(s)
		{
			//document.zoeken.action = 'zoeken_uitgebreid_' + s + '.asp'
			document.zoeken.submit()
			return false
		}
		