jQuery(function() {
	// show a simple loading indicator
	var loader = jQuery('<div class="message"><div align="center"><p> &nbsp;Loading...<br /><img src="../images/loading.gif" alt="loading..." /></p></div></div>')
		.appendTo("#msg")
		.hide();
		
	jQuery().ajaxStart(function() {
		loader.show();
document.getElementById('registerb').innerHTML = '<br /><input disabled="disabled" type="submit" name="submit" id="submit" value="Submitting..." style="width:250px;height:30px;" />';
$("#formarea").fadeOut("fast");
	}).ajaxStop(function() {
		loader.hide();
document.getElementById('registerb').innerHTML = '<br /><input type="submit" name="submit" id="submit" value="Submit" style="width:250px;height:30px;" />';
$("#formarea").fadeIn("slow");

		
	}).ajaxError(function(a, b, e) {
		throw e;
	});
	
	var v = jQuery("#linkform").validate({
        // the errorPlacement has to take the table layout into account 
		errorPlacement: function(label, element) {
			if (/^media/.test(element[0].name)) {
				label.insertAfter("#afterthismedia");
			} else {
				label.insertAfter(element);
			}
		},
		submitHandler: function(form) {
			jQuery(form).ajaxSubmit({
				target: "#dynamicarea"
			});
		}
		
	});
	
	
});