// post-submit callback 
function showContactFormResponse(responseText, statusText)  { 
	if ( responseText.indexOf('success') >= 0 )
		$('#overlayer').hide().html(responseText).fadeIn(1500);
	else
		$('#status').html(responseText).hide().fadeIn(1500);
} 

//prepare the form when the DOM is ready 
$(document).ready(function() { 
	// Configure the Contact Submission
	var contactFormOptions = { 
        type:    'post',
        success: function(responseText, statusText) {
			if ( responseText.indexOf('success') >= 0 )
				$('#overlayer').hide().html(responseText).fadeIn(1500);
			else
				$('#status').html(responseText).hide().fadeIn(1500);
		}
    }; 
    // bind form using 'ajaxForm' 
    $('#contactSubmitForm').ajaxForm(contactFormOptions); 

	// Configure the Email Submission
	var emailFormOptions = { 
        type:    'post',
        success: function(responseText, statusText) {
			if ( responseText.indexOf('success') >= 0 )
				$('#emailDiv').hide().html(responseText).fadeIn(1500);
			else
				$('#emailStatus').html(responseText).hide().fadeIn(1500);
		}
    }; 
    // bind form using 'ajaxForm' 
    $('#emailForm').ajaxForm(emailFormOptions); 

    // Configure the Adscans Image Zoom
    var imgOptions = {
		controlsTrigger: 'mouseover',
		//className: 'custom',
		centered: true,
		shadow: 40,
		controls: true,
		opacity: 1,
		beforeZoomIn: function(boxID) {
			$('#' + boxID)
				.find('img')
				.css('opacity', 0)
				.animate(
					{'opacity':1},
					{ duration: 500, queue: false }
				);
		},
		beforeZoomOut: function(boxID) {
			$('#' + boxID)
				.find('img')
				.css('opacity', 1)
				.animate(
					{'opacity':0},
					{ duration: 500, queue: false }
				);
		}
    };
    $('a.zoomimg').zoomimage(imgOptions);
}); 
