function Popup(B,A){this.popup=null;this._initOptions(A);this.events={};this.content=$(B);this.blurEvent=null;this.blurHandler=null;this.opened=false}Popup.prototype={eventTypes:["onShow","onClose","onSave"],make:function(H,J){H=H||document.body;this._makeEvents(J);if(this.popup==null){var B=new Element("div",{id:this.options.popupId,style:"display: none;"});B.addClassName(this.options.baseClassName||"bubble");this.options.className&&B.addClassName(this.options.className);B.update('<div class="r-border layout-top"><div class="top_right"><div></div></div><div class="top_left"><div></div></div><div class="close" title="(Esc)"></div></div><div class="content"></div><div class="r-border layout-bottom"><div class="bottom_right"><div></div></div><div class="bottom_left"><div></div></div></div>');this.popup=B;$("popups-container").insert(B);var G=this.popup.select(".content").first();this.content&&G.insert(this.content);var A=this.close.bindAsEventListener(this);var I=this.popup.select(".close").first();I.observe("click",A);document.observe("keydown",this._esc.bindAsEventListener(this));var E=this.popup.select(".closeSettingsWindow").first();if(E){E.observe("click",A)}var C=this.popup.select(".saveSettingsWindow").first();if(C){C.observe("click",this.save.bindAsEventListener(this))}this.blurHandler=this.blur.bindAsEventListener(this)}try{this._show(H)}catch(F){this._show(H)}$(this.popup).setStyle({display:"block"});var D=this;window.setTimeout(function(){document.observe("click",D.blurHandler)},1);this.opened=true;return false},_initOptions:function(A){A=A||{};var B=function(){};this.eventTypes.each(function(C){if(!A[C]){A[C]=B}});this.options=A},_makeEvents:function(A){A=A||{};var B=function(){};this.eventTypes.each(function(C){if(!A[C]){A[C]=B}});this.events=A},_show:function(C){Element.clonePosition(this.popup,C,{setWidth:false,setHeight:false});if(this.options.align){var B=this.popup.getWidth();var D=parseInt(this.popup.getStyle("left"))||0;switch(this.options.align){case"right":D-=B;break;case"center":var A=C.getWidth();D+=(A-B)/2;break;default:D=-1}if(D!=-1){if(D<49){D=49}this.popup.setStyle({left:D+"px"})}}if(this.options.top){this.popup.setStyle({top:(C.cumulativeOffset().top+parseFloat(this.options.top))+"px"})}$$("html > body").first().addClassName("popup-showing");var E=this;window.setTimeout(function(){E.options.onShow();E.events.onShow()},1)},_esc:function(A){if(this.opened){if(A.keyCode==Event.KEY_ESC){this.close()}}},close:function(){this.options.onClose();this.events.onClose();this.kill()},save:function(){if(!this.options.onSave()&&!this.events.onSave()){this.kill()}},blur:function(C){var B=$(C.target);var A=this.popup;if(!(B.descendantOf(A)||B==A)){}},kill:function(){if(this.opened&&this.popup){document.stopObserving("click",this.blurHandler);this.popup.style.display="none";this.opened=false}}};function TipRequest(B,A){this.url="/tips/"+B;A=A||{};A.baseClassName="tip tipform";A.popupId="tips_"+B;A.top=14;A.align="right";this.popup=new Popup(null,A)}TipRequest.prototype={make:function(A){if(this.popup.opened){this.kill()}else{if(this.popup.content){this.popup.make(A)}else{var B=this;new Ajax.Request(this.url,{method:"get",onSuccess:function(C){B.popup.content=C.responseText;B.popup.make(A)}})}}return false},kill:function(){this.popup.kill()}};function FootNote(B,A){A=A||{};A.baseClassName="tip tipform";A.popupId="tips_"+B;A.top=14;var C=A.element;this.popup=new Popup(null,A);this.popup.content=C.title.replace(/\\n/g,"<br />");C.title=""}FootNote.prototype={make:function(A){if(this.popup.opened){this.kill()}else{this.popup.make(A)}return false},kill:function(){this.popup.kill()}};var Tips=(function(){var B={};var A=[];return{init:function(D,E,C){E=E||"TipRequest";B[D]=new window[E](D,C)},make:function(C,E){for(var D in B){if(D!=C){B[D].kill()}}B[C].make(E);if(A.indexOf(E)==-1){A.push(E)}this.initClick()},hideAll:function(D){if(A.indexOf(D.target)!=-1){return}for(var C in B){B[C].kill()}},initClick:function(){document.observe("click",this.hideAll.bindAsEventListener(this));this.initClick=function(){}}}})();var swfobject=function(){var AQ="undefined",Ac="object",AB="Shockwave Flash",X="ShockwaveFlash.ShockwaveFlash",Ad="application/x-shockwave-flash",AC="SWFObjectExprInst",AW="onreadystatechange",AF=window,Ak=document,Aa=navigator,AA=false,Z=[Am],Af=[],AG=[],AL=[],Ai,AD,AP,AS,AK=false,At=false,Ag,AN,Ah=true,AH=function(){var A=typeof Ak.getElementById!=AQ&&typeof Ak.getElementsByTagName!=AQ&&typeof Ak.createElement!=AQ,E=Aa.userAgent.toLowerCase(),C=Aa.platform.toLowerCase(),H=C?/win/.test(C):/win/.test(E),J=C?/mac/.test(C):/mac/.test(E),G=/webkit/.test(E)?parseFloat(E.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,D=!+"\v1",F=[0,0,0],K=null;if(typeof Aa.plugins!=AQ&&typeof Aa.plugins[AB]==Ac){K=Aa.plugins[AB].description;if(K&&!(typeof Aa.mimeTypes!=AQ&&Aa.mimeTypes[Ad]&&!Aa.mimeTypes[Ad].enabledPlugin)){AA=true;D=false;K=K.replace(/^.*\s+(\S+\s+\S+$)/,"$1");F[0]=parseInt(K.replace(/^(.*)\..*$/,"$1"),10);F[1]=parseInt(K.replace(/^.*\.(.*)\s.*$/,"$1"),10);F[2]=/[a-zA-Z]/.test(K)?parseInt(K.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof AF.ActiveXObject!=AQ){try{var I=new ActiveXObject(X);if(I){K=I.GetVariable("$version");if(K){D=true;K=K.split(" ")[1].split(",");F=[parseInt(K[0],10),parseInt(K[1],10),parseInt(K[2],10)]}}}catch(B){}}}return{w3:A,pv:F,wk:G,ie:D,win:H,mac:J}}(),Aj=function(){if(!AH.w3){return}if((typeof Ak.readyState!=AQ&&Ak.readyState=="complete")||(typeof Ak.readyState==AQ&&(Ak.getElementsByTagName("body")[0]||Ak.body))){Ao()}if(!AK){if(typeof Ak.addEventListener!=AQ){Ak.addEventListener("DOMContentLoaded",Ao,false)}if(AH.ie&&AH.win){Ak.attachEvent(AW,function(){if(Ak.readyState=="complete"){Ak.detachEvent(AW,arguments.callee);Ao()}});if(AF==top){(function(){if(AK){return}try{Ak.documentElement.doScroll("left")}catch(A){setTimeout(arguments.callee,0);return}Ao()})()}}if(AH.wk){(function(){if(AK){return}if(!/loaded|complete/.test(Ak.readyState)){setTimeout(arguments.callee,0);return}Ao()})()}Ab(Ao)}}();function Ao(){if(AK){return}try{var B=Ak.getElementsByTagName("body")[0].appendChild(AR("span"));B.parentNode.removeChild(B)}catch(A){return}AK=true;var D=Z.length;for(var C=0;C<D;C++){Z[C]()}}function AJ(A){if(AK){A()}else{Z[Z.length]=A}}function Ab(A){if(typeof AF.addEventListener!=AQ){AF.addEventListener("load",A,false)}else{if(typeof Ak.addEventListener!=AQ){Ak.addEventListener("load",A,false)}else{if(typeof AF.attachEvent!=AQ){Al(AF,"onload",A)}else{if(typeof AF.onload=="function"){var B=AF.onload;AF.onload=function(){B();A()}}else{AF.onload=A}}}}}function Am(){if(AA){Y()}else{AM()}}function Y(){var D=Ak.getElementsByTagName("body")[0];var B=AR(Ac);B.setAttribute("type",Ad);var A=D.appendChild(B);if(A){var C=0;(function(){if(typeof A.GetVariable!=AQ){var E=A.GetVariable("$version");if(E){E=E.split(" ")[1].split(",");AH.pv=[parseInt(E[0],10),parseInt(E[1],10),parseInt(E[2],10)]}}else{if(C<10){C++;setTimeout(arguments.callee,10);return}}D.removeChild(B);A=null;AM()})()}else{AM()}}function AM(){var G=Af.length;if(G>0){for(var H=0;H<G;H++){var C=Af[H].id;var L=Af[H].callbackFn;var A={success:false,id:C};if(AH.pv[0]>0){var I=Ar(C);if(I){if(AO(Af[H].swfVersion)&&!(AH.wk&&AH.wk<312)){AX(C,true);if(L){A.success=true;A.ref=AU(C);L(A)}}else{if(Af[H].expressInstall&&AT()){var E={};E.data=Af[H].expressInstall;E.width=I.getAttribute("width")||"0";E.height=I.getAttribute("height")||"0";if(I.getAttribute("class")){E.styleclass=I.getAttribute("class")}if(I.getAttribute("align")){E.align=I.getAttribute("align")}var F={};var D=I.getElementsByTagName("param");var K=D.length;for(var J=0;J<K;J++){if(D[J].getAttribute("name").toLowerCase()!="movie"){F[D[J].getAttribute("name")]=D[J].getAttribute("value")}}AE(E,F,C,L)}else{Ae(I);if(L){L(A)}}}}}else{AX(C,true);if(L){var B=AU(C);if(B&&typeof B.SetVariable!=AQ){A.success=true;A.ref=B}L(A)}}}}}function AU(B){var D=null;var C=Ar(B);if(C&&C.nodeName=="OBJECT"){if(typeof C.SetVariable!=AQ){D=C}else{var A=C.getElementsByTagName(Ac)[0];if(A){D=A}}}return D}function AT(){return !At&&AO("6.0.65")&&(AH.win||AH.mac)&&!(AH.wk&&AH.wk<312)}function AE(F,D,H,E){At=true;AP=E||null;AS={success:false,id:H};var A=Ar(H);if(A){if(A.nodeName=="OBJECT"){Ai=An(A);AD=null}else{Ai=A;AD=H}F.id=AC;if(typeof F.width==AQ||(!/%$/.test(F.width)&&parseInt(F.width,10)<310)){F.width="310"}if(typeof F.height==AQ||(!/%$/.test(F.height)&&parseInt(F.height,10)<137)){F.height="137"}Ak.title=Ak.title.slice(0,47)+" - Flash Player Installation";var B=AH.ie&&AH.win?"ActiveX":"PlugIn",C="MMredirectURL="+AF.location.toString().replace(/&/g,"%26")+"&MMplayerType="+B+"&MMdoctitle="+Ak.title;if(typeof D.flashvars!=AQ){D.flashvars+="&"+C}else{D.flashvars=C}if(AH.ie&&AH.win&&A.readyState!=4){var G=AR("div");H+="SWFObjectNew";G.setAttribute("id",H);A.parentNode.insertBefore(G,A);A.style.display="none";(function(){if(A.readyState==4){A.parentNode.removeChild(A)}else{setTimeout(arguments.callee,10)}})()}AZ(F,D,H)}}function Ae(A){if(AH.ie&&AH.win&&A.readyState!=4){var B=AR("div");A.parentNode.insertBefore(B,A);B.parentNode.replaceChild(An(A),B);A.style.display="none";(function(){if(A.readyState==4){A.parentNode.removeChild(A)}else{setTimeout(arguments.callee,10)}})()}else{A.parentNode.replaceChild(An(A),A)}}function An(B){var D=AR("div");if(AH.win&&AH.ie){D.innerHTML=B.innerHTML}else{var E=B.getElementsByTagName(Ac)[0];if(E){var A=E.childNodes;if(A){var F=A.length;for(var C=0;C<F;C++){if(!(A[C].nodeType==1&&A[C].nodeName=="PARAM")&&!(A[C].nodeType==8)){D.appendChild(A[C].cloneNode(true))}}}}}return D}function AZ(E,G,C){var D,A=Ar(C);if(AH.wk&&AH.wk<312){return D}if(A){if(typeof E.id==AQ){E.id=C}if(AH.ie&&AH.win){var F="";for(var I in E){if(E[I]!=Object.prototype[I]){if(I.toLowerCase()=="data"){G.movie=E[I]}else{if(I.toLowerCase()=="styleclass"){F+=' class="'+E[I]+'"'}else{if(I.toLowerCase()!="classid"){F+=" "+I+'="'+E[I]+'"'}}}}}var H="";for(var J in G){if(G[J]!=Object.prototype[J]){H+='<param name="'+J+'" value="'+G[J]+'" />'}}A.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+F+">"+H+"</object>";AG[AG.length]=E.id;D=Ar(E.id)}else{var B=AR(Ac);B.setAttribute("type",Ad);for(var K in E){if(E[K]!=Object.prototype[K]){if(K.toLowerCase()=="styleclass"){B.setAttribute("class",E[K])}else{if(K.toLowerCase()!="classid"){B.setAttribute(K,E[K])}}}}for(var L in G){if(G[L]!=Object.prototype[L]&&L.toLowerCase()!="movie"){Ap(B,L,G[L])}}A.parentNode.replaceChild(B,A);D=B}}return D}function Ap(B,D,C){var A=AR("param");A.setAttribute("name",D);A.setAttribute("value",C);B.appendChild(A)}function AV(A){var B=Ar(A);if(B&&B.nodeName=="OBJECT"){if(AH.ie&&AH.win){B.style.display="none";(function(){if(B.readyState==4){As(A)}else{setTimeout(arguments.callee,10)}})()}else{B.parentNode.removeChild(B)}}}function As(A){var B=Ar(A);if(B){for(var C in B){if(typeof B[C]=="function"){B[C]=null}}B.parentNode.removeChild(B)}}function Ar(A){var C=null;try{C=Ak.getElementById(A)}catch(B){}return C}function AR(A){return Ak.createElement(A)}function Al(A,C,B){A.attachEvent(C,B);AL[AL.length]=[A,C,B]}function AO(A){var B=AH.pv,C=A.split(".");C[0]=parseInt(C[0],10);C[1]=parseInt(C[1],10)||0;C[2]=parseInt(C[2],10)||0;return(B[0]>C[0]||(B[0]==C[0]&&B[1]>C[1])||(B[0]==C[0]&&B[1]==C[1]&&B[2]>=C[2]))?true:false}function AY(B,F,A,C){if(AH.ie&&AH.mac){return}var E=Ak.getElementsByTagName("head")[0];if(!E){return}var G=(A&&typeof A=="string")?A:"screen";if(C){Ag=null;AN=null}if(!Ag||AN!=G){var D=AR("style");D.setAttribute("type","text/css");D.setAttribute("media",G);Ag=E.appendChild(D);if(AH.ie&&AH.win&&typeof Ak.styleSheets!=AQ&&Ak.styleSheets.length>0){Ag=Ak.styleSheets[Ak.styleSheets.length-1]}AN=G}if(AH.ie&&AH.win){if(Ag&&typeof Ag.addRule==Ac){Ag.addRule(B,F)}}else{if(Ag&&typeof Ak.createTextNode!=AQ){Ag.appendChild(Ak.createTextNode(B+" {"+F+"}"))}}}function AX(A,C){if(!Ah){return}var B=C?"visible":"hidden";if(AK&&Ar(A)){Ar(A).style.visibility=B}else{AY("#"+A,"visibility:"+B)}}function AI(B){var A=/[\\\"<>\.;]/;var C=A.exec(B)!=null;return C&&typeof encodeURIComponent!=AQ?encodeURIComponent(B):B}var Aq=function(){if(AH.ie&&AH.win){window.attachEvent("onunload",function(){var A=AL.length;for(var B=0;B<A;B++){AL[B][0].detachEvent(AL[B][1],AL[B][2])}var D=AG.length;for(var C=0;C<D;C++){AV(AG[C])}for(var E in AH){AH[E]=null}AH=null;for(var F in swfobject){swfobject[F]=null}swfobject=null})}}();return{registerObject:function(A,E,C,B){if(AH.w3&&A&&E){var D={};D.id=A;D.swfVersion=E;D.expressInstall=C;D.callbackFn=B;Af[Af.length]=D;AX(A,false)}else{if(B){B({success:false,id:A})}}},getObjectById:function(A){if(AH.w3){return AU(A)}},embedSWF:function(K,E,H,F,C,A,B,I,G,J){var D={success:false,id:E};if(AH.w3&&!(AH.wk&&AH.wk<312)&&K&&E&&H&&F&&C){AX(E,false);AJ(function(){H+="";F+="";var Q={};if(G&&typeof G===Ac){for(var O in G){Q[O]=G[O]}}Q.data=K;Q.width=H;Q.height=F;var N={};if(I&&typeof I===Ac){for(var P in I){N[P]=I[P]}}if(B&&typeof B===Ac){for(var L in B){if(typeof N.flashvars!=AQ){N.flashvars+="&"+L+"="+B[L]}else{N.flashvars=L+"="+B[L]}}}if(AO(C)){var M=AZ(Q,N,E);if(Q.id==E){AX(E,true)}D.success=true;D.ref=M}else{if(A&&AT()){Q.data=A;AE(Q,N,E,J);return}else{AX(E,true)}}if(J){J(D)}})}else{if(J){J(D)}}},switchOffAutoHideShow:function(){Ah=false},ua:AH,getFlashPlayerVersion:function(){return{major:AH.pv[0],minor:AH.pv[1],release:AH.pv[2]}},hasFlashPlayerVersion:AO,createSWF:function(A,B,C){if(AH.w3){return AZ(A,B,C)}else{return undefined}},showExpressInstall:function(B,A,D,C){if(AH.w3&&AT()){AE(B,A,D,C)}},removeSWF:function(A){if(AH.w3){AV(A)}},createCSS:function(B,A,C,D){if(AH.w3){AY(B,A,C,D)}},addDomLoadEvent:AJ,addLoadEvent:Ab,getQueryParamValue:function(B){var A=Ak.location.search||Ak.location.hash;if(A){if(/\?/.test(A)){A=A.split("?")[1]}if(B==null){return AI(A)}var C=A.split("&");for(var D=0;D<C.length;D++){if(C[D].substring(0,C[D].indexOf("="))==B){return AI(C[D].substring((C[D].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(At){var A=Ar(AC);if(A&&Ai){A.parentNode.replaceChild(Ai,A);if(AD){AX(AD,true);if(AH.ie&&AH.win){Ai.style.display="block"}}if(AP){AP(AS)}}At=false}}}}();var Calendar=function(A,B){this.model=new Calendar.Model(B.fromDate);this.view=new Calendar.View(A);this.options=B;this.init()};Calendar.prototype={init:function(){this.workingDays=[];var A=this.model.getCurrentDate();var B=this.model.getCurrentMonth();this.view.render(A,B);$(this.view.getPrevMonthId()).observe("click",this.prevMonth.bindAsEventListener(this));$(this.view.getNextMonthId()).observe("click",this.nextMonth.bindAsEventListener(this));this.setDayEvents(B);if(this.options.changeMonth){this.options.changeMonth(this,B)}},removeDayEvents:function(){for(var B in this.dayListeners){var A=this.dayListeners[B];A.obj.stopObserving("click",A.lst)}this.dayListeners={}},setDayEvents:function(C){this.dayListeners={};var E=Calendar.Helpers.getMonthDays(C);for(var D=1;D<=E;D++){var B=$(this.view.getDayId(D));var A=this.selectDay.bindAsEventListener(this,D);B.observe("click",A);this.dayListeners[D]={obj:B,lst:A}}},update:function(){this.removeDayEvents();var A=this.model.getCurrentDate();var B=this.model.getCurrentMonth();this.view.updateTitle(B);this.view.updateMonthTable(A,B);this.setDayEvents(B);if(this.options.changeMonth){this.options.changeMonth(this,B)}},nextMonth:function(){this.model.nextMonth();this.update()},prevMonth:function(){this.model.prevMonth();this.update()},selectDay:function(B){var C=this.model.currentDate;this.model.setDay(arguments[1]);var A=this.model.getCurrentDate();if(this.options.selectDay(this,A)){this.view.updateToday(A)}else{this.model.setDay(C)}},fillingDays:function(C,E){if(Calendar.Helpers.currentDateInMonth(C,this.model.getCurrentMonth())){this.workingDays=E;for(var D=0,A=E.length;D<A;D++){var B=$(this.view.getDayId(E[D]));B.removeClassName("future")}}},isWorkingDay:function(A){return this.workingDays.indexOf(A.getDate())!=-1}};Calendar.Model=function(A){this.setCurrentDate(A);this.setCurrentMonth(this.getCurrentDate())};Calendar.Model.prototype={nextMonth:function(){this.currentMonth.setMonth(this.currentMonth.getMonth()+1)},prevMonth:function(){this.currentMonth.setMonth(this.currentMonth.getMonth()-1)},setDay:function(A){this.currentDate=new Date(this.currentMonth.getFullYear(),this.currentMonth.getMonth(),A)},setCurrentDate:function(A){this.currentDate=A},getCurrentDate:function(){return this.currentDate},setCurrentMonth:function(A){this.currentMonth=new Date(A.getFullYear(),A.getMonth(),1)},getCurrentMonth:function(){return this.currentMonth}};Calendar.Helpers={MONTHS:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"],MONTHS_ABBR:["янв","фев","мар","апр","мая","июн","июл","авг","сен","окт","ноя","дек"],isLeapYear:function(A){return new Date(A.getFullYear(),1,29).getDate()==29},getDay:function(B){var A=B.getDay();if(A==0){A=7}return A-1},getMonthDays:function(A){var B=A.getMonth();var C=[31,this.isLeapYear(A)?29:28,31,30,31,30,31,31,30,31,30,31];return C[B]},getMonthName:function(A){return this.MONTHS[A.getMonth()]},getMonthAbbr:function(A){return this.MONTHS_ABBR[A.getMonth()]},getMonthWithZero:function(A){var B=A.getMonth()+1;return B<10?"0"+B:B},currentDateInMonth:function(A,B){return(A.getFullYear()==B.getFullYear()&&A.getMonth()==B.getMonth())},dateToQuery:function(A){return A.getFullYear()+"-"+(A.getMonth()+1)+"-"+A.getDate()},dateToString:function(A){return[A.getDate(),this.getMonthAbbr(A),A.getFullYear()].join("&#160;")},periodToString:function(D,C){var B=this.dateToString(D);var A=this.dateToString(C);if(B==A){return B}else{return B+"&#160;&#8211; "+A}}};Calendar.View=function(A){this.container=$(A);this.id=this.container.id};Calendar.View.prototype={getPrevMonthId:function(){return this.id+"-prev-month"},getNextMonthId:function(){return this.id+"-next-month"},getDayId:function(A){return this.id+"-day-"+A},render:function(A,D){var C=new Element("table",{id:"calendar"});C.insert(this.renderTitle(D));C.insert(this.renderWeekDays());var B=new Element("tbody",{id:this.id+"-month-table"});B.insert(this.renderMonthTable(A,D));C.insert(B);this.container.insert(C)},renderTitle:function(C){var B=new Template('<tr><th id="#{prev_month_id}" class="left"></th><th id="#{id}-title" colspan="7">#{month}, #{year}</th><th id="#{next_month_id}" class="right"></th></tr>');var A=new Element("thead");return A.insert(B.evaluate({id:this.id,prev_month_id:this.getPrevMonthId(),next_month_id:this.getNextMonthId(),month:Calendar.Helpers.getMonthName(C),year:C.getFullYear()}))},renderWeekDays:function(){var B=new Template('<tr class="head"><td class="left"></td><td>пн</td><td>вт</td><td>ср</td><td>чт</td><td>пт</td><td class="weekend">сб</td><td class="weekend">вс</td><td class="right"></td></tr>');var A=new Element("thead");return A.insert(B.evaluate({id:this.id}))},renderMonthTable:function(C,K){var B=Calendar.Helpers.getDay(K);var L=Calendar.Helpers.getMonthDays(K);var J=L+B;var O=Math.ceil(J/7);var N=[];var G=-B;var F=C.getDate();var I=Calendar.Helpers.currentDateInMonth(C,K);for(var A=0;A<O;A++){N.push("<tr");var M=A*7-B;if(I&&(F>M&&F<=(M+7))){N.push(' class="current"')}N.push(">");N.push('<td class="left"></td>');for(var E=0;E<7;E++){G++;var D=G>0&&G<=L;N.push('<td class="');if(E>=5){N.push(" weekend")}if(I){if(F==G){N.push(" today")}}if(D){N.push(" day")}N.push(" future");N.push('"');if(D){N.push(' id="#{id}-day-'+G+'"')}N.push(">");if(D){N.push(G)}N.push("</td>")}N.push('<td class="right"></td>');N.push("</tr>")}var H=new Template(N.join(""));delete N;return H.evaluate({id:this.id})},updateTitle:function(B){var C=Calendar.Helpers.getMonthName(B);var A=B.getFullYear();$(this.id+"-title").update(C+", "+A)},updateMonthTable:function(A,C){var B=this.renderMonthTable(A,C);$(this.id+"-month-table").update(B)},updateToday:function(B){$(this.id+"-month-table").select("tr").each(function(E){E.removeClassName("current")});var D=Calendar.Helpers.getMonthDays(B);for(var C=1;C<=D;C++){var A=$(this.getDayId(C));if(C==B.getDate()){A.addClassName("today");$(A.parentNode).addClassName("current")}else{A.removeClassName("today")}}}};var CalendarPeriod=function(A,B){this.popupContainerId=A;this.options=B;this.popupId=this.options.popupId;this.popupContainer=$(this.popupContainerId);this.init()};CalendarPeriod.prototype={init:function(){var D=this.popupContainer.select(".calendars")[0];var C=this.popupContainer.select(".periods-selector")[0];var I=C.select(".periods-date-from")[0];I.observe("click",this.showCalendarFrom.bindAsEventListener(this));this.periodFromContainer=I;var G=C.select(".periods-date-to")[0];G.observe("click",this.showCalendarTo.bindAsEventListener(this));this.periodToContainer=G;var B=this.popupId+"-calendar-from";var A=this.popupId+"-calendar-to";var F=new Element("div",{id:B});D.insert(F);this.calendarFromContainer=F;var H=new Element("div",{id:A});D.insert(H);this.calendarToContainer=H;var E=this;this.calendarFrom=new Calendar(B,{fromDate:this.options.dateFrom,selectDay:function(K,J){E.setFromDate();return true}});this.calendarTo=new Calendar(A,{fromDate:this.options.dateTo,selectDay:function(K,J){E.setToDate();return true}});this.setFromDate();this.setToDate();this.showCalendarFrom();this.popup=new Popup(this.popupContainerId,{popupId:this.popupId,className:"period-popup",onSave:function(){E.options.onSave(E.getFromDate(),E.getToDate())}})},make:function(A){this.showCalendarFrom();return this.popup.make(A)},toggleCalendars:function(A){if(A=="to"){this.calendarToContainer.show();this.calendarFromContainer.hide();this.periodFromContainer.addClassName("pseudo-link");this.periodToContainer.removeClassName("pseudo-link")}else{this.calendarFromContainer.show();this.calendarToContainer.hide();this.periodFromContainer.removeClassName("pseudo-link");this.periodToContainer.addClassName("pseudo-link")}},showCalendarFrom:function(){this.toggleCalendars("from")},showCalendarTo:function(){this.toggleCalendars("to")},getFromDate:function(){return this.calendarFrom.model.getCurrentDate()},getToDate:function(){return this.calendarTo.model.getCurrentDate()},setFromDate:function(){var A=Calendar.Helpers.dateToString(this.getFromDate());this.periodFromContainer.update(A)},setToDate:function(){var A=Calendar.Helpers.dateToString(this.getToDate());this.periodToContainer.update(A)}};var Range=function(A){this.element=A;this.init()};Range.prototype={init:function(){},select:function(B,A){this.element.setSelectionRange(B,A||B)},collapse:function(A){this.select(A?this.getStart():this.getEnd())},replace:function(D,B){var F=this.getStart(),A=F+D.length,C=this.element,E=C.value;C.value=E.substring(0,F)+D+E.substring(this.getEnd(),E.length);C.focus();if(!B){F=A}this.select(F,A)},extract:function(){return this.element.value.slice(this.getStart(),this.getEnd())},selectPattern:function(E,B,F){var G=this.element.value,C=G.length,H=typeof B=="number"?B:this.getStart();if(H>C){H=C}var I=H;function A(){var J=G.slice(H,I);return(E.test(J)&&J.lastIndexOf("\n")==-1)?J:null}do{H--}while(H>=0&&A());H++;do{I++}while(I<=C&&A());I--;var D=A();if(D){if(F){this.select(H,I)}return D}return null},charAtCaret:function(){var B=this.getStart(),A=this.getEnd();if(B==A){return this.element.value.slice(B,A+1)}return this.extract()},setCaret:function(A){this.select(A)},getStart:function(){return this.element.selectionStart},getEnd:function(){return this.element.selectionEnd},isSelected:function(){return this.getStart()!=this.getEnd()}};var RangeProto=Range.prototype;if(!window.getSelection){RangeProto.init=function(){this.isTextarea=this.element.tagName.toLowerCase()=="textarea"};RangeProto.getRange=function(C){var A,B=this.element;if(this.isTextarea){A=C.duplicate();A.moveToElementText(B)}else{A=B.createTextRange()}return A};RangeProto.select=function(E,A){var C=this.element,D=C.value,B=C.createTextRange();if(E<0){E=0}if(A>D.length){A=D.length}A=A||E;A-=E+D.slice(E+1,A).split("\n").length-1;E-=D.slice(0,E).split("\n").length-1;B.move("character",E);B.moveEnd("character",A);B.select()};RangeProto.getStart=function(){var B=document.selection.createRange(),A=this.getRange(B);A.setEndPoint("EndToStart",B);return A.text.length};RangeProto.getEnd=function(){var B=document.selection.createRange(),A=this.getRange(B);A.setEndPoint("EndToStart",B);return A.text.length+B.text.length}}function objToQueryString(C){if(typeof C!="object"){return}return B(C);function A(G,E,F){var D=(typeof E=="string")?E+"[]":F;if(typeof G[F]=="object"){return B(G[F],D)}else{return D+"="+encodeURIComponent(G[F])}}function B(K,I){var E=[];var H=arguments.callee;var G;if(K.constructor==Array){for(var F=0,D=K.length;F<D;F++){E.push(A(K,I,F))}}else{for(var J in K){E.push(A(K,I,J))}}return E.join("&")}}function initTagListOnce(D,H,G){H=H||"tags";var B=$(H);var A=new Range(B);var F=/^[^\s,]+,? *$/;var E=/^[^,]+$/;var C=new Ajax.Autocompleter(H,H+"_auto_complete",D,{frequency:0.2,callback:function(){return"value="+A.selectPattern(E).trim()+"&list="+B.value},updateElement:function(I){if(G){B.value=I.innerHTML}else{A.selectPattern(F,null,true);A.replace(I.innerHTML+", ");A.setCaret(B.value.length)}}})}var ROUBLES='<span class="rur">p<i></i><span>уб.</span></span>';document.documentElement.id="js";if(swfobject){swfobject.switchOffAutoHideShow()}function banner(C,B){var E="undefined";var D=Math.floor(Math.random()*1000000);if(typeof(document.referrer)!=E){if(typeof(afReferrer)==E){afReferrer=escape(document.referrer)}}else{afReferrer=""}if(typeof(B)==E){B=""}else{B+="/"}var A=new Date();document.write('<script type="text/javascript" src="http://ads.adfox.ru/'+B+"prepareCode?p1="+C.p1+"&amp;p2="+C.p2+"&amp;pucn=a&amp;pfc="+C.pfc+"&amp;pfb="+C.pfb+"&amp;pr="+D+"&amp;py="+(C.py||"a")+(C.pct?"&amp;pct="+C.pct:"")+(C.puid1?"&amp;puid1="+C.puid1:"")+(C.puid2?"&amp;puid2="+C.puid2:"")+"&amp;pt=b&amp;pd="+A.getDate()+"&amp;pw="+A.getDay()+"&amp;pv="+A.getHours()+"&amp;prr="+afReferrer+'"><\/script>')}function showAjaxLoader(A){$(A).addClassName("visible")}function hideAjaxLoader(A){$(A).removeClassName("visible")}function searchSample(){var A="альфа-банк финам газпром лукойл сбербанк татнефть втб аэрофлот gazp lkoh plzl gmkn rosn vtbr".split(" ");var B=Math.floor(Math.random()*A.length);return A[B]}function searchSampleInit(){var A=$("SearchSample");if(A){A.innerHTML=searchSample();A.observe("click",function(){$("SearchField").value=A.innerHTML})}}function find_swf(A){return swfobject.getObjectById(A)}function request(A){new Ajax.Request(A,{asynchronous:true,evalScripts:true});return false}function indicatorsAddObject(A){return(function(C,B){new Ajax.Request(A,{asynchronous:true,evalScripts:true,parameters:"id="+B.getAttribute("objectId")});C.value=""})}function closeFirstTime(){$("first-time").hide();request("/stock/close_first_time_block")}function focusToInput(){var A=$$(".focused").last();if(A){window.setTimeout(function(){A.focus()},0)}}function fadeFlashNotice(){var A=$$("#flash.notice").first();if(A){window.setTimeout(function(){A.fade()},20*1000)}}document.observe("dom:loaded",function(){searchSampleInit();focusToInput();fadeFlashNotice();initClosedBlocks();initWidgetTabs();initCollapsedLists()});function getRadioItemChecked(B){var C=$$("#"+B+" input[type=radio]");for(var D=0,A=C.length;D<A;D++){if(C[D].checked){return C[D]}}return null}function reloadStockChart(){var A=find_swf("micex_chart");A.reload("/chart/data?"+window.chartType+"="+window.chartId,false)}function initStockChart(){function B(){var D=getRadioItemChecked("stockBlockList");if(D){window.chartId=D.value;new Ajax.Request("/stock/save_chart_settings?type="+window.chartType+"&id="+window.chartId);$("stockBlockChart").addClassName("loading")}}var C=true;var A=new Popup("stockPopup",{popupId:"stockPopupBlock",onSave:B,onShow:function(){if(C){var D="stockIndicesList";$(D).update("Загрузка&hellip;");new Ajax.Updater(D,"/stock/indices_by_exchange",{parameters:{index_id:window.chartId}});C=false}}});$("stockOpenPopup").observe("click",function(){A.make($("stockBlockPoint"))});new PeriodicalExecuter(reloadStockChart,300)}function reloadCurrenciesChart(){var A=find_swf("currencies_chart");A.reload("/chart/data?"+window.chartType+"="+window.chartId,false)}function initCurrenciesChart(){function C(){var D=getRadioItemChecked("currenciesBlockList");if(D){window.chartId=D.value;window.chartType=$(D).adjacent("input[name=chart_type]")[0].value;new Ajax.Request("/currencies/save_chart_settings?type="+window.chartType+"&id="+window.chartId);$("currenciesBlockChart").addClassName("loading")}}var B=true;var A=new Popup("currenciesPopup",{popupId:"currenciesPopupBlock",onSave:C,onShow:function(){if(B){var D="currenciesIndicesList";$(D).update("Загрузка&hellip;");new Ajax.Updater(D,"/currencies/indices_by_exchange",{parameters:{index_id:window.chartId,chart_type:window.chartType}});B=false}}});$("currenciesOpenPopup").observe("click",function(){A.make($("currenciesBlockPoint"))});new PeriodicalExecuter(reloadCurrenciesChart,300)}function initSharesBlock(B){function C(){var E=getRadioItemChecked("stockShareList");if(E){new Ajax.Request("/stock/shares_block?index="+E.value);$("sharesBlock").addClassName("loading")}}var A=true;var D=new Popup("sharesPopup",{align:"center",popupId:"sharesPopupBlock",onSave:C,onShow:function(){if(A){var E="stockLeadersList";$(E).update("Загрузка&hellip;");new Ajax.Updater(E,"/stock/indices_for_shares",{parameters:{index_id:B}});A=false}}});$("sharesOpenPopup").observe("click",function(){D.make($("sharesBlock"))})}function initQuotesBlock(A){function D(){var E=getRadioItemChecked("currenciesQuotesList");if(E){new Ajax.Request("/currencies/quotes_block?platform="+E.value);$("quotesBlock").addClassName("loading")}}var C=true;var B=new Popup("quotesPopup",{align:"center",popupId:"quotesPopupBlock",onSave:D,onShow:function(){if(C){var E="currenciesLeadersList";$(E).update("Загрузка&hellip;");new Ajax.Updater(E,"/currencies/platforms_for_quotes",{parameters:{platform_label:A}});C=false}}});$("quotesOpenPopup").observe("click",function(){B.make($("quotesBlock"))})}function toggleHide(C,E){var D=$(E);var B="form-multi-block-default";var A="form-multi-block-active";if(D.hasClassName(A)){D.className=B}else{D.className=A}}function blockClick(A){A.preventDefault();A.stopPropagation();A.target.blur&&A.target.blur()}function disableLink(B,A){if(A){B.observe("click",blockClick);B.addClassName("disabled")}else{B.stopObserving("click",blockClick);B.removeClassName("disabled")}}function ClosedBlock(B){this.block=B;this.header=B.select(".closed-block-title").first();if(this.header){var A=this.header.adjacent(".closed-block-data");if(A){this.init()}}}ClosedBlock.prototype={init:function(){var A=new Element("i");A.addClassName("arrow");A.update("<i></i>");this.header.insert({top:A});this.header.observe("click",this.toggle.bindAsEventListener(this));this.header.observe("mousedown",function(B){B.preventDefault()});this.header.observe("selectstart",function(B){B.preventDefault()})},toggle:function(){var B="collapsed-block";this.block.toggleClassName(B);var A={block:this.block};if(this.block.hasClassName(B)){document.fire("closed-block:collapse",A)}else{document.fire("closed-block:expand",A)}}};function initClosedBlocks(){var A=$$("#wide-content .closed-block");A.each(function(B){new ClosedBlock(B)})}function initCollapsedLists(){var A=$$(".collapsed-list .collapsed-list-item");A.each(function(B){B.select(".collapsed-list-title")[0].observe("click",function(D){var C=this.parentNode;if(C.hasClassName("collapsed-list-item-active")){C.removeClassName("collapsed-list-item-active")}else{C.addClassName("collapsed-list-item-active")}})})}Event.observe(document,"keydown",function(D){try{if(D.ctrlKey){var B=D.target.tagName.toLowerCase();if(B!="input"&&B!="textarea"){switch(D.keyCode){case Event.KEY_LEFT:window.location=$("prev_page").href;break;case Event.KEY_RIGHT:window.location=$("next_page").href;break;case Event.KEY_UP:var C=$("SearchField");if(C){window.scrollTo(0,0);C.focus();C.select()}break}}}}catch(A){}});function toggleOptionsLink(D,A){var C=$(A);if(!C){return}var B=C.select("input[type=text]").first();if(C.visible()){B.blur()}C.toggle();if(C.visible()){B.focus()}return false}function textForLoginCommon(A){$("loginNeedText").innerHTML=A;$$(".bubble-login-form #user_login").first().focus()}function textForLogin(){textForLoginCommon("")}function textForLoginIndicators(){textForLoginCommon("<p>Для настройки индикаторов необходимо войти в систему.</p>")}function makeMapPopup(B,A){var C=function(){$("contactsMapFrame").contentWindow.location.replace(A)};contactsMapPopup.make(B,{onShow:C})}function toFixed(C,B){var A=Math.pow(10,B);return Math.round(C*100)/A}function textRoubles(A){return A+" "+ROUBLES}function toggleTerm(A){$(A).toggleClassName("toggled-hide");return false}Effect.Transitions.elastic=function(A){if(A==0||A==1){return A}return Math.pow(2,6*--A)*Math.cos(2.5*A*Math.PI)};Effect.Transitions.bounce=function(D){D=1-D;var A=0,C=7.5625,B=2.75;if(D<1/B){A=C*D*D}else{if(D<2/B){A=C*(D-=1.5/B)*D+0.75}else{if(D<2.5/B){A=C*(D-=2.25/B)*D+0.9375}else{A=C*(D-=2.625/B)*D+0.984375}}}return 1-A};Effect.Transitions.expo=function(A){return Math.pow(2,10*(A-1))};var effects=["bounce","elastic","expo"];for(var i=0,l=effects.length;i<l;i++){(function(A){var B=Effect.Transitions[A];Effect.Transitions[A+"In"]=B;Effect.Transitions[A+"Out"]=function(C,D){return 1-B(1-C)};Effect.Transitions[A]=function(C,D){if(C<=0.5){return B(C*2)/2}return(2-B(2*(1-C)))/2}})(effects[i])}function LargeImage(B,D,C,A){this.thumb=B;this.thumb.addClassName("zoom-in");this.src=D;this.width=C;this.height=A;this.zIndex=this.zIndexStart-1;LargeImage.prototype.zIndexStart=this.zIndex;this.init()}LargeImage.prototype={zIndexStart:10000,init:function(){this.image=null;this.status="init";this.showed=false},load:function(){this.status="loading";var B=this;var A=new Element("img");A.style.zIndex=this.zIndex;A.className="large-image zoom-out";A.observe("load",function(){B.status="loaded";window.setTimeout(function(){B.action()},10)});A.src=this.src;this.thumb.insert({before:A});this.image=A},action:function(){var B=this.image,A=this.thumb;if(!this.showed){new Effect.Morph(B,{style:"width:"+this.width+"px; height:"+this.height+"px",transition:Effect.Transitions.elasticOut,beforeStart:function(){B.style.width=A.width+"px";B.style.height=A.height+"px";A.style.visibility="hidden";B.style.visibility="visible"},duration:0.8});this.showed=true}else{new Effect.Morph(B,{style:"width:"+A.width+"px; height:"+A.height+"px",transition:Effect.Transitions.bounceOut,afterFinish:function(){A.style.visibility="visible";B.style.visibility="hidden"},duration:0.6});this.showed=false}},hide:function(){if(this.showed){this.action()}},make:function(){switch(this.status){case"loaded":this.action();break;case"loading":break;default:this.load()}}};function LargeImageManager(A){this.container=$(A);this.images=[];this.init()}LargeImageManager.prototype={init:function(){var H=this,A=this.container.select(".image");for(var D=0,B=A.length;D<B;D++){var E=A[D];var C=E.select("img").first();var F=E.onclick();var G=new LargeImage(C,F.src,F.width,F.height);E.observe("click",function(I){return function(){H.show(I)}}(G));this.images[D]=G}},show:function(D){var A=this.images;for(var C=0,B=A.length;C<B;C++){if(A[C]!=D){A[C].hide()}}D.make()}};function TreeList(B){function F(G){$(G.target.parentNode).toggleClassName("closed")}var D=$(B).select("span.expand");for(var C=0,A=D.length;C<A;C++){var E=D[C];E.observe("click",F);$(E.parentNode).toggleClassName("closed")}}function initWidgetTabs(){$$(".tabs-widget").each(function(A){new WidgetTabs(A)})}function WidgetTabs(A){A=$(A);this.tabs=A.select("dt").map(function(C){return new WidgetTab(C,A)});var B=null;this.tabs.each(function(C){if(C.opened){B=C}});if(!B){this.tabs[0].open()}}WidgetTabs.prototype={};function WidgetTab(B,A){this.tab=B;this.container=A;this.block=B.next("dd");Element.insert(A,this.block);this.opened=B.hasClassName(this.CLASS_NAME_SELECTED);if(this.opened){this.block.addClassName(this.CLASS_NAME_SELECTED)}this.tab.observe("click",this.open.bindAsEventListener(this));A.observe("tabs-widget:open",this.openHandler.bindAsEventListener(this))}WidgetTab.prototype={CLASS_NAME_SELECTED:"tabs-widget-selected",open:function(){if(!this.opened){this.tab.addClassName(this.CLASS_NAME_SELECTED);this.block.addClassName(this.CLASS_NAME_SELECTED);this.opened=true;this.container.fire("tabs-widget:open",{tab:this.tab})}},close:function(){if(this.opened){this.tab.removeClassName(this.CLASS_NAME_SELECTED);this.block.removeClassName(this.CLASS_NAME_SELECTED);this.opened=false}},openHandler:function(A){if(A.memo.tab!=this.tab){this.close()}}};function makeTabs(G){var E=$(G);var F=E.select(".tab > .label");var A=E.select(".tab > .field");var B=new Element("div",{"class":"tabs-line"});var D=new Element("div",{"class":"tabs-content"});function C(I){var H=this;F.each(function(K,J){if(K==H){K.addClassName("current");A[J].removeClassName("g-hidden")}else{K.removeClassName("current");A[J].addClassName("g-hidden")}})}F.each(function(I,H){if(H==0){I.addClassName("current")}else{A[H].addClassName("g-hidden")}B.insert(I);I.observe("click",C)});E.insert({top:B});B.insert({bottom:'<div class="clear"></div>'});E.select(".tab").each(function(H){D.insert(H)});E.insert(D)};
