document.observe('dom:loaded', function() {
	$('ajaxContactFormTrigger').observe('click', showAjaxContactForm);
});

function showAjaxContactForm(event) {
	Event.stop(event);
	Lightview.show({
		href: '/form_contact.php',
		rel: 'ajax',
		options: {
			autosize: true,
			topclose: true,
			ajax: {
				onComplete: function(){
				// once the request is complete we observe the form for a submit
				$('ajaxContactForm').observe('submit', submitAjaxContactForm);
				}
			}
		}
	});
}

function submitAjaxContactForm(event) {
  // block default form submit
  Event.stop(event);
	  
  Lightview.show({
    href: '/form_contact.php',
    rel: 'ajax',
    options: {
	  topclose: true,
	  autosize: true,
      ajax: {
        parameters: Form.serialize('ajaxContactForm'), // the parameters from the form
		onComplete: function(){
		// once the request is complete we observe the form for another submit, esstially creating a loop
		$('ajaxContactForm').observe('submit', submitAjaxContactForm);
		}
      }
    }
  });
}