/**
 * im LightForm
 * 
 * Creates a lightbox affect for form submissions when the submit button has the class "lightform"
 * 
 * @author Owen Cole <owen [at] ideamesh [dot] com>
 * @since Nov 18, 2008
 * @version 1.0
 * @copyright http://ideamesh.com This script is owned and licensed by Ideamesh, Inc. You may not use
 * this script in commercial application without permission of Ideamesh, Inc. 
 * Please contact sales [at] ideamesh [dot] com for more information 
 */

var blankimage = 'images/freeicons/blank.gif'
var lightformimage ='images/freeicons/lightbox-ico-loading.gif';

$(document).ready(function(){
	$('.lightform').click(function () {
		showlightform();
	});

	$('body').append('<div id="lightformoverlay"><div><span>Please wait while your form is being submitted</span><br /><img id="lightformoverlayimg" src="' + lightformimage + '"/></div></div>');

	$('#lightformoverlay').css({
			display:"none",
			position:"absolute",
			top:"0",
			left:"0",
			zIndex:"90",
			width:"100%",
			height:$(document).height()
		});

	$('#lightformoverlayimg').attr('src', lightformimage);

	centerV = ($(document).height() / 2) - 100;
	centerH = ($(document).width() / 2) - 100;

	$('#lightformoverlay div').css({
			position:"absolute",
			top:centerV,
			left:centerH
		});
});

function hidelightform() {
	$('#lightformoverlay').hide();
}

function showlightform() {
	$('#lightformoverlay').show();
}