$(function(){
	$('.hoverChange').hover(
		function()
		{
			$(this).attr('content', $(this).text());
			$(this).text($(this).attr('title'));
		}, 
		function()
		{
			$(this).text($(this).attr('content'));
		}
	);
	
	setTimeout(function(){$('input[type=password][autocomplete=off], form[autocomplete=off] input[type=password]').val();}, 0);
});

if (typeof jsValidationScript != 'undefined')
{
	jsValidationScript.prototype.handleErrors = function ( errors )
	{
	    for (var i=0; i < errors.length; i++)
	    {
	        error = errors[i];
	        if (error.focus)
	        {
	            var focusElement = $('*[name="' + error.focus + '"]:not([type=hidden])');
	            
	            if (
	                (focusElement)
	                &&
	                (typeof focusElement.focus == 'function' || typeof focusElement.focus == 'object')
	            )
	            {
	                try
	                {
	                	$(focusElement).parents('.errorField').removeClass('errorField');
            	    	$(focusElement).siblings('.validationTooltip').remove();
	                	
	                	if ($(focusElement).parents('.fieldContainer').length > 0)
	                	{
	                		$(focusElement).parents('.fieldContainer').addClass('errorField');
	                	}
	                	else
	                	{
	                		$(focusElement).parent().addClass('errorField');
	                	}
	            		
	            		var message = error.message;
	            	    var fieldName = error.field_name;
	            	    var fieldTitle = error.field_title;
	
	            	    var fieldText = (fieldTitle) ? fieldTitle : fieldName;
	
	            	    var finalMessage = message.replace(/\%f/gi, '"' + fieldText + '"');
	            	    
	            	    $(focusElement).after('<strong class="validationTooltip"><strong><i />' + finalMessage + '</strong></strong>');
	            	    $('strong', focusElement.next('.validationTooltip')).css({
	            	    	left: Math.round(-1 * $('strong', focusElement.next('.validationTooltip')).width() / 2)
	            	    });
	            	    
	            	    $(focusElement).bind('change blur keyup', function(event){
	            	    	if(event.keyCode && event.keyCode == 13)
	            	    	{
	            	    		return;
	            	    	}
	            	    	$(this).parents('.errorField').removeClass('errorField');
	            	    	$(this).siblings('.validationTooltip').remove();
							$(this).unbind(event);
	            	    });
	            	    
	                    focusElement.focus();
	                }
	                catch(e)
	                {
	                }
	            }
	        }
	    }
	}
}
