$(document).ready(function(){
	
	if($('form.validate')){	
		$("form.validate label span").hide();
		$("form.validate").validate();
	}	
	
	$('#head li:not(#size)').hover(function() {
        $(this).addClass('hover');
      }, function() {
        $(this).removeClass('hover');
     });

						  
	$("a[href$=pdf]").addClass("pdf").attr({ target: "_blank" });

	$("a[href$=zip]").addClass("zip").attr({ target: "_blank" });

	$("a[href$=psd]").addClass("psd").attr({ target: "_blank" });
	
	$("a[href^='http']:not(a[href^='http://alk.vm008.satserver.nl'], a[href^='http://www.wbvalkemade.nl']a[href^='http://wbvalkemade.nl'])").attr('target','_blank')
		.addClass("external")
		.attr({ target: "_blank" });
			
	$('#slider ul').cycle({ 
		fx:     'fade', 
   	  	timeout:8000,
		speed:  '2000',
		next:   '.next', 
    	prev:   '.prev' 
	});
	
	$('table tr:even').addClass('even');
	
	$("#woningoverzicht li img, #woningoverzicht li h2").click(function(){
	  window.location=$(this).parents().find("a").attr("href"); return false;
	});
	$("#slider li").click(function(){
	  window.location=$(this).find("a").attr("href"); return false;
	});
	
	
	  var originalFontSize = "1em";
	  
	  if ($.cookie('FontSize') == "large") {
	  	
	  	var currentFontSize = $('#text, #head, #sub ul').css('font-size');
	  	var currentFontSizeNum = parseFloat(currentFontSize, 10);
	  	var newFontSize = "1.4em";
	  	var newLineHeight = "1.5em";
	  	$('#text, #head').css('font-size', newFontSize);
	  	$('#text, #head').css('line-height', newLineHeight);
		
	  }else if ($.cookie('FontSize') == "medium") {
	  	
	  	$('#text, #head').css('font-size', originalFontSize);
		
	  }else if ($.cookie('FontSize') == "small") {
	  	
		var currentFontSize = $('#text, #head, #sub').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);
		var newFontSize = ".8em";
		$('#text, #head').css('font-size', newFontSize);			
	  } 
	  
    $(".medium").click(function(){
    $('#text, #head').css('font-size', originalFontSize);
	$.cookie('FontSize', 'medium', { expires: 70, path: '/', domain: 'wbvalkemade.nl', secure: false });
  });
  // Increase Font Size
  $(".large").click(function(){
    var currentFontSize = $('#text, #head, #sub ul').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize =  "1.4em";
	var newLineHeight = "1.5em";
    $('#text, #head').css('font-size', newFontSize);
	$('#text, #head').css('line-height', newLineHeight);
	
	$.cookie('FontSize', 'large',{ expires: 70, path: '/', domain: 'wbvalkemade.nl', secure: false });
    return false;
  });
  // Decrease Font Size
  $(".small").click(function(){
    var currentFontSize = $('#text, #head, #sub').css('font-size');
    var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = ".8em";
	
    $('#text, #head').css('font-size', newFontSize);
	
	$.cookie('FontSize', 'small',{ expires: 70, path: '/', domain: 'wbvalkemade.nl', secure: false });
    return false;
  });
  
  	$('#nav .input_1').emptyonclick(); 
	  
});

