function moveSel(doSelect) {
   var from, to
   if (doSelect) {
      from = document.searchForm.cities
      to =   document.searchForm.city     
   } else {
      from = document.searchForm.city
      to =   document.searchForm.cities      
   }
   for (var i = 0; i < from.options.length; i++) {
      if (from.options[i].selected) {
      	
      	if (from.options[i].value=="SPIJKENISSE"){
      		(doSelect) ? showWijk(true) : showWijk(false);
      	}
      	
         for (var j = 0, child = null; j < to.options.length && !child; j++) {
            if (from.options[i].text < to.options[j].text) {
               child = to.options[j];              
            }
         }          
         to.insertBefore(from.options[i--], child)
      }
   }
}

function showWijk(show){
	if (show==false){
		document.getElementById('wijk1').style.visibility="hidden";
		document.getElementById('wijk1').style.display="none";
		document.getElementById('wijk2').style.visibility="hidden";
		document.getElementById('wijk2').style.display="none";
		document.forms[0].cities.value="";
	} else {
		document.getElementById('wijk1').style.visibility="visible";
		document.getElementById('wijk1').style.display="block";
		document.getElementById('wijk2').style.visibility="visible";
		document.getElementById('wijk2').style.display="block";
	}
}

function wijkAvailable(value){	
	if (value.value=="SPIJKENISSE"){
		showWijk(true);
	} else {
		showWijk(false);
	}
}

function formSubmit() {
	var c = "";
	f = document.forms[ 'searchForm' ];
	
	if( f.city.options.length ) {
		for( l=0;l<f.city.options.length;l++ ){
			c =c + "" + f.city.options[ l ].value ;
			if (l < f.city.options.length - 1)
				c=c+ "," ;
		}
		f.searchCities.value = c;

	}
	f.submit();
}

