$(function(){ $("#form").submit(function() { if($('[name=name]').attr('value') == ''){ alert('Вы не указали свое имя'); $('[name=name]').focus(); return false; } if($('[name=mail]').attr('value') == ''){ alert('Укажите свой e-mail'); $('[name=mail]').focus();return false; } $("submit",this).attr({disabled:"disabled"}); $.ajax({ type: "POST", url: "/mail/send.xml", data: "name="+$('[name=name]').attr('value')+"&mail="+$('[name=mail]').attr('value')+"&message="+$('[name=message]').attr('value')+"&phone="+$('[name=phone]').attr('value'), dataType: "html", success: function(dataxml){ //$("message",dataxml).each(function(xml){ alert($("responce",dataxml).text()); //}); $('.form-send-message').attr({value:''}); $("submit",this).attr({disabled:""}); }, error: function(msg){ alert('Ошибка при отправке сообщения. Приносим свои извинения.'); } }) return false; }); $("#messagebox").ajaxStart(function(){ $(this).show(); }); $("#messagebox").ajaxStop(function(){ $(this).hide(); }); }); $(document).load(function(){ $("#menu, #content").equalizeCols(); }); (function($) { /** * equalizes the heights of all elements in a jQuery collection * thanks to John Resig for optimizing this! * usage: $("#col1, #col2, #col3").equalizeCols(); */ $.fn.equalizeCols = function(){ var height = 0, reset = $.browser.msie ? "1%" : "auto"; return this .css("height", reset) .each(function() { height = Math.max(height, this.offsetHeight); }) .css("height", height) .each(function() { var h = this.offsetHeight; if (h > height) { $(this).css("height", height - (h - height)); }; }); }; })(jQuery);