  
    $(document).ready(function() {
	  
	  $("#mlJoin").gbxInit({
        left:0,
        width:620,
        height:570
      });
    
	  $("#mlConfirm").gbxInit({
        left:0,
        width:614,
        height:156
      });
    
      
      
      $("#ex1Act").click(function() {
        $("#mlJoin").gbxShow();
        return false;
      });
      
      
	  
	  $("#closeEx1").click(function() {
		$("#mlJoin").gbxHide();
		return false;
	  });
	  $("#closeEx2").click(function() {
		$("#mlConfirm").gbxHide();
		return false;
	  });
	  
	  
    });
  //-->
    
$(document).ready(function() {

	document.getElementById("output").style.display = "none";
    var options = {
        target:        '#output2',
        beforeSubmit:  showRequest,
       success:       showResponse
 
    };
 
    // bind to the form's submit event
    $('#mlForm').submit(function() {
        // inside event callbacks 'this' is the DOM element so we first
        // wrap it in a jQuery object and then invoke ajaxSubmit
        $(this).ajaxSubmit(options);
 
        // !!! Important !!!
        // always return false to prevent standard browser submit and page navigation
        return false;
    });
});
 
// pre-submit callback
function showRequest(formData, jqForm, options) {
	var form = jqForm[0];
	var queryString = $.param(formData);
    validationErrors = '';
    formErrors = false;
    
    if (!form.mlName.value) { 
		validationErrors = validationErrors + 'You must enter a name<br />'; 
		formErrors = true;
	} 
    if (!form.mlCompany.value) { 
		validationErrors = validationErrors + 'You must enter a company name<br />'; 
		formErrors = true;
	} 
    if (!form.mlEmail.value) { 
		validationErrors = validationErrors + 'You must enter an email address<br />'; 
		formErrors = true;
	} 
    if (!form.mlTelephone.value) { 
		validationErrors = validationErrors + 'You must enter a telephone number<br />'; 
		formErrors = true;
	} 

	if (formErrors==true) {	
		document.getElementById("output").style.display = "block";
		$('#output').html(validationErrors); 
		return false; 
	}
	else {	    
		document.getElementById("output").style.display = "none";
		$('#output').html(''); 		
		return true;
	}
    
}
 
function showResponse(responseText, statusText)  {
	document.getElementById("mlJoin").style.display = "none";	
	document.getElementById("mlConfirm").style.zIndex = 50000;
	document.getElementById("mlConfirm").style.display = "block";
}






