$(function(){
	$('form.validate').bind("submit",function(){
		var form=$(this).wsValidate({alert:{empty:'Please fill all required fields.',email:'This email address appears invalid.',str:'No numbers or special characters are allowed.',num:'This value can only be a number.',empty:'Please fill this field.'}});
		if(form.o.error) return false;
		else $('input[@class=submit]','form.validate').attr('disabled',true);
	});
	$('textarea[@class*=limit]','form.validate').keyup(function(){
		var str=this.value,o=this.className.match(/([\w]+)-([\d]+)/i).splice(1,3);
		o[1]=parseInt(o[1]);
		if(str.length>o[1])this.value=str.substring(0,o[1]);
		if($('.'+o[0]+'-toll'))$('.'+o[0]+'-toll').text(str.length+'-');
		return false;
	});
});
