function selectPackage(iIndex)
{
	oCheckbox = document.getElementById("package_" + iIndex);
	oCheckbox.checked = true;
	return true;
}

function popUp(sUrl, sName, iWidth, iHeight) 
{
    window.open(sUrl, sName, 'width=' + iWidth + ',height=' + iHeight + ', scrollbars=no,toolbar=no,location=no, resizable=0');
}


/**
 * Form validation
 */
function validateForm(){
	var errors = '';
	
	if($('#male').attr('checked') != true && $('#female').attr('checked') != true){
		errors = errors + ' Vul je geslacht in.';	
	}
	
	if($('#firstname').val() == ''){
		errors = errors + '\n Vul je voornaam in.';	
	}
	
	if($('#lastname').val() == ''){
		errors = errors + '\n Vul je achternaam in.';	
	}
	
	if($('#email').val() == ''){
		errors = errors + '\n Vul je emailadres in.';	
	}
	
	if($('#birthDay').val() == '' || $('#birthMonth').val() == '' || $('#birthYear').val() == ''){
		errors = errors + '\n Vul je geboortedatum in.';	
	}
	
	if($('#accept').attr('checked') != true){		
		errors = errors + '\n Je moet de voorwaarden accepteren.';	
	}
	
	if(errors != ''){
		alert(errors);
		return false;
	}else{
		return true;
	}
}


/**
 * Popup
 */
 //SETTING UP OUR POPUP
  //0 means disabled; 1 means enabled;
  var popupStatus = 0;
  
  //loading popup with jQuery magic!
  function loadPopup(){
    //loads popup only if it is disabled
    if(popupStatus==0){
     $("#backgroundPopup").css({
        "opacity": "0.7"
      });
      $("#backgroundPopup").fadeIn("slow");
      $("#popupContact").fadeIn("slow");
      popupStatus = 1;
    }
  }
  
  function getCookie(c_name){
    if (document.cookie.length>0)
    {
      c_start=document.cookie.indexOf(c_name + "=");
      if (c_start!=-1)
      {
        c_start=c_start + c_name.length+1;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
      }
    }
    return "";
  }
  
  
  //disabling popup with jQuery magic!
  function disablePopup(){
    //disables popup only if it is enabled
    if(popupStatus==1){
      var date = new Date();
      date.setTime(date.getTime()+(30*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();      
      document.cookie = "briefPopup"+"="+"set"+expires+"; path=/";
      
      $("#backgroundPopup").fadeOut("slow");
      $("#popupContact").fadeOut("slow");
      popupStatus = 0;
    }
  }
  
  //centering popup
  function centerPopup(){
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = $("#popupContact").height();
    var popupWidth = $("#popupContact").width();
    
    //centering
    $("#popupContact").css({
      "position": "absolute",
      "top": windowHeight/2-popupHeight/2,
      "left": windowWidth/2-popupWidth/2
    });
    
    //only need force for IE6      
    $("#backgroundPopup").css({
      "height": windowHeight
    });    
  }
  
  function showPopup(){
  	centerPopup();
  	//load popup  
	loadPopup();
  }      
