/**
Jquery 1.2.6 functies

- Form reset: <a> met id=reset_form
- Showvalues haalt resultaten op en stopt in <span> met id=ajax_result

-h01 08-08-2011 genereren van extra div waar zoekresultaten in kunnen worden geplaatst voor doorgeven aan url
*/

function commonTemplate(item) {
	return "<option value='" + item.Value + "'>" + item.Text + "</option>"; 
};


function commonMatch(selectedValue) {
	return this.When == selectedValue; 
};

function showValues() {
	var str = $("#zoekform").serialize();
	// submit the form 
	 $.ajax({
		 type: "GET",
		 url: "/familieavontuur/zoekreizen/ajax_sawadee_zoeker.php",
		 data: 'ajax=true&'+$("#zoekform").serialize(),
		 success: function(result){
			 $("#ajax_result").text(result).highlightFade({color:'#ff9900',speed:1000,iterator:'sinusoidal'});
/* h01 */
			 $("#ajax_result2").text(result);
		 }
	 });
};

$(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.
			
		
}); 

