// JavaScript Document
function Cufon_replace() {
	Cufon.replace('h1', 'ITC Officina Sans Std');
	Cufon.replace('h2', 'ITC Officina Sans Std');
	Cufon.replace('#menu li a.menulink', 'ITC Officina Sans Std');
	Cufon.replace('#ervaring h1',{ textShadow:'#a0b6ca 1px 1px'}, 'ITC Officina Sans Std');
	Cufon.replace('#datum', 'ITC Officina Sans Std');
	Cufon.replace('#verzend', 'ITC Officina Sans Std');	
}

$(document).ready(function(){  
 
/* var aantalsubs = $('.menulink').size();
	
	for (var i=1; i<=aantalsubs; i++) { 
	 $("a.hfdcat"+i).click(function(){
		  if ($(this).next().css("display") == "none") { 
			  $(".submenu").slideUp();
			  $(this).next().slideDown();		  
		  }
		  return false;
	 });
	}
 */
 $("h1").css("visibility","visible");
 $("h2").css("visibility","visible");
 $("#menu li a.menulink").css("visibility","visible");
 $("#ervaring h1").css("visibility","visible");
 $("#datum").css("visibility","visible");
 $("#verzend").css("visibility","visible");


 $('#bannerfade').cycle({
		fx: 'fade',
		speed:    1000, 
	    timeout:  5000		
  });

 $("#deelnemen").click(function(){ 
		document.location.href="regeling-boerenlandpad/procedure-aanvraag.html";								
	});

 $(".maakkleiner").click(function(){
      $(".textblok").addClass("letternormaal");
	  $(".textblok").removeClass("lettergroter");
	  $.ajax({
		   type: "GET",
		   url: "ajax/set_lettergrootte.php",
		   data: "lettergrootte=kleiner"
   	  });
	  return false;
    });
  $(".maakgroter").click(function(){
      $(".textblok").addClass("lettergroter");
	  $(".textblok").removeClass("letternormaal");
	  $.ajax({
		   type: "GET",
		   url: "ajax/set_lettergrootte.php",
		   data: "lettergrootte=groter"
   	  });
	return false;
    });
 $(".contact-verzenden").click(function(){
	  if(checkform()){document.frm_contact.submit();}
  	  return false;
 });
  $(".vraag-verzenden").click(function(){
	  if(checkform2()){document.frm_contact.submit();}
  	  return false;
 });
  $(".aanmelden-verzenden").click(function(){
	  if(checkform3()){document.frm_contact.submit();}
  	  return false;
 });  
 $(".required").focus(function(){
	focusForm(this);
 });
 $(".required").blur(function(){
	checkObj(this);
 });
 $(".prov-noord-holland").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-435px 0'); 
	});
 $(".prov-utrecht").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-870px 0'); 
	});
 $(".prov-zuid-holland").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-1305px 0'); 
	});
 $(".prov-zeeland").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-1740px 0'); 
	});
 $(".prov-noord-brabant").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-2175px 0'); 
	});
 $(".prov-limburg").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-2610px 0'); 
	});
 $(".prov-gelderland").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-3045px 0'); 
	});
 $(".prov-flevoland").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-3480px 0'); 
	});
 $(".prov-overijssel").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-3915px 0'); 
	});
 $(".prov-drenthe").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-4350px 0'); 
	});
 $(".prov-friesland").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-4785px 0'); 
	});
 $(".prov-groningen").mouseover(function(){	
	$("#provincies").css('backgroundPosition', '-5220px 0'); 
	});
 
 $(".provincie-hover").tooltip({
    track: true, 
    delay: 0, 
    showURL: false, 
    opacity: 1, 
    fixPNG: true, 
    showBody: " - ",  
    top: -25, 
    left: 5 
}); 
 
 
 
 var options2 = {
            direction:  'right',
            countpos:   'caption'
        }
    
$('#popeye1').popeye();
$('#popeye2').popeye(options2);


 
  
});
function toolcufon(){
	Cufon.replace('#tooltip', 'ITC Officina Sans Std');
}
	
function checkform() {
	var dopost = true;
	var patroon = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (document.frm_contact.inp_voornaam.value == ''){
		document.getElementById('form_voornaam').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_voornaam').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_naam.value == ''){
		document.getElementById('form_naam').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_naam').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_vraag.value == ''){
		document.getElementById('form_vraag').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_vraag').style.backgroundImage = 'none';
	}	
	if (document.frm_contact.inp_email.value == ''){
		document.getElementById('form_email').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_email').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_email.value != ''){
		if (patroon.test(document.frm_contact.inp_email.value)==false) {
			document.getElementById('form_email').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
			document.getElementById('form_email').style.padding = '4px 5px 5px 25px';
			dopost = false;
		} else { 
		document.getElementById('form_email').style.backgroundImage = 'none';
		}										
	}		
	if (!dopost) document.getElementById('foutmelding').style.display='block';

	return dopost;
}
function checkform2() {
	var dopost = true;
	var patroon = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (document.frm_contact.inp_naam.value == ''){
		document.getElementById('form_naam').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_naam').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_vraag.value == ''){
		document.getElementById('form_vraag').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_vraag').style.backgroundImage = 'none';
	}	
	if (document.frm_contact.inp_email.value == ''){
		document.getElementById('form_email').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_email').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_email.value != ''){
		if (patroon.test(document.frm_contact.inp_email.value)==false) {
			document.getElementById('form_email').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
			document.getElementById('form_email').style.padding = '4px 5px 5px 25px';
			dopost = false;
		} else { 
		document.getElementById('form_email').style.backgroundImage = 'none';
		}										
	}		
	if (!dopost) document.getElementById('foutmelding').style.display='block';

	return dopost;
}

function checkform3() {
	var dopost = true;
	var patroon = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (document.frm_contact.inp_voornaam.value == ''){
		document.getElementById('form_voornaam').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_voornaam').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_naam.value == ''){
		document.getElementById('form_naam').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_naam').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_email.value == ''){
		document.getElementById('form_email').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
		dopost = false;
	} else { 
		document.getElementById('form_email').style.backgroundImage = 'none';
	}
	if (document.frm_contact.inp_email.value != ''){
		if (patroon.test(document.frm_contact.inp_email.value)==false) {
			document.getElementById('form_email').style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
			document.getElementById('form_email').style.padding = '4px 5px 5px 25px';
			dopost = false;
		} else { 
		document.getElementById('form_email').style.backgroundImage = 'none';
		}										
	}		
	if (!dopost) document.getElementById('foutmelding').style.display='block';

	return dopost;
}
function focusForm(obj) { 
	obj.style.backgroundImage = 'none';
}
function checkObj(obj) { 
	if (obj.value=='') { 
		obj.style.backgroundImage = 'url(afbeeldingen/alert_icon.gif)';
	}
}
