// Sync flash map
function selecteerProvincie(provincie){
	if(arguments.length>0) {
		$("#provincies").val(provincie);
		//alert($("#provincies").val());
	} else {
		$("#provincies").val("");
		//alert($("#provincies").val());
	}
}
	

$(document).ready(function(){ //jquery syntax
	
	// form validation
//	$("input.submit").bind('click', function(e) {
//		e.preventDefault();
//		this.blur();
//		var params = $(this).attr("accept").split(/\s*;\s*/);
//		validateForm(params[0],params[1],params[2]);
//	});
//	
//	$(".reset").click(function(){
//		$(".notValid").removeClass("notValid").unbind("keyup").unbind("click");		   
//	});
//	
//	function validateForm(obj,required,msg){
//		var emailfilter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
//		var telefoonfilter = /^([0-9- ]{10})/;
//		var postcodefilter = /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/;
//		var frmObj = $("#"+obj)[0];
//		var errorFields = '';
//		var requiredFields = required.split (/\s*,\s*/);
//		
//		for(var i=0;i<requiredFields.length;i++){
//			var fldObj = $("#"+obj).find("#"+requiredFields[i])[0];
//				if ((fldObj.value == '' || fldObj.value == fldObj.title || fldObj.value.indexOf("< ") != -1 || fldObj.value.indexOf("-- ") != -1) || ( fldObj.title == "E-mail" && !(emailfilter.test(fldObj.value))) || ( ((fldObj.title == "Telefoonnummer")||(fldObj.title == "Mobiel")) && !(telefoonfilter.test(fldObj.value))) || fldObj.title== "Postcode" && !(postcodefilter.test(fldObj.value)) || fldObj.type=='checkbox' && !fldObj.checked ) {
//					errorFields += '- ' + fldObj.name + '\n';
//					$(fldObj).addClass("notValid");
//					$(fldObj).not("select").not(".checkbox").keyup(function() { 
//						if( (this.title== "E-mail" && emailfilter.test(this.value)) || ((this.title == "Telefoonnummer" || this.title == "Mobiel") && telefoonfilter.test(this.value)) || (this.title == "Postcode" && postcodefilter.test(this.value)) || (this.type=="checkbox" && this.value=="checked") ){
//							$(this).removeClass("notValid");
//						} else if(this.title != "E-mail" && this.title != "Telefoonnummer" && this.title != "Mobiel" && this.title != "Postcode" && this.value != '' && this.value != this.title && this.value.indexOf("< ") == -1 && this.value.indexOf("-- ") == -1) {
//							$(this).removeClass("notValid");	
//						} else {
//							$(this).addClass("notValid");
//						}
//					});
//					$(fldObj).not("input").not("textarea").click(function() {
//						if(this.value != '' && this.value.indexOf("< ") == -1 && this.value.indexOf("-- ") == -1) {
//							$(this).removeClass("notValid");
//						} else {
//							$(this).addClass("notValid");
//						}
//					});
//					$(fldObj).filter(".checkbox").click(function() {
//						if(this.checked == true) $(this).removeClass("notValid");
//						else $(this).addClass("notValid");
//					});
//					
//				}
//		}
//	
//		if(errorFields != ''){
//			alert(msg + '\n\n' + errorFields);
//		} else {
//			frmObj.submit();
//		}
//	}
	
	
	
	// prevent right click on images
	$("img").bind('contextmenu', function(e) {
		e.preventDefault();					
	});
	
	// activate bookmark link
	$(".bookmark").show().click(function(){
		if($.browser.mozilla) window.sidebar.addPanel("VVV-Groepsarrangementen.nl", "http://www.vvv-groepsarrangementen.nl","")
		else if ($.browser.msie) window.external.AddFavorite( "http://www.vvv-groepsarrangementen.nl", "VVV-Groepsarrangementen.nl")
		else if ($.browser.opera) $(this).attr("rel","sidebar").attr("href","http://www.vvv-groepsarrangementen.nl").attr("title","VVV-Groepsarrangementen.nl").trigger("click")
		else if ($.browser.safari) alert("klik 'cmd + d' (of 'ctrl + d') om deze site aan je favorieten toe te voegen");
		else alert("klik 'ctrl + d' om deze site aan je favorieten toe te voegen");
	});
	
	// activate print link
	$(".print").show().find("a").click(function(){
		window.print();											
	});
	
	// Betreft tabjes op arrangementen pagina //
	// tab content equal column height
	var tabColHeight = 0;
	$("div.tabTitleBar a").each(function(){
		tabColHeight = ($("#"+$(this).attr('rel')).height() > tabColHeight)? $("#"+$(this).attr('rel')).height() : tabColHeight;
	}).each(function(){
		$("#"+$(this).attr('rel')).height(tabColHeight);
	});
	
	// show all tabs & hide tab content layers
	$("div.tabTitleBar a.hidden").show().each(function() {
		$("#"+$(this).attr('rel')).hide();
	})
	
	// tab toggle function
	$("div.tabTitleBar a").click(function(){
		this.blur();
		$("div.tabTitleBar a.active").removeClass("active").each(function(){
			$("#"+$(this).attr('rel')).hide();
		});
		$(this).addClass("active");
		$("#"+$(this).attr('rel')).show();
	});

});
