//JQuery Timers Plugin
jQuery.fn.extend({everyTime:function(interval,label,fn,times,belay){return this.each(function(){jQuery.timer.add(this,interval,label,fn,times,belay)})},oneTime:function(interval,label,fn){return this.each(function(){jQuery.timer.add(this,interval,label,fn,1)})},stopTime:function(label,fn){return this.each(function(){jQuery.timer.remove(this,label,fn)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{'ms':1,'cs':10,'ds':100,'s':1000,'das':10000,'hs':100000,'ks':1000000},timeParse:function(value){if(value==undefined||value==null)return null;var result=this.regex.exec(jQuery.trim(value.toString()));if(result[2]){var num=parseInt(result[1],10);var mult=this.powers[result[2]]||1;return num*mult}else{return value}},add:function(element,interval,label,fn,times,belay){var counter=0;if(jQuery.isFunction(label)){if(!times)times=fn;fn=label;label=interval}interval=jQuery.timer.timeParse(interval);if(typeof interval!='number'||isNaN(interval)||interval<=0)return;if(times&&times.constructor!=Number){belay=!!times;times=0}times=times||0;belay=belay||false;if(!element.$timers)element.$timers={};if(!element.$timers[label])element.$timers[label]={};fn.$timerID=fn.$timerID||this.guid++;var handler=function(){if(belay&&this.inProgress)return;this.inProgress=true;if((++counter>times&&times!==0)||fn.call(element,counter)===false)jQuery.timer.remove(element,label,fn);this.inProgress=false};handler.$timerID=fn.$timerID;if(!element.$timers[label][fn.$timerID])element.$timers[label][fn.$timerID]=window.setInterval(handler,interval);if(!this.global[label])this.global[label]=[];this.global[label].push(element)},remove:function(element,label,fn){var timers=element.$timers,ret;if(timers){if(!label){for(label in timers)this.remove(element,label,fn)}else if(timers[label]){if(fn){if(fn.$timerID){window.clearInterval(timers[label][fn.$timerID]);delete timers[label][fn.$timerID]}}else{for(var fn in timers[label]){window.clearInterval(timers[label][fn]);delete timers[label][fn]}}for(ret in timers[label])break;if(!ret){ret=null;delete timers[label]}}for(ret in timers)break;if(!ret)element.$timers=null}}}});if(jQuery.browser.msie)jQuery(window).one("unload",function(){var global=jQuery.timer.global;for(var label in global){var els=global[label],i=els.length;while(--i)jQuery.timer.remove(els[i],label)}});
//END.JQuery Timers Plugin
//KeyMask
(function(a){var c=(a.browser.msie?"paste":"input")+".mask";var b=(window.orientation!=undefined);a.mask={definitions:{"9":"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"}};a.fn.extend({caret:function(e,f){if(this.length==0){return}if(typeof e=="number"){f=(typeof f=="number")?f:e;return this.each(function(){if(this.setSelectionRange){this.focus();this.setSelectionRange(e,f)}else{if(this.createTextRange){var g=this.createTextRange();g.collapse(true);g.moveEnd("character",f);g.moveStart("character",e);g.select()}}})}else{if(this[0].setSelectionRange){e=this[0].selectionStart;f=this[0].selectionEnd}else{if(document.selection&&document.selection.createRange){var d=document.selection.createRange();e=0-d.duplicate().moveStart("character",-100000);f=e+d.text.length}}return{begin:e,end:f}}},unmask:function(){return this.trigger("unmask")},mask:function(j,d){if(!j&&this.length>0){var f=a(this[0]);var g=f.data("tests");return a.map(f.data("buffer"),function(l,m){return g[m]?l:null}).join("")}d=a.extend({placeholder:"_",completed:null},d);var k=a.mask.definitions;var g=[];var e=j.length;var i=null;var h=j.length;a.each(j.split(""),function(m,l){if(l=="?"){h--;e=m}else{if(k[l]){g.push(new RegExp(k[l]));if(i==null){i=g.length-1}}else{g.push(null)}}});return this.each(function(){var r=a(this);var m=a.map(j.split(""),function(x,y){if(x!="?"){return k[x]?d.placeholder:x}});var n=false;var q=r.val();r.data("buffer",m).data("tests",g);function v(x){while(++x<=h&&!g[x]){}return x}function t(x){while(!g[x]&&--x>=0){}for(var y=x;y<h;y++){if(g[y]){m[y]=d.placeholder;var z=v(y);if(z<h&&g[y].test(m[z])){m[y]=m[z]}else{break}}}s();r.caret(Math.max(i,x))}function u(y){for(var A=y,z=d.placeholder;A<h;A++){if(g[A]){var B=v(A);var x=m[A];m[A]=z;if(B<h&&g[B].test(x)){z=x}else{break}}}}function l(y){var x=a(this).caret();var z=y.keyCode;n=(z<16||(z>16&&z<32)||(z>32&&z<41));if((x.begin-x.end)!=0&&(!n||z==8||z==46)){w(x.begin,x.end)}if(z==8||z==46||(b&&z==127)){t(x.begin+(z==46?0:-1));return false}else{if(z==27){r.val(q);r.caret(0,p());return false}}}function o(B){if(n){n=false;return(B.keyCode==8)?false:null}B=B||window.event;var C=B.charCode||B.keyCode||B.which;var z=a(this).caret();if(B.ctrlKey||B.altKey||B.metaKey){return true}else{if((C>=32&&C<=125)||C>186){var x=v(z.begin-1);if(x<h){var A=String.fromCharCode(C);if(g[x].test(A)){u(x);m[x]=A;s();var y=v(x);a(this).caret(y);if(d.completed&&y==h){d.completed.call(r)}}}}}return false}function w(x,y){for(var z=x;z<y&&z<h;z++){if(g[z]){m[z]=d.placeholder}}}function s(){return r.val(m.join("")).val()}function p(y){var z=r.val();var C=-1;for(var B=0,x=0;B<h;B++){if(g[B]){m[B]=d.placeholder;while(x++<z.length){var A=z.charAt(x-1);if(g[B].test(A)){m[B]=A;C=B;break}}if(x>z.length){break}}else{if(m[B]==z[x]&&B!=e){x++;C=B}}}if(!y&&C+1<e){r.val("");w(0,h)}else{if(y||C+1>=e){s();if(!y){r.val(r.val().substring(0,C+1))}}}return(e?B:i)}if(!r.attr("readonly")){r.one("unmask",function(){r.unbind(".mask").removeData("buffer").removeData("tests")}).bind("focus.mask",function(){q=r.val();var x=p();s();setTimeout(function(){if(x==j.length){r.caret(0,x)}else{r.caret(x)}},0)}).bind("blur.mask",function(){p();if(r.val()!=q){r.change()}}).bind("keydown.mask",l).bind("keypress.mask",o).bind(c,function(){setTimeout(function(){r.caret(p(true))},0)})}p()})}})})(jQuery);
//END.KeyMask

/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2C.2D=6(4){4=1H.2E({1I:\'#2F\',1J:0.8,19:G,1K:\'/o/z//5/5-2G-R.16\',1m:\'/o/z//5/5-1n-2H.16\',1o:\'/o/z//5/5-1n-2I.16\',1L:\'/o/z//5/5-1n-2J.16\',1a:\'/o/z//5/5-2K.16\',1b:10,1M:2L,1N:\'Фото\',1O:\'из\',1P:\'c\',1Q:\'p\',1R:\'n\',h:[],7:0},4);f H=I;6 1S(){1T(I,H);v G}6 1T(1c,H){$(\'1U, 1V, 1W\').j({\'1X\':\'2M\'});1Y();4.h.A=0;4.7=0;9(H.A==1){4.h.1Z(w 1d(1c.17(\'J\'),1c.17(\'20\')))}k{2N(f i=0;i<H.A;i++){4.h.1Z(w 1d(H[i].17(\'J\'),H[i].17(\'20\')))}}21(4.h[4.7][0]!=1c.17(\'J\')){4.7++}B()}6 1Y(){$(\'m\').2O(\'<e g="q-S"></e><e g="q-5"><e g="5-r-b-y"><e g="5-r-b"><z g="5-b"><e 2P="" g="5-l"><a J="#" g="5-l-T"></a><a J="#" g="5-l-U"></a></e><e g="5-R"><a J="#" g="5-R-22"><z V="\'+4.1K+\'"></a></e></e></e><e g="5-r-b-o-y"><e g="5-r-b-o"><e g="5-b-C"><1e g="5-b-C-1p"></1e><1e g="5-b-C-1f"></1e></e><e g="5-1q"><a J="#" g="5-1q-23"><z V="\'+4.1L+\'"></a></e></e></e></e>\');f D=1r();$(\'#q-S\').j({2Q:4.1I,2R:4.1J,W:D[0],X:D[1]}).24();f Y=1s();$(\'#q-5\').j({25:Y[1]+(D[3]/10),1g:Y[0]}).K();$(\'#q-S,#q-5\').E(6(){1h()});$(\'#5-R-22,#5-1q-23\').E(6(){1h();v G});$(L).2S(6(){f D=1r();$(\'#q-S\').j({W:D[0],X:D[1]});f Y=1s();$(\'#q-5\').j({25:Y[1]+(D[3]/10),1g:Y[0]})})}6 B(){$(\'#5-R\').K();9(4.19){$(\'#5-b,#5-r-b-o-y,#5-b-C-1f\').1i()}k{$(\'#5-b,#5-l,#5-l-T,#5-l-U,#5-r-b-o-y,#5-b-C-1f\').1i()}f Z=w 1t();Z.26=6(){$(\'#5-b\').2T(\'V\',4.h[4.7][0]);28(Z.W,Z.X);Z.26=6(){}};Z.V=4.h[4.7][0]};6 28(1u,1v){f 29=$(\'#5-r-b-y\').W();f 2a=$(\'#5-r-b-y\').X();f 1w=(1u+(4.1b*2));f 1x=(1v+(4.1b*2));f 2b=29-1w;f 2c=2a-1x;$(\'#5-r-b-y\').2U({W:1w,X:1x},4.1M,6(){2d()});9((2b==0)&&(2c==0)){9($.2V.2W){1y(2X)}k{1y(2Y)}}$(\'#5-r-b-o-y\').j({W:1u});$(\'#5-l-T,#5-l-U\').j({X:1v+(4.1b*2)})};6 2d(){$(\'#5-R\').1i();$(\'#5-b\').24(6(){2e();2f()});2g()};6 2e(){$(\'#5-r-b-o-y\').2Z(\'30\');$(\'#5-b-C-1p\').1i();9(4.h[4.7][1]){$(\'#5-b-C-1p\').2h(4.h[4.7][1]).K()}9(4.h.A>1){$(\'#5-b-C-1f\').2h(4.1N+\' \'+(4.7+1)+\' \'+4.1O+\' \'+4.h.A).K()}}6 2f(){$(\'#5-l\').K();$(\'#5-l-T,#5-l-U\').j({\'M\':\'1z N(\'+4.1a+\') O-P\'});9(4.7!=0){9(4.19){$(\'#5-l-T\').j({\'M\':\'N(\'+4.1m+\') 1g 15% O-P\'}).11().1j(\'E\',6(){4.7=4.7-1;B();v G})}k{$(\'#5-l-T\').11().2i(6(){$(I).j({\'M\':\'N(\'+4.1m+\') 1g 15% O-P\'})},6(){$(I).j({\'M\':\'1z N(\'+4.1a+\') O-P\'})}).K().1j(\'E\',6(){4.7=4.7-1;B();v G})}}9(4.7!=(4.h.A-1)){9(4.19){$(\'#5-l-U\').j({\'M\':\'N(\'+4.1o+\') 2j 15% O-P\'}).11().1j(\'E\',6(){4.7=4.7+1;B();v G})}k{$(\'#5-l-U\').11().2i(6(){$(I).j({\'M\':\'N(\'+4.1o+\') 2j 15% O-P\'})},6(){$(I).j({\'M\':\'1z N(\'+4.1a+\') O-P\'})}).K().1j(\'E\',6(){4.7=4.7+1;B();v G})}}2k()}6 2k(){$(d).31(6(12){2l(12)})}6 1A(){$(d).11()}6 2l(12){9(12==2m){13=32.2n;1B=27}k{13=12.2n;1B=12.33}18=34.35(13).36();9((18==4.1P)||(18==\'x\')||(13==1B)){1h()}9((18==4.1Q)||(13==37)){9(4.7!=0){4.7=4.7-1;B();1A()}}9((18==4.1R)||(13==39)){9(4.7!=(4.h.A-1)){4.7=4.7+1;B();1A()}}}6 2g(){9((4.h.A-1)>4.7){2o=w 1t();2o.V=4.h[4.7+1][0]}9(4.7>0){2p=w 1t();2p.V=4.h[4.7-1][0]}}6 1h(){$(\'#q-5\').2q();$(\'#q-S\').38(6(){$(\'#q-S\').2q()});$(\'1U, 1V, 1W\').j({\'1X\':\'3a\'})}6 1r(){f s,t;9(L.1k&&L.2r){s=L.2s+L.3b;t=L.1k+L.2r}k 9(d.m.2t>d.m.2u){s=d.m.3c;t=d.m.2t}k{s=d.m.3d;t=d.m.2u}f F,Q;9(14.1k){9(d.u.1l){F=d.u.1l}k{F=14.2s}Q=14.1k}k 9(d.u&&d.u.1C){F=d.u.1l;Q=d.u.1C}k 9(d.m){F=d.m.1l;Q=d.m.1C}9(t<Q){1D=Q}k{1D=t}9(s<F){1E=s}k{1E=F}2v=w 1d(1E,1D,F,Q);v 2v};6 1s(){f s,t;9(14.2w){t=14.2w;s=14.3e}k 9(d.u&&d.u.1F){t=d.u.1F;s=d.u.2x}k 9(d.m){t=d.m.1F;s=d.m.2x}2y=w 1d(s,t);v 2y};6 1y(2z){f 2A=w 2B();1G=2m;3f{f 1G=w 2B()}21(1G-2A<2z)};v I.11(\'E\').E(1S)}})(1H);',62,202,'||||settings|lightbox|function|activeImage||if||image||document|div|var|id|imageArray||css|else|nav|body||data||jquery|container|xScroll|yScroll|documentElement|return|new||box|img|length|_set_image_to_view|details|arrPageSizes|click|windowWidth|false|jQueryMatchedObj|this|href|show|window|background|url|no|repeat|windowHeight|loading|overlay|btnPrev|btnNext|src|width|height|arrPageScroll|objImagePreloader||unbind|objEvent|keycode|self||gif|getAttribute|key|fixedNavigation|imageBlank|containerBorderSize|objClicked|Array|span|currentNumber|left|_finish|hide|bind|innerHeight|clientWidth|imageBtnPrev|btn|imageBtnNext|caption|secNav|___getPageSize|___getPageScroll|Image|intImageWidth|intImageHeight|intWidth|intHeight|___pause|transparent|_disable_keyboard_navigation|escapeKey|clientHeight|pageHeight|pageWidth|scrollTop|curDate|jQuery|overlayBgColor|overlayOpacity|imageLoading|imageBtnClose|containerResizeSpeed|txtImage|txtOf|keyToClose|keyToPrev|keyToNext|_initialize|_start|embed|object|select|visibility|_set_interface|push|title|while|link|btnClose|fadeIn|top|onload||_resize_container_image_box|intCurrentWidth|intCurrentHeight|intDiffW|intDiffH|_show_image|_show_image_data|_set_navigation|_preload_neighbor_images|html|hover|right|_enable_keyboard_navigation|_keyboard_action|null|keyCode|objNext|objPrev|remove|scrollMaxY|innerWidth|scrollHeight|offsetHeight|arrayPageSize|pageYOffset|scrollLeft|arrayPageScroll|ms|date|Date|fn|lightBox|extend|000|ico|prev|next|close|blank|400|hidden|for|append|style|backgroundColor|opacity|resize|attr|animate|browser|msie|250|100|slideDown|fast|keydown|event|DOM_VK_ESCAPE|String|fromCharCode|toLowerCase||fadeOut||visible|scrollMaxX|scrollWidth|offsetWidth|pageXOffset|do'.split('|'),0,{}))

function open_modal(id){
    var maskHeight = $(document).height();
    var maskWidth = $(window).width();
    $('#mask').css({'width':maskWidth,'height':maskHeight,'opacity':0.5});
    $('#mask').fadeIn(500);            
    var winH = $(window).height()/2+$(window).scrollTop();
    var winW = $(window).width();

    $(id).css('top', winH-$(id).height()/2);
    $(id).css('left', winW/2-$(id).width()/2);
    $(id).fadeIn(1000);
    return false;
}
function close_modal(){
    $('#mask').fadeOut("slow");
    $('.window').fadeOut("slow");
    return false;
}
//Global Options
$(function(){
    $("a[name='modal']").click(function(e){e.preventDefault();var id=$(this).attr('href');open_modal(id);});
    $('.window .close').click(function(e){e.preventDefault();close_modal()});
    $('#mask').click(function (){$(this).fadeOut('slow');$('.window').hide();});
    $("li.subset").hover(function(e) {
        var th = $(this).width()/2 - 88;
        $(this).find("ul").css({left:th});
        $(this).find("ul").hoverFlow(e.type,{'height': 'show'});
    },function(e){
        $(this).find("ul").hoverFlow(e.type, {'height': 'hide'});
    });
    $("#category li a,#items li a").lightBox();
    $('a.captch_fresh').click(function(){
        $("#code_img").attr('src', '/?m=captch&a=code&'+Math.random());
        return false;
    });
    $("a.log_exit").click(function(){log_exit();return false;});
});
function select_sort(element){var $dd=$(element);if($dd.length>0){var selectedVal=$dd.val();var lb=$dd[0];arrTexts=new Array();arrTexts2={};for(i=0;i<lb.length;i++){arrTexts[i]=lb.options[i].text;arrTexts2[lb.options[i].text]=lb.options[i].value}arrTexts.sort();for(i=0;i<lb.length;i++){lb.options[i].text=arrTexts[i];lb.options[i].value=arrTexts2[arrTexts[i]]}$dd.val(selectedVal)}}

function getBrowserInfo() {
 var t,v = undefined;
 if (window.opera) t = 'Opera';
 else if (document.all) {
  t = 'IE';
  var nv = navigator.appVersion;
  var s = nv.indexOf('MSIE')+5;
  v = nv.substring(s,s+1);
 }
 else if (navigator.appName) t = 'Netscape';
 return {type:t,version:v};
}
 
function bookmark(a){
 var url = window.document.location;
 var title = window.document.title;
 var b = getBrowserInfo();
 if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
 else if (b.type == 'Opera') {
  a.href = url;
  a.rel = "sidebar";
  a.title = url+','+title;
  return true;
 }
 else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
 else alert("Нажмите CTRL+D, чтобы добавить страницу в закладки.");
 return false;
}
//END.Global Options

/*
* hoverFlow - A Solution to Animation Queue Buildup in jQuery
* Version 1.00
*
* Copyright (c) 2009 Ralf Stoltze, http://www.2meter3.de/code/hoverFlow/
* Dual-licensed under the MIT and GPL licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($){$.fn.hoverFlow=function(c,d,e,f,g){if($.inArray(c,['mouseover','mouseenter','mouseout','mouseleave'])==-1){return this}var h=typeof e==='object'?e:{complete:g||!g&&f||$.isFunction(e)&&e,duration:e,easing:g&&f||f&&!$.isFunction(f)&&f};h.queue=false;var i=h.complete;h.complete=function(){$(this).dequeue();if($.isFunction(i)){i.call(this)}};return this.each(function(){var b=$(this);if(c=='mouseover'||c=='mouseenter'){b.data('jQuery.hoverFlow',true)}else{b.removeData('jQuery.hoverFlow')}b.queue(function(){var a=(c=='mouseover'||c=='mouseenter')?b.data('jQuery.hoverFlow')!==undefined:b.data('jQuery.hoverFlow')===undefined;if(a){b.animate(d,h)}else{b.queue([])}})})}})(jQuery);

////////////////////////////////
// easing.js
////////////////////////////////
/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright В© 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
    def: 'easeOutQuad',
    swing: function (x, t, b, c, d) {
        //alert(jQuery.easing.default);
        return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
    },
    easeInQuad: function (x, t, b, c, d) {
        return c*(t/=d)*t + b;
    },
    easeOutQuad: function (x, t, b, c, d) {
        return -c *(t/=d)*(t-2) + b;
    },
    easeInOutQuad: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t + b;
        return -c/2 * ((--t)*(t-2) - 1) + b;
    },
    easeInCubic: function (x, t, b, c, d) {
        return c*(t/=d)*t*t + b;
    },
    easeOutCubic: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t + 1) + b;
    },
    easeInOutCubic: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t + b;
        return c/2*((t-=2)*t*t + 2) + b;
    },
    easeInQuart: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t + b;
    },
    easeOutQuart: function (x, t, b, c, d) {
        return -c * ((t=t/d-1)*t*t*t - 1) + b;
    },
    easeInOutQuart: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
        return -c/2 * ((t-=2)*t*t*t - 2) + b;
    },
    easeInQuint: function (x, t, b, c, d) {
        return c*(t/=d)*t*t*t*t + b;
    },
    easeOutQuint: function (x, t, b, c, d) {
        return c*((t=t/d-1)*t*t*t*t + 1) + b;
    },
    easeInOutQuint: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
        return c/2*((t-=2)*t*t*t*t + 2) + b;
    },
    easeInSine: function (x, t, b, c, d) {
        return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
    },
    easeOutSine: function (x, t, b, c, d) {
        return c * Math.sin(t/d * (Math.PI/2)) + b;
    },
    easeInOutSine: function (x, t, b, c, d) {
        return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
    },
    easeInExpo: function (x, t, b, c, d) {
        return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
    },
    easeOutExpo: function (x, t, b, c, d) {
        return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
    },
    easeInOutExpo: function (x, t, b, c, d) {
        if (t==0) return b;
        if (t==d) return b+c;
        if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
        return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
    },
    easeInCirc: function (x, t, b, c, d) {
        return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
    },
    easeOutCirc: function (x, t, b, c, d) {
        return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
    },
    easeInOutCirc: function (x, t, b, c, d) {
        if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
        return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
    },
    easeInElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
    },
    easeOutElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
    },
    easeInOutElastic: function (x, t, b, c, d) {
        var s=1.70158;var p=0;var a=c;
        if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
        if (a < Math.abs(c)) { a=c; var s=p/4; }
        else var s = p/(2*Math.PI) * Math.asin (c/a);
        if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
        return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
    },
    easeInBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*(t/=d)*t*((s+1)*t - s) + b;
    },
    easeOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158;
        return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
    },
    easeInOutBack: function (x, t, b, c, d, s) {
        if (s == undefined) s = 1.70158; 
        if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
        return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
    },
    easeInBounce: function (x, t, b, c, d) {
        return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
    },
    easeOutBounce: function (x, t, b, c, d) {
        if ((t/=d) < (1/2.75)) {
            return c*(7.5625*t*t) + b;
        } else if (t < (2/2.75)) {
            return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
        } else if (t < (2.5/2.75)) {
            return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
        } else {
            return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
        }
    },
    easeInOutBounce: function (x, t, b, c, d) {
        if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
        return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
    }
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright В© 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
////////////////////////////////
// END.easing.js
////////////////////////////////

$.fn.infiniteCarousel = function () {

    function repeat(str, num) {
        return new Array( num + 1 ).join( str );
    }
  
    return this.each(function () {
        var $wrapper = $('> li', this).css('overflow', 'hidden'),
            $slider = $wrapper.find('> ul'),
            $items = $slider.find('> li'),
            $single = $items.filter(':first'),
            
            singleWidth = $single.outerWidth(), 
            visible = Math.ceil($wrapper.innerWidth() / singleWidth), // note: doesn't include padding or border
            currentPage = 1,
            pages = Math.ceil($items.length / visible);            


        // 1. Pad so that 'visible' number will always be seen, otherwise create empty items
        if (($items.length % visible) != 0) {
            $slider.append(repeat('<li class="empty" />', visible - ($items.length % visible)));
            $items = $slider.find('> li');
        }

        // 2. Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
        $items.filter(':first').before($items.slice(- visible).clone().addClass('cloned'));
        $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
        $items = $slider.find('> li'); // reselect
        
        // 3. Set the left position to the first 'real' item
        $wrapper.scrollLeft(singleWidth * visible);
        
        // 4. paging function
        function gotoPage(page) {
            var dir = page < currentPage ? -1 : 1,
                n = Math.abs(currentPage - page),
                left = singleWidth * dir * visible * n;
            
            $wrapper.filter(':not(:animated)').animate({
                scrollLeft : '+=' + left
            }, 500, function () {
                if (page == 0) {
                    $wrapper.scrollLeft(singleWidth * visible * pages);
                    page = pages;
                } else if (page > pages) {
                    $wrapper.scrollLeft(singleWidth * visible);
                    // reset back to start position
                    page = 1;
                } 

                currentPage = page;
            });                
            
            return false;
        }
        
        // 5. Bind to the forward and back buttons
        $('li.larr a', this).click(function () {
            return gotoPage(currentPage - 1);
        });
        
        $('li.rarr a', this).click(function () {
            return gotoPage(currentPage + 1);
        });
        
        // create a public interface to move to a specific page
        $(this).bind('goto', function (event, page) {
            gotoPage(page);
        });
    });  
};
      
///////////////////////////////
// user_bar.js               //
///////////////////////////////
var mUserAuthorized = false;
function updateUserPanel(new_status,adm)
{
    if ( 'undefined' != typeof(new_status) )
    {
        if ( new_status == "1" || new_status == 1 ) {mUserAuthorized = true;}
        else if ( new_status == "2" || new_status == 2 ) {mUserAuthorized = false;}
        else {mUserAuthorized = false;}
    }
    
    if ( mUserAuthorized == false ){
        $("div.authorized").hide();
        $("div.unauthorized").show();
    } else if ( mUserAuthorized == true ) {
        $("div.unauthorized").hide();
        $("div.authorized").show();

        if ( typeof(adm) != 'undefined' && adm == 1 ) {$("#admin_link").parent().show();}
        else {$("#admin_link").parent().hide();}
    }    
}

function log_end(res,text,login,acc,adm)
{    
    try {
        $("span.ress").hide();
        $(this).oneTime("1s", function(){
            if ( res == 4 ){
                $("span.ress").css({'color':'black'});
                $("form").fadeOut("slow");
                $("p.form_caption").fadeOut("slow");
                $("a.forget").fadeOut();
                $("div.authorized").fadeIn("slow");
                $("div.unauthorized").fadeOut("slow");
                updateUserPanel(1,adm);
            } else if ( res != 4 && res != 5 ){
                $("div.unauthorized").show();
                $("div.authorized").hide();
                $("span.ress").css({'color':'red'});
                
                updateUserPanel(2);
            } else if ( res == 5 ){
                $("div.authorized").fadeOut("slow");
                $("div.unauthorized").fadeIn("slow");
                $("div.unauthorized").show();
                $("div.authorized").hide();
                updateUserPanel(2);
            }
            if (res != 5){
                $(this).oneTime(500, function(){$("span.ress").fadeIn("slow");$("span.ress").text(text);});
            }
        },1);
        if ( res == 4 ) {$("#form_login_f").fadeOut();$("#mask").fadeOut();};
    } catch (err) { alert(err); }
}
   
function log_call(par)
{
    try {
        var login = null;
        var pass = null;

        var inputs = par.getElementsByTagName("input");
        for ( var i in inputs )
        {
            if ( inputs[i].id == 'login_login' ) {login = inputs[i];}
            if ( inputs[i].id == 'login_pass' ) {pass = inputs[i];}
        }
        
        if ( login == null )
        {
            alert('Не удается найти поле с введенным логином!');
            return ;
        }
        if ( pass == null )
        {
            alert('Не удается найти поле с введенным паролем!');
            return ;
        }

        $("span.ress").show();
        $("span.ress").text("Подождите, идет проверка данных...");
        
        var aj = new ajaxRequest();
        aj.setPOST("login",login.value);
        aj.setPOST("pass",pass.value);
        aj.load("index.php?m=login&a=login_ajax",'result_login');
    } catch (err) { alert(err); }
}
function log_exit()
{
    try {
        var aj = new ajaxRequest();
        aj.load("index.php?m=login&a=logout_ajax",'result_login');
    } catch (err) { alert(err); }
}
///////////////////////////////
// user_bar.js               //
///////////////////////////////
