/* ================================ +
	    Mice Meets Metropolis
 + ================================ */



/* 
** Made by: Thomas Lievestro
** Email:	thomas@studioparkers.nl
** Website:	www.studioparkers.nl
*/


/* ================================ +
              Variables
 + ================================ */


function displayLightbox(overlay){

	pageSize = getBrowserSize();												//Get PageSize
	marginTOP = (pageSize[1]-500)/2;											//Reken het midden uit
	
	$('#overlay_bg_container').fadeIn(700);									//Fade de overlay background in

	if(overlay=='form'){
	    $('#overlay_form').css("top",marginTOP);						//Plaats de overlay in het midden van het scherm
		$("#aanmeld_return_message").hide();						
		window.setTimeout("$('#overlay_form').fadeIn('slow')", 500);	//Fade de overlay in
		window.setTimeout("$('#aanmeld_formulier_container').fadeIn('slow')", 500);
	}else if(overlay=='map_image'){
		$('#overlay_map_image').css("top",marginTOP);						//Plaats de overlay in het midden van het scherm
		window.setTimeout("$('#overlay_map_image').fadeIn('slow')", 500);	//Fade de overlay in
	}
}

function hideLightbox(overlay){
	if(overlay=='form'){
		$('#overlay_form').fadeOut('slow');		
		window.setTimeout("document.aanmeld_form.reset();", 500);					//Reset de form		
		window.setTimeout("$('div#error_container').hide();", 500);	
		window.setTimeout("$('div#bijeenkomst_data').show();", 500);	
		//Hide error
	}else if(overlay=='map_image'){
		$('#overlay_map_image').fadeOut('slow');							//Fade de overlay out
	}
	window.setTimeout("$('#overlay_bg_container').fadeOut(700);", 500);				//Fade de overlay background out
} 


/* Wanneer locatieanders is gekozen word het het veld locatie anders enabled */
function locatieAndersToggle(){
	 var selected = $("#locatiesoortid option:selected");       
     if(selected.val() == 0){  
     	 $("#locatieanders:input").removeAttr("disabled");
     } else {
         $("#locatieanders").val('');
     	 $("#locatieanders:input").attr('disabled', true);
     }
	} 
 


function getBrowserSize() {
	        
    var theWidth, theHeight;
	// Window dimensions: 
	if (window.innerWidth) {
	theWidth=window.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth) {
	theWidth=document.documentElement.clientWidth;
	}
	else if (document.body) {
	theWidth=document.body.clientWidth;
	}
	if (window.innerHeight) {
	theHeight=window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) {
	theHeight=document.documentElement.clientHeight;
	}
	else if (document.body) {
	theHeight=document.body.clientHeight;
	}

	return [theWidth,theHeight];
}


/* Send form routines */
$(function() {  
  $("#send_request").click(function() {  
   $('#contact-form').submit();
  });  
});  


