var FormOut = false;

$(document).ready(function() {
	PositionContactForm();

	$('#ContactUs').bind('click',function() {
		MoveContactForm();
	});	

	$('#ContactTab').submit(function(e) {
		$('#FormPosted').html('');
		var $inputs = $('#ContactTab :input');

		var Ret = true;
		$inputs.each(function() {
			if (this.name != 'ContactUs') {
				if (this.name == $(this).val() || $(this).val() == '') {
					Ret = false;
				}
			}
		});
		if (!Ret) {
			$('#FormPosted').html('Please fill in all of the fields');
			e.preventDefault();
		}
		return Ret;
	});
});

function MoveContactForm() {
	Width = $(window).width();
	if (FormOut) {
		$('#RightEdge').animate({'left':Width - 30});
		FormOut = false;
	} else {
		$('#RightEdge').animate({'left':Width - 330});
		FormOut = true;
	}
}

function PositionContactForm() {
	Width = $(window).width();
	Height = $(window).height();
	var Top;
	Top = (Height / 3);
	//alert(Top);
	//console.log(Width);
	$('#RightEdge').css({'left':Width - 30});
	$('#RightEdge').css({'top':Top});
}

$(window).resize(function() {
	PositionContactForm();
});


