

(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

(function($){$.jGrowl=function(m,o){if($('#jGrowl').size()==0)$('<div id="jGrowl"></div>').addClass($.jGrowl.defaults.position).appendTo('body');$('#jGrowl').jGrowl(m,o);};$.fn.jGrowl=function(m,o){if($.isFunction(this.each)){var args=arguments;return this.each(function(){var self=this;if($(this).data('jGrowl.instance')==undefined){$(this).data('jGrowl.instance',new $.fn.jGrowl());$(this).data('jGrowl.instance').startup(this);}
if($.isFunction($(this).data('jGrowl.instance')[m])){$(this).data('jGrowl.instance')[m].apply($(this).data('jGrowl.instance'),$.makeArray(args).slice(1));}else{$(this).data('jGrowl.instance').create(m,o);}});};};$.extend($.fn.jGrowl.prototype,{defaults:{pool:0,header:'',group:'',sticky:false,position:'top-right',glue:'after',theme:'default',corners:'10px',check:250,life:3000,speed:'normal',easing:'swing',closer:true,closeTemplate:'&times;',closerTemplate:'<div>[ close all ]</div>',log:function(e,m,o){},beforeOpen:function(e,m,o){},open:function(e,m,o){},beforeClose:function(e,m,o){},close:function(e,m,o){},animateOpen:{opacity:'show'},animateClose:{opacity:'hide'}},notifications:[],element:null,interval:null,create:function(message,o){var o=$.extend({},this.defaults,o);this.notifications[this.notifications.length]={message:message,options:o};o.log.apply(this.element,[this.element,message,o]);},render:function(notification){var self=this;var message=notification.message;var o=notification.options;var notification=$('<div class="jGrowl-notification'+((o.group!=undefined&&o.group!='')?' '+o.group:'')+'"><div class="close">'+o.closeTemplate+'</div><div class="header">'+o.header+'</div><div class="message">'+message+'</div></div>').data("jGrowl",o).addClass(o.theme).children('div.close').bind("click.jGrowl",function(){$(this).parent().trigger('jGrowl.close');}).parent();(o.glue=='after')?$('div.jGrowl-notification:last',this.element).after(notification):$('div.jGrowl-notification:first',this.element).before(notification);$(notification).bind("mouseover.jGrowl",function(){$(this).data("jGrowl").pause=true;}).bind("mouseout.jGrowl",function(){$(this).data("jGrowl").pause=false;}).bind('jGrowl.beforeOpen',function(){o.beforeOpen.apply(self.element,[self.element,message,o]);}).bind('jGrowl.open',function(){o.open.apply(self.element,[self.element,message,o]);}).bind('jGrowl.beforeClose',function(){o.beforeClose.apply(self.element,[self.element,message,o]);}).bind('jGrowl.close',function(){$(this).trigger('jGrowl.beforeClose').animate(o.animateClose,o.speed,o.easing,function(){$(this).remove();o.close.apply(self.element,[self.element,message,o]);});}).trigger('jGrowl.beforeOpen').animate(o.animateOpen,o.speed,o.easing,function(){$(this).data("jGrowl").created=new Date();}).trigger('jGrowl.open');if($.fn.corner!=undefined)$(notification).corner(o.corners);if($('div.jGrowl-notification:parent',this.element).size()>1&&$('div.jGrowl-closer',this.element).size()==0&&this.defaults.closer!=false){$(this.defaults.closerTemplate).addClass('jGrowl-closer').addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){$(this).siblings().children('div.close').trigger("click.jGrowl");if($.isFunction(self.defaults.closer))self.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);});};},update:function(){$(this.element).find('div.jGrowl-notification:parent').each(function(){if($(this).data("jGrowl")!=undefined&&$(this).data("jGrowl").created!=undefined&&($(this).data("jGrowl").created.getTime()+$(this).data("jGrowl").life)<(new Date()).getTime()&&$(this).data("jGrowl").sticky!=true&&($(this).data("jGrowl").pause==undefined||$(this).data("jGrowl").pause!=true)){$(this).trigger('jGrowl.close');}});if(this.notifications.length>0&&(this.defaults.pool==0||$(this.element).find('div.jGrowl-notification:parent').size()<this.defaults.pool)){this.render(this.notifications.shift());}
if($(this.element).find('div.jGrowl-notification:parent').size()<2){$(this.element).find('div.jGrowl-closer').animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){$(this).remove();});};},startup:function(e){this.element=$(e).addClass('jGrowl').append('<div class="jGrowl-notification"></div>');this.interval=setInterval(function(){jQuery(e).data('jGrowl.instance').update();},this.defaults.check);if($.browser.msie&&parseInt($.browser.version)<8)$(this.element).addClass('ie6');},shutdown:function(){$(this.element).removeClass('jGrowl').find('div.jGrowl-notification').remove();clearInterval(this.interval);}});$.jGrowl.defaults=$.fn.jGrowl.prototype.defaults;})(jQuery);

var sjWidgets={'initAlert':false,'alert':function(){var text=arguments[0];var theme=arguments[1]||'alert';try{if(!this.initAlert)
{$.jGrowl.defaults.closerTemplate='<div>[закрыть все]</div>';$.jGrowl.defaults.position=arguments[2]||'bottom-right';}
$.jGrowl(text,{glue:'top',theme:theme,corners:5,life:5000})
if(!this.initAlert)
{if($.browser.msie&&$.browser.version>=8)
{$('#jGrowl').css('position','absolute');}
this.initAlert=true;}}catch(e){alert(text)}},'sendRequest':function(data,reqType,targeturi){var uri=targeturi&&targeturi.length?targeturi:this.baseURI;var backref=this;var errmsg='Произошла ошибка системы!';if(typeof(backref.setLoadingState)=='function')
backref.setLoadingState(true);$.ajax({url:uri,cache:false,dataType:'text',error:function(xhr,ts,err){if(typeof(backref.setLoadingState)=='function')
backref.setLoadingState(false,true);if(/isdvlpr_on=1;/.test(document.cookie))
errmsg+=' (ошибка xhttprequest: status = "'+xhr.status+'")';sjWidgets.alert(errmsg);},success:function(data){if(typeof(backref.setLoadingState)=='function')
backref.setLoadingState(false);try{eval(data);}
catch(e){if(/isdvlpr_on=1;/.test(document.cookie))
errmsg+=' (ошибка при обработке ответа с сервера: '+e.message+' at line '+e.lineNumber+' in '+e.fileName+')';sjWidgets.alert(errmsg);}},data:data,type:reqType});},'getFormData':function(form){var food={};$(':input:not(:checkbox),input:checkbox:checked',form).each(function(){food[this.name]=this.value==this.title?'':$(this).val()});return food;},'marks':[],'notch':function(name){this.marks.push([name,new Date()]);},'printMarks':function(){if($.browser.msie)
{var msg='';for(i in this.marks)
{if(i>0)
msg+=this.marks[i-1][0]+' to '+
this.marks[i][0]+': '+
(this.marks[i][1].getTime()-this.marks[i-1][1].getTime())+' ms\n';}
window.alert(msg);}
else
{for(i in this.marks)
{if(i>0)
this.log(this.marks[i-1][0]+' to '+
this.marks[i][0]+': '+
(this.marks[i][1].getTime()-this.marks[i-1][1].getTime())+' ms');}}},'log':function(message){if(typeof(window.console)=='undefined')
this.alert(message);else
window.console.log(message);},'stop':function(){if($.browser.msie)
window.document.execCommand('Stop');else
window.stop();return false;},'makeListSelect':function(){new ListSelect($(this));}};function Rule(){};Rule.prototype={field:'',required:false,name:'',checkFunc:null};function formParser($form,rules){this.$form=$form;this.rules=rules;this.results=[];this.parsed=false;}
formParser.prototype={setRules:function(rules){this.rules=rules;this.results=[];this.parsed=false;},parse:function(){if(this.parsed){return;}
this.results=[];for(var rule_index in this.rules){var rule=this.rules[rule_index];var field_value=this.$form.find("[name='"+rule.field+"']").val();if(!field_value&&rule.required){this.results.push({field:rule.field,error:"Поле не заполнено."});continue;}
if(typeof rule.checkFunc=="function"){var result=rule.checkFunc(this.$form,field_value);if(result){this.results.push({field:rule.field,error:result});continue;}}}
this.parsed=true;},getResults:function(){this.parse();return this.results;},valid:function(){this.parse();return(this.results.length===0);},reset:function(){this.parsed=false;}};function cleanErrors($form,rules){for(var rule_index in rules){var rule=rules[rule_index];var field=$form.find("[name='"+rule.field+"']");field.removeClass('field_with_error');field.next('span.tiny_error').remove();}}
function attachErrors($form,errors){for(var error_index in errors){var error=errors[error_index];var field=$form.find("[name='"+error.field+"']");field.addClass('field_with_error');field.after('<span class="tiny_error">'+error.error+'</span>');}}