$(document).ready(function() {
	$('#login_form input').focus(function(){
		var type = $(this).attr('type');
		if(type == 'text' || type == 'password'){
			var field_val = $(this).val();
			if(field_val == 'username' && type == 'text' || field_val == 'password' && type == 'password'){
				$(this).val('');
			}
		}
	});
	$('#captchaRefresh').show();
	$('#captchaRefresh').click(function(){
		var rand = Math.ceil(100*Math.random());
		$("#codSecuritate").attr({'src':"img/captcha.jpg?rand="+rand});
		$("#codSec").removeClass().attr({"value":""});
	});
	$('#login_form input').blur(function(){
		var type = $(this).attr('type');
		if(type == 'text' || type == 'password'){
			var field_val = $(this).val();
			if(field_val == '' && type == 'text' || field_val == '' && type == 'password'){
				if(type == 'text'){
					$(this).val('username');
				}else if(type == 'password'){
					$(this).val(type);
				}
			}
		}
	});
});
