$(document).ready(function(){
		 var options = { 
				beforeSubmit:function() {
					jQuery.facebox('<b>Please wait...</b><br>We are validating your data.');
					setInput(false);
				},
				success:function(data) {
					if(data!='200')
					{
						jQuery.facebox('Please check your username/password.');
						closeFacebox(3000);
						setInput(true);
						$('#password').val('');
						$('#password').focus();
					}
					else
					{
						jQuery.facebox('<b>Please wait...</b>');
						document.location.href='/translator/jobs/'+nexturl;
					}
				}
			}; 
		
			$('#formlogin').validate({
				rules:{
					'data[User][username]':{
						required:true
					},
					'data[User][password]':{
						required:true
					}
				},
				messages:{
					'data[User][username]':{
						required:''
					},
					'data[User][password]':{
						required:''
					}
				},
			submitHandler: function() {
				$('#password').val($.md5($('#password').val()));
				$('#formlogin').ajaxSubmit(options); 
			}
		});

		setInput(true);
		setTimeout(function(){ 	$('#formlogin input:first').focus(); },500);
});