// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function OpenPopup(sPicURL)
{    window.open("http://www.ggweb.nl/popup.php?"+sPicURL, "Vergroting", "resizable=0,HEIGHT=220,WIDTH=220");
} 
function changeImage(Obj)
{
	if( document.getElementById('big') ) 
	{
		document.getElementById('big').src = Obj.src;
	}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function startCycle(){
	setTimeout("cycleSfeer()",500);
}
function cycleSfeer(){
	jQuery('#topimage').cycle({ 
    fx:    'fade', 
    timeout:  3300,
    speed: 1200 
	});
}
jQuery(document).ready(function($){
	$("img.reflect").reflect({/* Put custom options here */}
	,startCycle());
	
 	$("input.text, textarea.textarea").addClass("idle");
    $("input.text, textarea.textarea").focus(function(){
            $(this).addClass("activeField").removeClass("idle");
    }).blur(function(){
            $(this).removeClass("activeField").addClass("idle");
    });
	
});

$(document).ready(function() {
  $.viewMap = {
    '0' : 'Selecteer een provincie',
    'view1' : 'Noord-Holland',
    'view2' : 'Zuid-Holland',
    'view3' : 'Gelderland',
    'view4' : 'Groningen',
    'view5' : 'Friesland',
    'view6' : 'Drenthe',
    'view7' : 'Overijssel',
    'view8' : 'Flevoland',
    'view9' : 'Utrecht',
    'view10' : 'Zeeland',
    'view11' : 'Noord-Brabant',
    'view12' : 'Limburg'
  };
	
	var htmlselect = '';
	$.each($.viewMap, function(i, val) { 
    	$('#'+i).hide;
    	c = $('#'+i+' h3').length;
    	if (i == 0){
    	htmlselect += "<option value=\'"+i+"\'>"+val+"</option>";
    	}
    	else {
    	htmlselect += "<option value=\'"+i+"\'>"+val+" ("+c+")</option>";}
    	//alert(htmlselect);
    });
	
  $('#viewSelector').html(htmlselect);

  $('#viewSelector').change(function() {
	$('.view').hide();
	//alert($(this).val());
	$('#'+$(this).val()).show();
    
  });
   $('.view').hide();
   
   $("#interieurform").validate({
		rules: {
			complete: "required",
			},
		messages: {
			complete: "Heeft u het formulier compleet ingevuld? Zo ja, klik op het vakje hiernaast en verstuur het formulier.<br />",
		}
		
	});
	   $("#schuifdeurform").validate({
		rules: {
			complete: "required",
			},
		messages: {
			complete: "Heeft u het formulier compleet ingevuld? Zo ja, klik op het vakje hiernaast en verstuur het formulier.<br />",
		}
		
	});
	 $('#schuifdeurform').ready(initCommentForm);
	 $('#interieurform').ready(initCommentForm);
	
});




   function saveCommentInformation() {
      // Save user information from the form!
      jQuery.cookie('snaam',jQuery("input[@name='Naam']").val(), { expires: 1, path: '/'});
      jQuery.cookie('adres',jQuery("input[@name='Adres']").val(), { expires: 1, path: '/' });
      jQuery.cookie('sdatum',jQuery("input[@name='Datum']").val(), { expires: 1, path: '/' });
      jQuery.cookie('naamverkoper',jQuery("input[@name='Naamverkoper']").val(), { expires: 1, path: '/' });
      jQuery.cookie('plaats',jQuery("input[@name='Plaats']").val(), { expires: 1, path: '/' });
      jQuery.cookie('telefoon',jQuery("input[@name='Telefoon']").val(), { expires: 1, path: '/' });
      jQuery.cookie('commissie',jQuery("input[@name='Commissie']").val(), { expires: 1, path: '/' });
   }




   function initCommentForm() {
      // Autofill user information if available
      $("input[@name='Naam']").val( jQuery.cookie('snaam'));
      $("input[@name='Adres']").val( jQuery.cookie('adres'));
      $("input[@name='Datum']").val( jQuery.cookie('sdatum'));
      $("input[@name='Naamverkoper']").val( jQuery.cookie('naamverkoper'));
      $("input[@name='Plaats']").val( jQuery.cookie('plaats'));
      $("input[@name='Telefoon']").val( jQuery.cookie('telefoon'));
      $("input[@name='Commissie']").val( jQuery.cookie('commissie'));

      // Save comment information when form is submitted
      $("form[@name='schuifdeurform']").submit(saveCommentInformation);
      $("form[@name='interieurform']").submit(saveCommentInformation);
   }

 



