$(function(){$('#contact-form').submit(function(){var sendButton=$('input[type="submit"]');sendButton.attr({disabled:'disabled',value:'Отправка сообщения...'});$.ajax({type:"POST",url:'/webforms/send/',data:$('#contact-form').serialize(),success:function(response){sendButton.val('Сообщение отправлено!');},error:function(response){sendButton.val('Ошибка');}});return false;});$('.vote form').submit(function(e){$form=$(this);$postData=$form.serializeObject();var voice_id=$postData.vote_results;var vote_id=$form.data('id');if(voice_id&&vote_id){$.ajax({url:'/vote/post/'+voice_id+'/?m='+new Date().getTime(),dataType:'html'}).done(function(){$.ajax({url:'/udata://vote/results/'+vote_id+'/?transform=modules/vote/poll.xsl&m='+new Date().getTime(),dataType:'html',success:function(data){var block=$form.parent().html(data);$('.total',block).text('Всего голосов:');}});}).fail(function(){alert("Что-то пошло не так, попробуйте повторить процедуру голосования.");});}else alert('Не выбран ни один вариант');e.preventDefault();return false;});$('table.docs').fixedtableheader({highlightrow:true,});})
$.fn.serializeObject=function(){var o={};var a=this.serializeArray();$.each(a,function(){if(o[this.name]){if(!o[this.name].push){o[this.name]=[o[this.name]];}o[this.name].push(this.value||'');}else{o[this.name]=this.value||'';}});return o;};jQuery.fn.fixedtableheader=function(options){var settings=jQuery.extend({headerrowsize:1,highlightrow:false,highlightclass:"highlight"},options);this.each(function(i){var $tbl=$(this);var $tblhfixed=$tbl.find("tr:lt("+settings.headerrowsize+")");var headerelement="th";if($tblhfixed.find(headerelement).length==0)headerelement="td";if($tblhfixed.find(headerelement).length>0){$tblhfixed.find(headerelement).each(function(){$(this).css("width",$(this).width());});var $clonedTable=$tbl.clone().empty();var tblwidth=GetTblWidth($tbl);$clonedTable.attr("id","fixedtableheader"+i).css({"position":"fixed","top":"0","left":$tbl.offset().left}).append($tblhfixed.clone()).width(tblwidth).hide().appendTo($("body"));if(settings.highlightrow)$("tr:gt("+(settings.headerrowsize-1)+")",$tbl).hover(function(){$(this).addClass(settings.highlightclass);},function(){$(this).removeClass(settings.highlightclass);});$(window).scroll(function(){if(jQuery.browser.msie&&jQuery.browser.version=="6.0")$clonedTable.css({"position":"absolute","top":$(window).scrollTop(),"left":$tbl.offset().left});else $clonedTable.css({"position":"fixed","top":"0","left":$tbl.offset().left-$(window).scrollLeft()});var sctop=$(window).scrollTop();var elmtop=$tblhfixed.offset().top;if(sctop>elmtop&&sctop<=(elmtop+$tbl.height()-$tblhfixed.height()))$clonedTable.show();else $clonedTable.hide();});$(window).resize(function(){if($clonedTable.outerWidth()!=$tbl.outerWidth()){$tblhfixed.find(headerelement).each(function(index){var w=$(this).width();$(this).css("width",w);$clonedTable.find(headerelement).eq(index).css("width",w);});$clonedTable.width($tbl.outerWidth());}$clonedTable.css("left",$tbl.offset().left);});}});function GetTblWidth($tbl){var tblwidth=$tbl.outerWidth();return tblwidth;}};