var d,fw,defined,isArray,isFunction,isString,isNumber,isNode,isHash;defined=function(a){return typeof(a)!=="undefined"};isArray=function(a){return Object.prototype.toString.call(a)==="[object Array]"};isFunction=function(a){return typeof(a)==="function"};isString=function(a){return typeof(a)==="string"};isNumber=function(a){return typeof(a)==="number"};isNode=function(a){return a&&a.nodeType};isHash=function(a){return Object.prototype.toString.call(a)==="[object Object]"};d=document;if(window.Node&&window.XMLSerializer){Node.prototype.__defineGetter__("outerHTML",function(){return new XMLSerializer().serializeToString(this)});Node.prototype.__defineSetter__("outerHTML",function(b){var a=d.createRange();a.selectNode(this);var c=a.createContextualFragment(b);this.parentNode.replaceChild(c,this);return b})}if(!Array.prototype.on){Array.prototype.on=function(a,b){this.each(function(e,c){if(isString(e)){e=e.get()}if(isNode(e)){fw.bind(e,a,b)}});return this}}if(!Array.prototype.style){Array.prototype.style=function(a){this.each(function(c,b){if(isString(c)){c=c.get()}if(isNode(c)){fw.style(c,a)}});return this}}if(!Array.prototype.anim){Array.prototype.anim=function(b,a){this.each(function(e,c){if(isString(e)){e=e.get()}if(isNode(e)){fw.anim.p(e,b,a)}});return this}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(b){var a=this.length;var c=Number(arguments[1])||0;c=(c<0)?Math.ceil(c):Math.floor(c);if(c<0){c+=a}for(;c<a;c++){if(c in this&&this[c]===b){return c}}return -1}}if(!Array.prototype.each){Array.prototype.each=function(b){var a=this.length;if(typeof b!="function"){throw new TypeError()}var e=arguments[1];for(var c=0;c<a;c++){if(c in this){b.call(e,this[c],c,this)}}}}Number.prototype.times=function(c,b){for(var a=0;a<this;a++){c.call(b,a)}return this};Number.prototype.abs=function(){return Math.abs(this)};Number.prototype.round=function(a){return a?parseFloat(this.toFixed(a)):Math.round(this)};Number.prototype.ceil=function(){return Math.ceil(this)};Number.prototype.floor=function(){return Math.floor(this)};Number.prototype.min=function(a){return this>a?a:this+0};Number.prototype.max=function(a){return this<a?a:this+0};if(!String.prototype.trim){String.prototype.trim=function(){var b=this.replace(/^\s+/,"");for(var a=b.length-1;a>=0;a--){if(/\S/.test(b.charAt(a))){b=b.substring(0,a+1);break}}return b}}String.prototype.stripTags=function(){return this.replace(/<\/?[^>]+>/ig,"").replace("&nbsp;"," ").trim()};String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()};String.prototype.startsWith=function(a,b){return(b!==true?this.indexOf(a):this.toLowerCase().indexOf(a.toLowerCase()))===0};String.prototype.endsWith=function(a,b){return this.length-(b!==true?this.lastIndexOf(a):this.toLowerCase().lastIndexOf(a.toLowerCase()))===a.length};String.prototype.toInt=function(b){var a=parseInt(this,b===undefined?10:b);return a+""=="NaN"?0:a};String.prototype.toFloat=function(a){return parseFloat(a===true?this:this.replace(",",".").replace(/(\d)-(\d)/,"$1.$2"))};String.prototype.el=function(c,b){var a;if(isString(c)){a=document.createTextNode(c)}else{if(b){a=document.createElementNS(b,this)}else{a=document.createElement(this)}if(isHash(c)){fw.attr(a,c)}}return a};String.prototype.get=function(h){var c,a=[],f,e=this.split(" "),b,g=isNode(h)?h:document;if(e[0].charAt(0)=="#"){a=g=g.getElementById(e[0].substring(1));e.shift()}if(e.length==1){a=[];e=e[0];if(e.charAt(0)=="."){if(g.querySelectorAll){a=g.querySelectorAll(e)}else{if(g.getElementsByClassName){a=g.getElementsByClassName(e.substring(1))}else{c=new RegExp("\\b"+e.substring(1)+"\\b");f=g.getElementsByTagName("*");b=f.length;while(b--){if(c.test(f[b].className)){a.push(f[b])}}}}}else{a=g.getElementsByTagName(e)}a=fw.toArray(a)}return a};fw={_initialized:false,loaded:null,isOpera:false,isSafari:false,isFF:false,isIE:false,isKhtml:false,isAIR:false,isMoz:false,ready:function(){if(d.addEventListener){d.addEventListener("DOMContentLoaded",function(){fw._init()},false)}else{if(d.attachEvent){if(d.documentElement.doScroll&&window==window.top){function a(){if(!d.body){return}try{d.documentElement.doScroll("left");fw._init()}catch(b){setTimeout(a,10)}}a()}d.attachEvent("onreadystatechange",function(){if(d.readyState==="complete"){fw._init()}})}}if(window.addEventListener){window.addEventListener("load",function(){fw._init()},false)}else{if(window.attachEvent){window.attachEvent("onload",function(){fw._init()})}else{window.onload=function(){fw._init()}}}},_init:function(){if(fw._initialized){return}fw._initialized=true;fw.browser();if(isFunction(fw.loaded)){fw.loaded()}var a=window.location.pathname.split("/");if(["admin","operation"].indexOf(a[1])==-1){fw.sortingTable.init();fw.jsonp({dir:"json",url:"counter.js",nocache:1})}},browser:function(){var b,e,a,c;b=navigator.userAgent;e=navigator.appVersion;a=parseFloat(e);if(b.indexOf("Opera")>=0){fw.isOpera=a}c=Math.max(e.indexOf("WebKit"),e.indexOf("Safari"),0);if(c){fw.isSafari=parseFloat(e.split("Version/")[1])||(parseFloat(e.substr(c+7))>419.3)?3:2}if(b.indexOf("AdobeAIR")>=0){fw.isAIR=1}if(e.indexOf("Konqueror")>=0||this.isSafari){fw.isKhtml=a}if(b.indexOf("Gecko")>=0&&!this.isKhtml){fw.isMoz=a}if(fw.isMoz){fw.isFF=parseFloat(b.split("Firefox/")[1])||parseFloat(b.split("Shiretoko/")[1])||undefined}if(d.all&&!this.isOpera){fw.isIE=parseFloat(e.split("MSIE ")[1])||undefined}},toArray:function(e){var b=[];if(isArray(e)){b=e}else{if(isString(e)){b=[e]}else{var c=e.length;while(c--){b[c]=e[c]}}}return b},eventStop:function(a){if(a.target){a.preventDefault();a.stopPropagation()}else{if(a.srcElement){a.cancelBubble=true;a.returnValue=false}}},caretPosition:function(c,b){var a;var e=-1;if(!defined(b)){if(document.selection){a=document.selection.createRange();a.moveStart("textedit",-1);e=a.text.length}else{e=c.selectionStart}}else{if(document.selection){c.focus();a=document.selection.createRange();a.moveStart("character",-c.value.length);a.moveStart("character",b);a.moveEnd("character",0);a.select()}else{if(c.selectionStart||c.selectionStart=="0"){c.selectionStart=b;c.selectionEnd=b;c.focus()}}}return e},setCookie:function(b,e,h,g,c,f){var a=function(j){var i=new Date();i.setTime(i.getTime()+j*24*60*60*1000);return i.toGMTString()};if(!defined(g)){g="/"}if(!defined(c)){c=window.location.hostname}d.cookie=encodeURI(b)+"="+encodeURIComponent(e)+((h)?"; expires="+a(h):"")+((g)?"; path="+g:"")+((c)?"; domain="+c:"")+((f)?"; secure":"")},getCookie:function(a){var b=d.cookie.match("(?:^|;)\\s*"+encodeURI(a)+"=([^;]*)");return b?decodeURIComponent(b[1]):null},toInt:function(a){return(a+"").toInt()},mouse:function(b){if(!b){b=window.event}var c={x:0,y:0};if(b.pageX){c.x=b.pageX;c.y=b.pageY}else{if(b.clientX){var a=(d.compatMode&&d.compatMode=="CSS1Compat")?d.documentElement:d.body;c.x=b.clientX+a.scrollLeft-a.clientLeft;c.y=b.clientY+a.scrollTop-a.clientTop}}return c},scrollTop:function(){return window.pageYOffset||(d.documentElement&&d.documentElement.scrollTop)||(d.body&&d.body.scrollTop)},scrollLeft:function(){return window.pageXOffset||(d.documentElement&&d.documentElement.scrollLeft)||(d.body&&d.body.scrollLeft)},docHeight:function(){return Math.max(d.compatMode!="CSS1Compat"?d.body.scrollHeight:d.documentElement.scrollHeight,fw.viewDocHeight())},docWidth:function(){return Math.max(d.compatMode!="CSS1Compat"?d.body.scrollWidth:d.documentElement.scrollWidth,fw.viewDocWidth())},viewDocHeight:function(){return((d.compatMode||fw.isIE)&&!fw.isOpera)?(d.compatMode=="CSS1Compat")?d.documentElement.clientHeight:d.body.clientHeight:(d.parentWindow||d.defaultView).innerHeight},viewDocWidth:function(){return((d.compatMode||fw.isIE)&&!fw.isOpera)?(d.compatMode=="CSS1Compat")?d.documentElement.clientWidth:d.body.clientWidth:(d.parentWindow||d.defaultView).innerWidth},attr:function(h,j,g){var b=null;var f=function(i){if(["startOffset"].indexOf(i)==-1){var k=i.search(/[A-Z]/);while(k>-1){i=i.substring(0,k)+"-"+i.substr(k,1).toLowerCase()+i.substring(k+1);k=i.search(/[A-Z]/)}}return i};var e=function(i,k){if(i=="xlink"){h.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",k)}else{if(i=="className"){h.setAttribute("class",k)}else{h.setAttribute(f(i),k)}}};if(g&&isString(g)){e(j,g)}else{if(isHash(j)){for(var c in j){e(c,j[c])}}else{var a=f(j);b=h.attributes.getNamedItem(a)?h.attributes.getNamedItem(a).value:null}}return b},attrRemove:function(g,c,f){if(!defined(f)){f=false}var b=g.attributes;if(b){for(var e=0;e<b.length;e++){if(b.item(e).name.toLowerCase()==c&&(f||b.item(e).value.trim()=="")){g.removeAttribute(c)}}}},childs:function(a,b){var c=b.toLowerCase().split(" ");var e=[];var f=a.firstChild;while(f){if(f.nodeType==1){if(c.indexOf(f.nodeName.toLowerCase())>-1){e.push(f)}}f=f.nextSibling}return e},style:function(j,h){var a=false;if(typeof h=="string"){if(h=="opacity"){a=100;if(j.style.opacity){a=j.style.opacity*100}if(j.style.MozOpacity){a=j.style.MozOpacity*100}if(j.style.KhtmlOpacity){a=j.style.KhtmlOpacity*100}if(j.style.filter){a=j.style.filter.match(/opacity=(\d*)/)[1]}}else{var g=h;if(h=="backgroundPositionLeft"||h=="backgroundPositionTop"){if(fw.isIE){h=(h=="backgroundPositionLeft"?"backgroundPositionX":"backgroundPositionY")}else{h="backgroundPosition"}}if(j&&j.currentStyle){a=j.currentStyle[h];if(a=="auto"&&j[h]){a=j[h]}}else{if(d.defaultView&&d.defaultView.getComputedStyle){if(h.match(/[A-Z]/)){h=h.replace(/([A-Z])/g,"-$1").toLowerCase()}a=d.defaultView.getComputedStyle(j,"").getPropertyValue(h)}else{if(j[h]){a=j[h]}}}if(g=="backgroundPositionLeft"||g=="backgroundPositionTop"&&a){if(!fw.isIE){a=(g=="backgroundPositionLeft"?a.split(" ")[0]:a.split(" ")[1])}}}}else{if(typeof h=="object"){for(var c in h){switch(c){case"opacity":if(defined(j.style.opacity)){j.style.opacity=(h[c]/100)}if(defined(j.style.MozOpacity)){j.style.MozOpacity=(h[c]/100)}if(defined(j.style.KhtmlOpacity)){j.style.KhtmlOpacity=(h[c]/100)}if(defined(j.style.filter)){j.style.filter="alpha(opacity="+h[c]+")"}break;case"borderRadius":if(defined(j.style.borderRadius)){j.style.borderRadius=h[c]}if(defined(j.style.MozBorderRadius)){j.style.MozBorderRadius=h[c]}if(defined(j.style.WebkitBorderRadius)){j.style.WebkitBorderRadius=h[c]}break;case"boxShadow":if(defined(j.style.boxShadow)){j.style.boxShadow=h[c]}if(defined(j.style.MozBoxShadow)){j.style.MozBoxShadow=h[c]}if(defined(j.style.WebkitBoxShadow)){j.style.WebkitBoxShadow=h[c]}break;case"cssFloat":if(defined(j.style.cssFloat)){j.style.cssFloat=h[c]}if(defined(j.style.styleFloat)){j.style.styleFloat=h[c]}break;case"backgroundPositionLeft":case"backgroundPositionTop":if(fw.isIE){j.style[(c=="backgroundPositionLeft"?"backgroundPositionX":"backgroundPositionY")]=h[c]}else{var b=fw.style(j,"backgroundPosition").split(" ");b[c=="backgroundPositionLeft"?0:1]=h[c];j.style.backgroundPosition=b.join(" ")}break;default:try{j.style[c]=h[c]}catch(f){fw.error({obj:j,param:f,text:"установка стиля: "+c+" = "+h[c]})}}}}}return a},now:function(){return(new Date()).getTime()},anim:{_d:function(e){if(!e){return}var b={};var a=0;var c=e.animParam.properties;e.animParam.counter--;for(var f in c){if(e.animParam.counter){a=c[f].step;c[f].cur+=a;b[f]=parseInt(c[f].cur,10)+c[f].unit}else{b[f]=c[f].end+c[f].unit}}fw.style(e,b);if(e.animParam.counter){e.anim=setTimeout(function(){fw.anim._d(e)},e.animParam.rate)}else{if(defined(e.animParam.onEnd)){e.anim=false;e.animParam.onEnd()}}},p:function(c,e,b){var a={};if(defined(b)){a=b}a.properties=e;a.duration=defined(a.duration)?a.duration:1000;a.rate=defined(a.rate)?a.rate:40;a.loop=Math.ceil(a.duration/a.rate);a.counter=a.loop;for(var f in a.properties){if(typeof a.properties[f]!="object"){a.properties[f]={start:parseInt(fw.style(c,f),10),end:a.properties[f],unit:"px"};if(f=="opacity"){a.properties[f].unit=""}}else{if(!a.properties[f].unit){a.properties[f].unit="px";if(f=="opacity"){a.properties[f].unit=""}}}a.properties[f].step=(parseInt(a.properties[f].end,10)-parseInt(a.properties[f].start,10))/a.loop;a.properties[f].cur=parseInt(a.properties[f].start,10);if(isNaN(a.properties[f].step)){fw.error({obj:a.node,param:a.properties[f],text:"анимация NaN для свойства: "+f})}}c.animParam=a;if(c.anim){fw.anim.s(c)}fw.anim._d(c)},s:function(a){clearTimeout(a.anim);a.anim=false}},selection:{mem:false,save:function(){fw.selection.mem=false;if(window.getSelection){if(window.getSelection().rangeCount){fw.selection.mem=window.getSelection().getRangeAt(0)}}else{if(d.selection){if(d.selection.type=="Text"||d.selection.type=="None"){fw.selection.mem={range:null,mark:null};fw.selection.mem.range=d.selection.createRange();fw.selection.mem.mark=fw.selection.mem.range.getBookmark()}}}},load:function(){if(window.getSelection){if(fw.selection.mem){window.getSelection().removeAllRanges();window.getSelection().addRange(fw.selection.mem)}}else{if(d.selection){if(fw.selection.mem){fw.selection.mem.range.moveToBookmark(fw.selection.mem.mark);fw.selection.mem.range.select()}}}}},disableSelect:function(a){if(fw.isFF){fw.style(a,{MozUserSelect:"-moz-none"});fw.bind(a,"contextmenu",function(c,b){fw.eventStop(b)})}else{if(fw.isIE){a.unselectable="on"}}fw.bind(a,"mousedown",function(c,b){fw.eventStop(b)})},bind:function(f,b,c){var a;var e=function(){if(!isArray(f.fwListeners)){f.fwListeners=[]}f.fwListeners.push({e:b,h:a,l:c})};if(window.addEventListener){a=function(g){c(this,g)};f.addEventListener(b,a,false);e()}else{if(window.attachEvent){a=function(g){c(f,g)};f.attachEvent("on"+b,a);e()}}},unbind:function(f,c,e){var b=function(g){if(window.addEventListener){f.removeEventListener(c,g,false)}else{if(window.attachEvent){f.detachEvent("on"+c,g)}}};var a=[];f.fwListeners.each(function(g,h){if(g.e===c&&(!defined(e)||(defined(e)&&e===g.l))){b(g.h)}else{a.push(g)}});f.fwListeners=a},listeners:function(c,b){var a=[];c.fwListeners.each(function(e,f){if(!defined(b)||e.e===b){a.push(e.l)}});return a},htmlToStr:function(a){return a.replace(/<(\/?)(\w\w*)(\s?[^>]*)>/gi,'<span style="color:#0A8DAC">&lt;$1$2</span><span style="color:#B73D00">$3</span><span style="color:#0A8DAC">&gt;</span>').replace(/\r/gi,"").replace(/\n/gi,"<br>")},coords:function(c){var a=c.getBoundingClientRect(),b=c.ownerDocument.documentElement;return{x:a.left+fw.scrollLeft()-b.clientLeft,y:a.top+fw.scrollTop()-b.clientTop,w:c.offsetWidth,h:c.offsetHeight}},classAdd:function(b,e){var a=new RegExp("(^|\\s)"+e+"(\\s|$)","g");if(!a.test(b.className)){b.className=(b.className+" "+e).replace(/\s+/g," ").replace(/(^ | $)/g,"")}},classRemove:function(b,e){var a=new RegExp("(^|\\s)"+e+"(\\s|$)","g");b.className=b.className.replace(a,"$1").replace(/\s+/g," ").replace(/(^ | $)/g,"")},storage:function(name,value){var out=null;if("localStorage" in window&&window.localStorage){if(defined(name)){var storage=window.localStorage;if(defined(value)){storage[name]=value}else{if(name.startsWith("remove ")){storage.removeItem(name.split(" ")[1])}else{out=storage[name]}}}}else{var save=function(){var storageArray=[];for(var i in storage){storageArray.push(i+': "'+storage[i]+'"')}window.name="{"+storageArray.join(", ")+"}"};if(!window.name.startsWith("{")){window.name="{}"}eval("var storage="+window.name);if(defined(value)){storage[name]=encodeURIComponent(value);save()}else{if(name.startsWith("remove ")){delete (storage[name.split(" ")[1]]);save()}else{if(defined(storage[name])){out=decodeURIComponent(storage[name])}}}}return out},cl:function(b){try{console.log(b)}catch(a){if(!defined(this.consoleDiv)){this.consoleDiv="div".el();d.body.appendChild(this.consoleDiv)}this.consoleDiv.innerHTML+="<div>"+b+"</div>"}},dump:function(f,a){var e=[];e.push("<pre>");a=defined(a)?a:"";for(var b in f){try{e.push(a+"."+b+"="+f[b])}catch(c){e.push(a+"."+b+"= ERROR: "+c)}}e.push("</pre>");this.cl(e.join("\n"))},error:function(a){if(window.location.protocol=="file:"){fw.cl("===== "+a.text+" =====");fw.cl("--параметры--");fw.dump(a.param);fw.cl("--объект--");fw.dump(a.obj)}},css:{rules:function(a){return a.cssRules?a.cssRules:a.rules},add:function(a){if(!d.styleSheets.length){"head".get()[0].appendChild("style".el())}var c=d.styleSheets[0];var b=fw.css.rules(c).length;if(c.insertRule){c.insertRule(a,b++)}else{c.cssText+=a}}},svg:function(a){var b={};b.ns="http://www.w3.org/2000/svg";b.svg="svg".el({version:"1.1"},b.ns);if(isString(a)&&a.charAt(0)=="#"){var c=a.get();if(c){b.svg.id=c.id;c.parentNode.replaceChild(b.svg,c)}}if(isHash(a)){fw.attr(b.svg,a)}var e=function(g){var f=function(k){var i,h=false,j=false;if(!defined(k)){k={}}if(defined(k.text)){h=k.text+"";delete (k.text)}if(k.parent){j=k.parent;delete (k.parent)}i=g.el(k,b.ns);if(h){i.appendChild("".el(h))}if(j){j.appendChild(i)}else{b.svg.appendChild(i)}return i};return f};b.circle=e("circle");b.rect=e("rect");b.ellipse=e("ellipse");b.line=e("line");b.polygon=e("polygon");b.polyline=e("polyline");b.path=e("path");b.text=e("text");b.tspan=e("tspan");b.tref=e("tref");b.textPath=e("textPath");b.a=e("a");b.image=e("image");b.g=e("g");b.defs=e("defs");b.use=e("use");return b},dialog:{alert:function(a){if("#fwDialog".get()){return}if(!defined(a)){a={}}if(!defined(a.t)){a.t="Диалоговое окно"}if(!defined(a.w)){a.w=200}if(!defined(a.cancel)){a.cancel=function(){}}a.cancelText="ок";fw.dialog.window(a)},confirm:function(a){if("#fwDialog".get()){return}if(!defined(a)){a={}}if(!defined(a.t)){a.t="Диалоговое окно"}if(!defined(a.w)){a.w=200}if(!defined(a.ok)){a.ok=function(){}}if(!defined(a.cancel)){a.cancel=function(){}}a.okText="да";a.cancelText="нет";fw.dialog.window(a)},promt:function(a){if("#fwDialog".get()){return}if(!defined(a)){a={}}if(!defined(a.t)){a.t="Диалоговое окно"}if(!defined(a.v)){a.v=""}if(!defined(a.w)){a.w=300}if(!defined(a.ok)){a.ok=function(b){}}if(!defined(a.cancel)){a.cancel=function(){}}a.okText="ок";a.cancelText="отмена";fw.dialog.window(a)},form:function(a){if("#fwDialog".get()){return}if(!defined(a)){return}if(!defined(a.t)){a.t="Диалоговое окно"}if(!defined(a.form)){a.form={v1:"",v2:""}}if(!defined(a.w)){a.w=290}if(!defined(a.ok)){a.ok=function(b){}}if(!defined(a.cancel)){a.cancel=function(){}}a.okText="ок";a.cancelText="отмена";fw.dialog.window(a)},bOK:function(c){var f;var b="input".get("#fwDialog".get());if(defined(c.v)){f=b[0].value}else{if(defined(c.form)){f={};var a=0;for(var e in c.form){f[e]=b[a].value;a++}}}"#fwDialog".get().parentNode.removeChild("#fwDialog".get());fw.selection.load();if(f){c.ok(f)}else{c.ok()}},window:function(c){fw.selection.save();this.div="div".el({id:"fwDialog"});d.body.appendChild(this.div);var g=150;fw.style(this.div,{position:"absolute",zIndex:2000,padding:"15px",backgroundColor:"#eeeeee",color:"#333333",borderRadius:"20px 20px 20px 20px",boxShadow:"1px -1px 10px #555555",top:((fw.viewDocHeight()-g)/3+fw.scrollTop())+"px",left:(fw.viewDocWidth()-c.w)/2+"px",width:c.w+"px"});var e=[];e.push('<div style="text-align: center;">'+c.t+"</div>");if(defined(c.v)){e.push('<div style="padding: 10px 0px;">');e.push('<input type="text" value="'+c.v+'" id="fwDialogVar">');e.push("</div>")}else{if(defined(c.form)){e.push('<table style="margin: 10px; width: 100%;">');for(var f in c.form){var a=c.form[f].split("=");if(a.length==1){a.push("")}e.push("<tr>");e.push("<td>"+a[0]+":</td>");e.push('<td><input type="'+(f=="pass"?"password":"text")+'"  value="'+a[1]+'" style="width: 200px;"></td>');e.push("</tr>")}e.push("</table>")}else{e.push('<div style="padding-top: 15px;"></div>')}}e.push('<div style="text-align: '+(defined(c.ok)?"right":"center")+';">');if(defined(c.ok)){e.push('<input type="submit" value="'+c.okText+'" id="fwDialogOK">');e.push('<span style="padding-left: 5px;"></span>')}e.push('<input type="button" value="'+c.cancelText+'" id="fwDialogCANCEL">');e.push("</div>");"#fwDialog".get().innerHTML=e.join("");"#fwDialogCANCEL".get().focus();fw.style("#fwDialogCANCEL".get(),{cursor:"pointer"});fw.bind("#fwDialogCANCEL".get(),"click",function(i,h){"#fwDialog".get().parentNode.removeChild("#fwDialog".get());fw.selection.load();c.cancel()});var b="input".get("#fwDialog".get());if(defined(c.v)){b[0].focus();fw.style(b[0],{width:"99%"});fw.bind(b[0],"keydown",function(i,h){if(h.keyCode==13){fw.dialog.bOK(c)}})}else{if(defined(c.form)){b[0].focus();fw.bind(b[b.length-1],"keydown",function(i,h){if(h.keyCode==13){fw.dialog.bOK(c)}});b.each(function(j,h){if(h<b.length-1){fw.bind(j,"keydown",function(k,i){if(i.keyCode==13){b[h+1].focus()}})}})}}if(defined(c.ok)){fw.style("#fwDialogOK".get(),{cursor:"pointer"});fw.bind("#fwDialogOK".get(),"click",function(i,h){fw.dialog.bOK(c)})}}},sendFile:function(c){if(!defined(fw.sendFile.iframe)){var e="div".el();fw.style(e,{display:"none"});d.body.appendChild(e);fw.sendFile.iframe="iframe".el({id:"fwIFrame",name:"fwIFrame"});e.appendChild(fw.sendFile.iframe);fw.bind(fw.sendFile.iframe,"load",function(j,i){var h=j.contentDocument||j.contentWindow;if(h.document){h=h.document}var g="";if(h.body.innerHTML){g=h.body.innerHTML.trim()}c.callback.responseText=g;setTimeout(c.callback,1);var f=isString(c.submit)?c.submit.get():c.submit;f.disabled=false;f.value=f.valuesave})}var b=isString(c.submit)?c.submit.get():c.submit;if(!b.disabled){b.disabled=true;b.valuesave=b.value;b.value="ждите...";var a=isString(c.form)?c.form.get():c.form;if(a){a.target="fwIFrame";a.submit()}}},xhr:function(j){if(typeof(j)!="object"){return}var h;try{h=new ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{h=new ActiveXObject("Microsoft.XMLHTTP")}catch(f){h=false}}if(!h&&typeof XMLHttpRequest!="undefined"){h=new XMLHttpRequest()}if(h){var c=[];var b=j.method.toLowerCase()=="post";var g=j.method.toLowerCase()=="get";for(var a in j){if(a=="url"||a=="callback"||a=="method"){continue}if(a=="nocache"){if(b){j.url=j.url+"?"+fw.now()}else{c.push(fw.now())}}else{if(isArray(j[a])){j[a].each(function(i,e){c.push(a+"="+encodeURIComponent(i))})}else{c.push(a+"="+encodeURIComponent(j[a]))}}}if(g){j.url=j.url+"?"+c.join("&")}h.open(j.method,"/xhr/"+j.url,true);h.onreadystatechange=function(){if(h.readyState==4){if(h.status==200){j.callback.responseText=h.responseText.trim();setTimeout(j.callback,1)}}};if(b){h.setRequestHeader("Content-Type","application/x-www-form-urlencoded");h.send(c.join("&"))}else{h.send(null)}}},jsonp:function(g,e){if(typeof(g)!="object"){return}var c={type:"text/javascript"};if(defined(e)){if(e){c.async=true}else{c.defer=true}}var a="script".el(c);var f=[];for(var b in g){if(b=="url"||b=="dir"){continue}if(b=="nocache"){f.push(fw.now())}else{f.push(b+"="+encodeURIComponent(g[b]))}}if(!defined(g.dir)){g.dir="xhr"}if(g.dir){g.dir="/"+g.dir+"/"}a.src=g.dir+g.url+(f.length?"?":"")+f.join("&");"head".get()[0].appendChild(a)},mailform:{submit:false,init:function(){var a="#mailform".get();if(!defined(a)){return}a.innerHTML=a.firstChild.nodeValue;fw.mailform.submit="input".el({type:"button",value:"отправить"});"#mailformSubmit".get().appendChild(fw.mailform.submit);fw.mailform.submit.disabled=false;fw.bind(this.submit,"click",function(f,c){if(!f.disabled){f.value="ждите...";f.disabled=true;var b=[];"input".get("#mailform".get()).each(function(g,e){if(g.type=="text"||g.type=="hidden"){b.push(g.value)}});"textarea".get("#mailform".get()).each(function(g,e){b.push(g.value)});fw.xhr({method:"post",nocache:1,url:"mailform",callback:fw.mailform.check,a:b})}})},check:function(){fw.mailform.submit.disabled=false;fw.mailform.submit.value="отправить";fw.dialog.alert({t:fw.mailform.check.responseText,w:250})}},counter:function(b){var e,a,c;e="#fwCounter".get();if(!e||!b){return}a=[];a.push("<u>сегодня</u>");c=b.hitsAdd?" <sup>+"+b.hitsAdd+"</sup>":"";a.push("Просмотров: "+b.hits+c);c=b.userAdd?" <sup>+"+b.userAdd+"</sup>":"";a.push("Посетителей: "+b.user+c);if(b.hitsPrev){a.push("");a.push("<u>вчера</u>");a.push("Просмотров: "+b.hitsPrev);a.push("Посетителей: "+b.userPrev)}e.innerHTML=a.join("<br>");fw.style(e,{marginLeft:"auto",marginRight:"auto",padding:"0.8em 0.5em"})},login:{init:function(){if("#auth".get()){if(fw.getCookie("sid")){fw.login.user(fw.getCookie("sid"))}else{fw.login.anonim()}}},reset:function(){"#auth".get().innerHTML="";fw.storage("remove menu");fw.setCookie("sid","",-1000);fw.login.init()},menu:function(f){if(!defined(f)){fw.login.reset();return}"#auth".get().innerHTML=f;fw.storage("menu",f);var a="a".get("#auth".get());fw.bind(a[a.length-1],"click",function(i,h){fw.eventStop(h);fw.dialog.alert({t:"Досвидания!",cancel:function(){fw.login.reset()}})});if(a.length>0){var e="#content".get();if(e.firstChild.nodeType==8){var c=false;if(a[0].firstChild.nodeName.toLowerCase()=="b"){if("#header_user".get()){var b="a".get("#header_user".get());if(b.length==1){if(b[0].innerHTML==a[0].firstChild.innerHTML){c=true}}}}else{c=true}if(c){var g="div".el({id:"edit"});g.innerHTML='<a href="/operation/node/'+e.firstChild.nodeValue.trim()+'">редактировать</a>';e.insertBefore(g,e.firstChild)}}}},check:function(){if(fw.login.check.responseText.length==40){fw.login.user(fw.login.check.responseText)}else{fw.dialog.alert({t:"Вы ввели ошибочные данные.",w:300})}},user:function(a){if(fw.storage("menu")){fw.login.menu(fw.storage("menu"))}else{fw.jsonp({url:"user/"+a})}},registration:function(){fw.dialog.alert({t:fw.login.registration.responseText,w:250})},recovery:function(){fw.dialog.alert({t:fw.login.recovery.responseText})},anonim:function(){var c="#auth".get();var b,a;b="a".el({href:"#"});b.innerHTML="авторизация";fw.bind(b,"click",function(g,f){fw.eventStop(f);fw.dialog.form({t:"Авторизация",form:{name:"Имя",pass:"Пароль"},ok:function(e){fw.xhr({method:"post",nocache:1,url:"login",callback:fw.login.check,a:[e.name,e.pass]})}})});a="span".el();c.appendChild(a);a.appendChild(b);c.appendChild("".el(" • "));b="a".el({href:"#"});b.innerHTML="регистрация";fw.bind(b,"click",function(g,f){fw.eventStop(f);fw.dialog.form({t:"Регистрация",form:{name:"Имя",word:"Пароль",email:"E-mail"},ok:function(e){fw.xhr({method:"post",nocache:1,url:"registration",callback:fw.login.registration,a:[e.name,e.word,e.email]})}})});a="span".el();c.appendChild(a);a.appendChild(b);c.appendChild("".el(" • "));b="a".el({href:"#"});b.innerHTML="восстановление пароля";fw.bind(b,"click",function(g,f){fw.eventStop(f);fw.dialog.promt({t:"Введите логин или email",ok:function(e){fw.xhr({method:"post",nocache:1,url:"recovery",callback:fw.login.recovery,a:e})}})});a="span".el();c.appendChild(a);a.appendChild(b)}},comments:{init:function(){if(!fw.getCookie("sid")){return}var a="#comments".get();if(!a){return}this.form="form".el({method:"post",enctype:"multipart/form-data",action:"/xhr/comment",id:"commentForm"});a.parentNode.appendChild(this.form);this.html()},html:function(){var a="#commentForm".get();a.innerHTML='<textarea name="comment" id="comment" style="width: 98%; height: 100px; overflow: hidden;"></textarea><br>';a.innerHTML+='<div style="float: right; margin-right: 10px;"><input type="button" id="commentSubmit" value="добавить комментарий"></div>';a.innerHTML+='<input type="file" name="fwFileLoad"><br>';a.innerHTML+='<input type="hidden" name="path" value="'+window.location.pathname+'">';fw.bind("#commentSubmit".get(),"click",function(c,b){fw.sendFile({callback:fw.comments.response,form:"#commentForm",submit:"#commentSubmit"})});fw.bind("#comment".get(),"keyup",function(c,b){if(c.offsetHeight<c.scrollHeight){fw.style(c,{height:(c.scrollHeight+5)+"px"})}else{if(c.offsetHeight>c.scrollHeight+20){if(c.scrollHeight+20>100){fw.style(c,{height:(c.scrollHeight+20)+"px"})}else{if(fw.style(c,"height").toInt()>100){fw.style(c,{height:"100px"})}}}}})},response:function(){fw.comments.html();"#comments".get().innerHTML=fw.comments.response.responseText;fw.gallery({border:10,node:"#comments"})}},gallery:function(f){if(!defined(f.border)){f.border=10}if(!defined(f.node)){f.node="#content"}var g,p;var h=f.border;var m=new Image();var i=function(){fw.anim.s(p);p.parentNode.removeChild(p);p=null};var a=function(v,u){var s;fw.eventStop(u);var t=fw.coords(v);var q=fw.attr(v,"src");var r=q.replace("/150/","/").replace("/250/","/");if(p){i()}p="div".el({id:"imgFull"});[p].style({position:"absolute",padding:h+"px",opacity:0,width:t.w+"px",height:t.h+"px",left:(t.x-h)+"px",top:(t.y-h)+"px"});s="a".el({href:r,target:"_blank"});g="img".el({src:q,width:t.w,height:t.h});[g].on("mouseout",i);d.body.appendChild(p);p.appendChild(s);s.appendChild(g);n();m.src=r};var n=function(){[p].anim({opacity:100},{duration:1000,onEnd:function(){[p].anim({opacity:0},{duration:1000,onEnd:n})}})};var e=function(){if(!p){return}fw.anim.s(p);fw.anim.p(p,{opacity:100},{duration:400,onEnd:function(){var t=fw.viewDocWidth();var r=fw.viewDocHeight();var q=m.width;var C=m.height;var s=fw.style(g,"width").toInt(10);var v=fw.style(g,"height").toInt(10);var x=(q+h*2+10)/t;var w=(C+h*2+10)/r;var B=1;if(x>1||w>1){B=x>w?x:w}q=parseInt(q/B,10);C=parseInt(C/B,10);if(q<s){q=s;C=v}var A=fw.scrollLeft();var z=fw.scrollTop();var u=fw.style(p,"left").toInt(10)-(q-s)/2;var y=fw.style(p,"top").toInt(10)-(C-v)/2;u=u>t+A-(q+h*2+15)?t+A-(q+h*2+15):u;u=u<A?A:u;y=y>r+z-(C+h*2)?r+z-(C+h*2):y;y=y<z?z:y;[p].anim({opacity:0},{duration:400,onEnd:function(){g.src=m.src;[p].style({width:q+"px",height:C+"px",left:u+"px",top:y+"px"});[g].style({width:q+"px",height:C+"px"});[p].anim({opacity:100},{duration:800})}})}})};var k=function(){fw.style(j,{display:"none"})};var l=function(s,r){var q=fw.coords(s);if(q.h>100){[s].style({height:"100px",overflow:"hidden"}).on("mouseover",function(v,u){fw.eventStop(u);var t=fw.coords(v);k();j.innerHTML=v.innerHTML;[j].style({left:(t.x-c)+"px",top:(t.y-b)+"px",width:t.w+"px"});fw.style(j,{display:"block"})})}};if(f.node.get()){(f.node+" .imgFull").get().on("mouseover",a)}if(f.node=="#content"){[m].on("load",e);var o=null,c=0,b=0;var j="div".el({id:"catalogFullText"});[j].style({position:"absolute",opacity:90}).on("mouseout",function(){o=setTimeout(k,200)}).on("mouseover",function(){if(o){clearTimeout(o)}});d.body.appendChild(j);c=fw.style(j,"paddingLeft").toInt(10)+fw.style(j,"marginLeft").toInt(10)+fw.style(j,"borderLeftWidth").toInt(10);b=fw.style(j,"paddingTop").toInt(10)+fw.style(j,"marginTop").toInt(10)+fw.style(j,"borderTopWidth").toInt(10);fw.style(j,{display:"none"});if("#catalog".get()){"#catalog .content".get().each(l)}}},lazyLoadImg:function(c){var b=function(f,e){if(fw.attr(f,"href").startsWith("/file/")&&f.firstChild&&f.firstChild.nodeType==3){fw.lazyLoadList.push(f)}};var a=function(){var g=[];var f=fw.viewDocHeight();var e=fw.scrollTop();fw.lazyLoadList.each(function(m,j){var l=fw.coords(m);if(l.w&&l.h&&l.y-e<f&&l.y-e>0){var k=fw.attr(m,"href");var h="img".el({src:k,alt:m.innerHTML});m.innerHTML="";m.appendChild(h);fw.attr(m,{href:k.replace("/150/","/").replace("/250/","/")})}else{g.push(m)}});fw.lazyLoadList=g};if(!defined(fw.lazyLoadList)||defined(c)){fw.lazyLoadList=[];"#content a".get().each(b);fw.bind(window,"scroll",a)}a()},sortingTable:{prevsort:null,orderasc:true,arrow:null,init:function(){var b="table".get();for(var a=0;a<b.length;a++){if(b[a].className.toLowerCase().indexOf("sorting")>-1){this.prepare(b[a]);fw.sortingTable.sort(b[a].getElementsByTagName("th")[0]);for(var c=1;c<b[a].rows.length;c++){fw.bind(b[a].rows[c],"mouseover",function(g,f){fw.classAdd(g,"sortingOver")});fw.bind(b[a].rows[c],"mouseout",function(g,f){fw.classRemove(g,"sortingOver")})}}}},prepare:function(c){c.rows.item(0).className="thead";var b=c.rows.item(0).getElementsByTagName("th");for(var a=0;a<b.length;a++){b[a].colNumber=a;fw.bind(b[a],"click",function(g,f){fw.sortingTable.sort(g)});fw.style(b[a],{cursor:"pointer"})}},sort_numbers:function(e,c){return e-c},sort_insensitive:function(f,e){var c=f.toLowerCase();var g=e.toLowerCase();if(c<g){return -1}if(c>g){return 1}return 0},_sort:function(e,c){e=e[0];c=c[0];var g=(e+"").replace(/,/,".");var f=(c+"").replace(/,/,".");if(Number(g)&&Number(f)){return fw.sortingTable.sort_numbers(g,f)}else{return fw.sortingTable.sort_insensitive(e,c)}},sort:function(h){if(fw.sortingTable.prevsort==h){fw.sortingTable.orderasc=!fw.sortingTable.orderasc}else{fw.sortingTable.orderasc=true;if(fw.sortingTable.prevsort){if(fw.sortingTable.prevsort.firstChild){fw.sortingTable.prevsort.removeChild(fw.sortingTable.prevsort.firstChild)}}fw.sortingTable.arrow=h.insertBefore(document.createElement("span"),h.firstChild);fw.style(fw.sortingTable.arrow,{padding:"0px 5px"})}fw.sortingTable.arrow.innerHTML=fw.sortingTable.orderasc?"&#9660;":"&#9650;";fw.sortingTable.prevsort=h;var b=new Array();var j=false,g=false;var f=h;while(f.nodeName.toLowerCase()!="table"){f=f.parentNode}for(var e=1;e<f.rows.length;e++){g=f.rows[e].getElementsByTagName("td").item(h.colNumber);j=g.innerText?g.innerText:g.textContent;b.push([j,f.rows[e]])}b.sort(this._sort);if(!fw.sortingTable.orderasc){b.reverse()}var c="tbody".get(f)[0];for(e=0;e<b.length;e++){c.appendChild(b[e][1])}}},stripyTable:{init:function(){var e="table".get();for(var c=0;c<e.length;c++){if(e[c].className.toLowerCase().indexOf("stripy")>-1){var f=e[c].getElementsByTagName("tr");for(var b=0;b<f.length;b++){fw.classAdd(f[b],(b%2)==0?"oddRow":"evenRow")}}}}},slideshow:{loadImg:new Image,loadImgTimer:0,path:"",ext:"",count:0,first:0,delay:0,duration:0,showList:false,isWork:false,img:null,imgBack:null,randomList:[],init:function(a){this.img=("#"+a.id).get();if(!this.img){return}if(this.img.tagName.toLowerCase()!="img"){return}var b;if(a.count){path=this.img.src.match("^(.+/)([0-9]{4})(.[jpgifn]{3})$");if(!path){return}this.imgBack="img".el();fw.style(this.imgBack,{position:"absolute"});this.imgBack.src=this.img.src;this.imgBack.width=this.img.width;this.imgBack.height=this.img.height;var c="div".el();fw.style(c,{position:"relative"});this.img.parentNode.replaceChild(c,this.img);c.appendChild(this.imgBack);this.img="img".el();fw.style(this.img,{position:"relative"});this.img.src=this.imgBack.src;this.img.width=this.imgBack.width;this.img.height=this.imgBack.height;c.appendChild(this.img);this.first=parseInt(path[2],10);this.count=parseInt(a.count,10);this.ext=path[3];this.path=path[1];this.initRandomList(path[2])}else{return}this.duration=parseInt(a.duration,10);this.delay=parseInt(a.delay,10);this.isWork=true;setTimeout("fw.slideshow.nextSlide()",1);fw.bind(this.loadImg,"load",function(h,g){var f=fw.slideshow;clearTimeout(f.loadImgTimer);if(f.showList){fw.anim.p(f.img,{opacity:{start:100,end:0}},{duration:f.duration,rate:20,onEnd:function(){if(f.isWork){f.img.src=f.loadImg.src;f.img.height=f.loadImg.height;f.img.width=f.loadImg.width;fw.anim.p(f.img,{opacity:{start:0,end:100}},{duration:f.duration,rate:20,onEnd:function(){if(f.isWork){setTimeout("fw.slideshow.nextSlide()",f.delay)}}})}}})}else{f.imgBack.src=f.img.src;fw.anim.p(f.img,{opacity:{start:100,end:0}},{duration:500,rate:100,onEnd:function(){f.img.src=f.loadImg.src;fw.anim.p(f.img,{opacity:{start:0,end:100}},{duration:f.duration,rate:20,onEnd:function(){if(f.isWork){setTimeout("fw.slideshow.nextSlide()",f.delay)}}})}})}})},initRandomList:function(b){b=parseInt(b,10);for(var a=this.first;a<this.first+this.count;a++){if(a!=b){this.randomList.push(a)}}},nextSlide:function(){if(!this.isWork){return}if(this.showList){if(this.count+1<this.showList.length){this.count++}else{this.count=0}this.loadImg.src=this.path+this.showList[this.count]}else{var b=Math.ceil(Math.random()*this.randomList.length)-1;var a=this.randomList[b];this.loadImg.src=this.path+("0000"+a).substr(-4)+this.ext;this.randomList=this.randomList.slice(0,b).concat(this.randomList.slice(b+1));if(this.randomList.length==0){this.initRandomList(a)}}this.loadImgTimer=setTimeout("fw.slideshow.nextSlide()",this.delay*3)},stop:function(){clearTimeout(this.loadImgTimer);this.isWork=false},reloadFade:function(a){this.isWork=true;this.count=0;this.showList=a.split(" ");setTimeout("fw.slideshow.nextSlide()",this.delay)}},tabControl:{open:function(e){var a=e.split("-"),b=a[2].toInt(),c=("#"+a[0]).get().openTabIndex+"";a[0]="#"+a[0];a[2]=c;a[1]="list";fw.classRemove(a.join("-").get(),"open");a[1]="tabs";fw.style(a.join("-").get(),{display:"none"});a[2]=b;a[1]="list";fw.classAdd(a.join("-").get(),"open");a[1]="tabs";fw.style(a.join("-").get(),{display:""});a[0].get().openTabIndex=b;fw.lazyLoadImg()},init:function(j){if(!defined(j.id)){return}if(!defined(j.index)){j.index=0}if(!defined(j.radius)){j.radius=0}var e=j.id.get();if(!e){return}fw.style(e,{overflow:"auto",height:"auto"});e.openTabIndex=j.index;var c=j.id.substring(1),g=fw.toArray(e.childNodes),f=null,h=null,i="ul".el({id:c+"-list"}),b="ul".el({id:c+"-tabs"});e.insertBefore(b,e.firstChild);e.insertBefore(i,e.firstChild);fw.style(e,{padding:"0px"});fw.style(b,{padding:"0px"});fw.style(i,{padding:"0px"});fw.style(b,{clear:"both"});if(j.radius){fw.style(b,{borderRadius:"0px 0px "+j.radius+"px "+j.radius+"px"})}var a=0;g.each(function(l,k){if(l.nodeType==1){f="li".el({id:c+"-list-"+a});i.appendChild(f);fw.style(f,{display:"block",cssFloat:"left"});if(j.index==a){fw.classAdd(f,"open")}h="div".el();h.innerHTML=l.title;f.appendChild(h);fw.style(h,{cursor:"pointer",whiteSpace:"nowrap"});if(j.radius){fw.style(h,{borderRadius:j.radius+"px "+j.radius+"px 0px 0px"})}fw.bind(h,"mouseover",function(n,m){fw.classAdd(n.parentNode,"over")});fw.bind(h,"mouseout",function(n,m){fw.classRemove(n.parentNode,"over")});fw.bind(h,"click",function(n,m){fw.tabControl.open(n.parentNode.id)});l.id=c+"-tabs-"+a;fw.attrRemove(l,"title",true);if(j.index!=a){fw.style(l,{display:"none"})}b.appendChild(l);a++}})}},_end:null};fw.ready();
