/**
Jquery 1.2.6 functies

- Form reset: <a id="reset_form">
- Showvalues haalt resultaten op uit ajax_sawadee_zoeker.php en stopt ze in <span id="ajax_result">
- Aangepast 20 January 2010
-

*/

function commonTemplate(item) {
	return "<option value='" + item.Value + "'>" + item.Text + "</option>"; 
};


function commonMatch(selectedValue) {
	return this.When == selectedValue; 
};


function showValues() {
	 $.ajax({
		 type: "GET",
		 url: "/zoekreizen/ajax_sawadee_zoeker.php",
		 data: 'ajax=true&'+$("#zoekform").serialize(),
		 success: function(result){
			 $("#ajax_result").text(result).highlightFade({color:'#ff9900',speed:1000,iterator:'sinusoidal'});
		 }
	 });
};


$(document).ready(function(){
	
		$("#land").cascade("#regio",{					
				list: list1,			
				template: commonTemplate,
				match: commonMatch 			
		});
	   
		$(".toggle_container").hide();

		$("h4.trigger").toggle(function(){
			$(this).addClass("active"); 
			}, function () {
			$(this).removeClass("active");
		});
		
		$("h4.trigger").click(function(){
			$(this).next(".toggle_container").slideToggle("slow,");
		});

		$("#reset_form").click(function() 
		{ 
		  $(':input','#zoekform')
			 .not(':button, :submit, :reset, :hidden')
			 .val('')
			 .removeAttr('checked')
			 .removeAttr('selected');
			 showValues();
			 return false;
		}); 
		
		
		$("select", "#zoekform").change(showValues);
		showValues(); // do initial full search on page load.
			
		
}); 
