var Contacts = {
	
	Errors : Array(),
	
    sendM : function (modul, formData, type ,prefix)
    {
        $.post("/",
            'Func='+modul+'&'+$(formData).serialize()+'&type='+type,
            function(response) {

                if (response.error)
                {
                    jQuery.each(response.data, function(i, val) 
                    {                       
                        $('#'+prefix+'_'+i).val(val);
                        
                    	Contacts.Errors[i] = true;
                    });
                }
                else
                {
					$(formData).html('<div class="msg-success">'+response.data+'</div>');
                }
            },
		"json"
		);
    }
};

$(function() {

	$('.addit-box input[type="text"], .addit-box textarea').focus(function() {
		id = $(this).attr('id').split('_')[1];
		if ( Contacts.Errors[id] == true )
		{
			$(this).val('');
			Contacts.Errors[id] = false;
		}
	});

});
