(function($){

$.fn.zoomi = function() {
  $(this).filter("img").each(function(){
    if(!this.z) {
      $(this).zoom1().mouseover(function(){$(this).zoom2().show();});
      $(this.z).mouseout(function(){$(this).hide();}); }
  });
 return this;
}

$.fn.zoom1 = function() {
  $(this).each(function(){
    var e = this;
    $(e).css({'position':'relative','z-index':'8'}).after('<img class="'+e.className+'">');
    e.z = e.nextSibling;
    $(e.z).removeClass("zoomi").addClass("zoom2").attr("src",e.title || e.src)
    .css({'position':'absolute','z-index':'10'});
    $(e.z).hide();
  });
  return this;
}

$.fn.zoom2 = function() {
  var s = [];
  this.each(function(){
    var e = this;
    if(!e.z) e = $(e).zoom1()[0]; s.push(e.z);
    if(!e.z.complete) return;
    if(!e.z.width) { $(e.z).show(); e.z.width=e.z.width; $(e.z).hide(); }
    $(e.z).css({left:'2px',
    top:$(e).offsetTop()-(e.z.height-e.scrollHeight)+'px'});
  });
  return this.pushStack(s);
}

$.fn.offsetLeft = function() {
  var e = this[0];
  if(!e.offsetParent) return e.offsetLeft;
  return e.offsetLeft + $(e.offsetParent).offsetLeft(); }

$.fn.offsetTop = function() {
  var e = this[0];
  if(!e.offsetParent) return e.offsetTop;
  return e.offsetTop + $(e.offsetParent).offsetTop(); }

$(function(){ $('img.zoomi').zoomi(); });

})(jQuery);

(function ($)
{

    function ImageData()
    {
        this.width = 0;
        this.height = 0;
        // cache some constant data to simplify further calculations and make zooma faster
        this.viewfinderWidth = 0;
        this.viewfinderHeight = 0;
        this.halfViewfinderWidth = 0;
        this.halfViewfinderHeight = 0;
        this.widthDiff = 0;
        this.heightDiff = 0;
        this.thumbImgPositionLeft = 0;
        this.thumbImgPositionRight = 0;
        this.thumbImgPositionTop = 0;
        this.thumbImgPositionBottom = 0;
        this.thumbImgOffsetLeft = 0;
        this.thumbImgOffsetRight = 0;
        this.thumbImgOffsetTop = 0;
        this.thumbImgOffsetBottom = 0;
        this.viewfinderBorderTop = 0;
        this.viewfinderBorderLeft = 0;
        this.viewfinderBorderBottom = 0;
        this.viewfinderBorderRight = 0;

        this.loaded = false;

        this.getHeight = function()
        {
            return this.height;
        },

                this.getWidth = function()
                {
                    return this.width;
                },

                this.isLoaded = function()
                {
                    return this.loaded;
                };

    }

    function LoaderHeleper(src, calllbackFunction)
    {
        var imageData = new ImageData();

        var imgToLoad = new Image();
        $(imgToLoad).load(function()
        {
            imageData.width = imgToLoad.width;
            imageData.height = imgToLoad.height;

            imageData.loaded = true;
            calllbackFunction(imageData);

        });
        $(imgToLoad).attr('src', src);

        return imageData;
    }

    function correctPositionByEpsilonBorder(position, min, max, epsilon)
    {
        // check min border (position - min < epsilon)
        var allowedMin = min + epsilon;
        if (position < allowedMin)
        {
            return allowedMin;
        }
        // check max border (max - position < epsilon)
        var allowedMax = max - epsilon;
        if (position > allowedMax)
        {
            return allowedMax;
        }

        return position;
    }

    function checkAndPrepareSettings(settings)
    {
        if (settings == null || typeof (settings) == undefined)
        {
            settings = new Object();
        }

        if (settings.autoDeactivate == null || typeof (settings.autoDeactivate) == undefined)
        {
            settings.autoDeactivate = true;
        }

        if (settings.zoomViewfinder == null || typeof (settings.zoomViewfinderName) == undefined)
        {
            settings.zoomViewfinderName = 'zoomViewfinder';
        }

        if (settings.exitCallback == null || typeof (settings.exitCallback) == undefined)
        {
            settings.exitCallback = function()
            {

            };
        }
        return settings;
    }

    $.fn.zooma = function (thumbnailID, fullID, fullImageUrl, settings)
    {
        $.extend(this, {

            deactivate : function ()
            {
                // Create vars for Thumbnail and Full Containers
                fullImageContainer.hide();
                viewAreaDiv.hide();

                $(document).unbind('mousemove', mouseMoveListener);

                IDa.unbind('mouseover', handleMouseEnteresZoomArea);
                viewAreaDiv.unbind('mouseover', handleMouseEnteresZoomArea);
            },

            activate : function()
            {

                $(fullImageContainer).css({
                    backgroundImage: 'url(' + fullImageUrl + ')',
                    backgroundRepeat: 'no-repeat',
                    backgroundPosition: '50% 50%'
                });

                fullImageContainer.show();

                isVisibleZoomBlock = false;

                IDa.bind('mouseover', handleMouseEnteresZoomArea);
                viewAreaDiv.bind('mouseover', handleMouseEnteresZoomArea);
            }
        });


        var isVisibleZoomBlock = false;

        var thumbImageContainer = $('#' + thumbnailID);
        var fullImageContainer = $('#' + fullID);

        var IDa = thumbImageContainer.find('a');

        var imgElement = thumbImageContainer.find('img');
        var thumbWidth = imgElement.width();
        var thumbHeight = imgElement.height();

        var loadingDiv = fullImageContainer.find('div.zoomLoading');

        var mutableFullWidth = fullImageContainer.width();
        var mutableFullHeight = fullImageContainer.height();

        var originalFullWidth = fullImageContainer.width();
        var originalFullHeight = fullImageContainer.height();

        var MidDisplayWidth = mutableFullWidth / 2;
        var MidDisplayHeight = mutableFullHeight / 2;

        var thumbImgPositionLeft = imgElement.position().left;
        var thumbImgPositionRight = imgElement.position().left + thumbWidth;
        var thumbImgPositionTop = imgElement.position().top;
        var thumbImgPositionBottom = imgElement.position().top + thumbHeight;

        var thumbImgOffsetLeft = imgElement.offset().left;
        var thumbImgOffsetRight = imgElement.offset().left + thumbWidth;
        var thumbImgOffsetTop = imgElement.offset().top;
        var thumbImgOffsetBottom = imgElement.offset().top + thumbHeight;

        var mouseEnteredZoomArea = false;

        var widthCutted = false;
        var heightCutted = false;


        settings = checkAndPrepareSettings(settings);

        var autoDeactivate = settings.autoDeactivate;
        var zoomViewfinderName = settings.zoomViewfinderName;
        var exitCallbackFunction = settings.exitCallback;

        var viewAreaDiv = $('#' + zoomViewfinderName);

        var loadedImgData = new LoaderHeleper(fullImageUrl, function(imageData)
        {
            imageData.viewfinderBorderTop = parseInt(viewAreaDiv.css('borderTopWidth'));
            imageData.viewfinderBorderLeft = parseInt(viewAreaDiv.css('borderLeftWidth'));
            imageData.viewfinderBorderBottom = parseInt(viewAreaDiv.css('borderBottomWidth'));
            imageData.viewfinderBorderRight = parseInt(viewAreaDiv.css('borderRightWidth'));


            if (imageData.getWidth() != 0 && imageData.getHeight() != 0)
            {
                if (mutableFullWidth > imageData.getWidth())
                {
                    mutableFullWidth = imageData.getWidth();
                    widthCutted = true;
                }

                if (mutableFullHeight > imageData.getHeight())
                {
                    mutableFullHeight = imageData.getHeight();
                    heightCutted = true;
                }

                imageData.viewfinderWidth = Math.round(thumbWidth * mutableFullWidth / (imageData.getWidth()));
                imageData.viewfinderHeight = Math.round(thumbHeight * mutableFullHeight / (imageData.getHeight()));
                if (widthCutted)
                {
                    imageData.viewfinderWidth = imageData.viewfinderWidth - (imageData.viewfinderBorderLeft + imageData.viewfinderBorderRight);
                }
                if (heightCutted)
                {
                    imageData.viewfinderHeight = imageData.viewfinderHeight - (imageData.viewfinderBorderTop + imageData.viewfinderBorderBottom);
                }

                imageData.halfViewfinderWidth = imageData.viewfinderWidth / 2.0;
                imageData.halfViewfinderHeight = imageData.viewfinderHeight / 2.0;
                // get full / thumb difference
                imageData.widthDiff = imageData.getWidth() / thumbWidth;
                imageData.heightDiff = imageData.getHeight() / thumbHeight;
            }

            imageData.thumbImgPositionLeft = thumbImgPositionLeft;
            imageData.thumbImgPositionRight = thumbImgPositionRight;
            imageData.thumbImgPositionTop = thumbImgPositionTop;
            imageData.thumbImgPositionBottom = thumbImgPositionBottom;

            imageData.thumbImgOffsetLeft = thumbImgOffsetLeft;
            imageData.thumbImgOffsetRight = thumbImgOffsetRight;
            imageData.thumbImgOffsetTop = thumbImgOffsetTop;
            imageData.thumbImgOffsetBottom = thumbImgOffsetBottom;

            viewAreaDiv.css('width', imageData.viewfinderWidth);
            viewAreaDiv.css('height', imageData.viewfinderHeight);
            // put zoom div in the center of the thumbnail element
            viewAreaDiv.css('left', thumbImgOffsetLeft + Math.round(thumbWidth / 2.0 - (imageData.viewfinderWidth + imageData.viewfinderBorderLeft + imageData.viewfinderBorderRight) / 2.0));
            viewAreaDiv.css('top', thumbImgOffsetTop + Math.round(thumbHeight / 2.0 - (imageData.viewfinderHeight + imageData.viewfinderBorderTop + imageData.viewfinderBorderBottom) / 2.0));

            viewAreaDiv.show();
            loadingDiv.hide();
        });

        if (!loadedImgData.isLoaded())
        {
            loadingDiv.show();
        }

        // check wheher we need to close zoom mode
        function mouseMoveListener(event)
        {
            // check whether mouse pointer leaves thumbnail block
            var mouseIsOutZoomArea = (event.pageX < thumbImgOffsetLeft || event.pageX > thumbImgOffsetRight || event.pageY < thumbImgOffsetTop || event.pageY > thumbImgOffsetBottom);
            if (autoDeactivate && mouseEnteredZoomArea && mouseIsOutZoomArea)
            {
                $(document).unbind('mousemove', mouseMoveListener);

                // Create vars for Thumbnail and Full Containers
                fullImageContainer.hide();
                viewAreaDiv.hide();

                exitCallbackFunction();
            }
            else
            {
                if (!mouseIsOutZoomArea)
                {
                    handleMouseMove(event);
                }
            }
        }

        function handleMouseEnteresZoomArea()
        {
            mouseEnteredZoomArea = true;

            if (!isVisibleZoomBlock)
            {
                fullImageContainer.show();
                viewAreaDiv.show();
                isVisibleZoomBlock = true;
                $(document).bind('mousemove', mouseMoveListener);
            }
        }

        function handleMouseMove(event)
        {
            if (loadedImgData.isLoaded())
            {
                var mouseX = event.pageX;
                var mouseY = event.pageY;

                var verticalViewfinderBorder = loadedImgData.viewfinderBorderTop + loadedImgData.viewfinderBorderBottom;
                var horizontalViewfinderBorder = loadedImgData.viewfinderBorderLeft + loadedImgData.viewfinderBorderRight;

                var mouseXFixed = correctPositionByEpsilonBorder(mouseX, loadedImgData.thumbImgOffsetLeft, loadedImgData.thumbImgOffsetRight - horizontalViewfinderBorder, loadedImgData.halfViewfinderWidth);
                var mouseYFixed = correctPositionByEpsilonBorder(mouseY, loadedImgData.thumbImgOffsetTop, loadedImgData.thumbImgOffsetBottom - verticalViewfinderBorder, loadedImgData.halfViewfinderHeight);

                var viewfinderLeft = Math.round(mouseXFixed - loadedImgData.halfViewfinderWidth);
                var viewfinderTop = Math.round(mouseYFixed - loadedImgData.halfViewfinderHeight);
                //
                viewAreaDiv.css('left', viewfinderLeft);
                viewAreaDiv.css('top', viewfinderTop);

                var bgy = 0;
                var bgx = 0;

                if (widthCutted)
                {
                    bgx = Math.round((originalFullWidth - loadedImgData.getWidth()) / 2.0);
                }
                else
                {
                    bgx = Math.round((Math.round(mouseXFixed) - loadedImgData.thumbImgOffsetLeft) * (-loadedImgData.widthDiff) + MidDisplayWidth);
                }

                if (heightCutted)
                {
                    bgy = Math.round((originalFullHeight - loadedImgData.getHeight()) / 2.0);
                }
                else
                {
                    bgy = Math.round((Math.round(mouseYFixed) - loadedImgData.thumbImgOffsetTop) * (-loadedImgData.heightDiff) + MidDisplayHeight);
                }
                
                fullImageContainer.css('backgroundPosition', bgx + 'px' + ' ' + bgy + 'px');
            }
        }

        return this;
    };
})(jQuery);

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

$('.region_sel').change(function() {
		$.get('deca.php', { 'region_id': $('select.region_sel option:selected').val() }, function(data){
                $('#city2').empty();
                $('#city3').css('visibility', 'hidden');
                $('#city2').append( $('<option value="'+data+'">'+data+'</option>') );
                $('#city2').append( $('<option value="other">Другой</option>') );
                $('#city3').val( $('select#city2 option:selected').val() );
		});  
      });
$('#city2').change(function() {
      $('#city3').val('');
      if($('select#city2 option:selected').val()=="other") {
         $('#city3').css('visibility', 'visible');
         } else {
            $('#city3').css('visibility', 'hidden');
            $('#city3').val( $('select#city2 option:selected').val() );
            }
      
      });

function Currency(cur) {
	if(cur == "USD") {
		$.cookie('cur', 'USD');
		$(".price_rub").css("display", "none");
		$(".price_dol").css("display", "block");
		}
	if(cur == "RUB") {
		$.cookie('cur', 'RUB');
		$(".price_dol").css("display", "none");
		$(".price_rub").css("display", "block");
		}
	}
	
(function(a){var A=function(s,v){var f=a.extend({},a.fn.nivoSlider.defaults,v),g={currentSlide:0,currentImage:"",totalSlides:0,randAnim:"",running:false,paused:false,stop:false},e=a(s);e.data("nivo:vars",g);e.css("position","relative");e.addClass("nivoSlider");var j=e.children();j.each(function(){var b=a(this),h="";if(!b.is("img")){if(b.is("a")){b.addClass("nivo-imageLink");h=b}b=b.find("img:first")}var c=b.width();if(c==0)c=b.attr("width");var o=b.height();if(o==0)o=b.attr("height");c>e.width()&&
e.width(c);o>e.height()&&e.height(o);h!=""&&h.css("display","none");b.css("display","none");g.totalSlides++});if(f.startSlide>0){if(f.startSlide>=g.totalSlides)f.startSlide=g.totalSlides-1;g.currentSlide=f.startSlide}g.currentImage=a(j[g.currentSlide]).is("img")?a(j[g.currentSlide]):a(j[g.currentSlide]).find("img:first");a(j[g.currentSlide]).is("a")&&a(j[g.currentSlide]).css("display","block");e.css("background",'url("'+g.currentImage.attr("src")+'") no-repeat');for(var k=0;k<f.slices;k++){var p=
Math.round(e.width()/f.slices);k==f.slices-1?e.append(a('<div class="nivo-slice"></div>').css({left:p*k+"px",width:e.width()-p*k+"px"})):e.append(a('<div class="nivo-slice"></div>').css({left:p*k+"px",width:p+"px"}))}e.append(a('<div class="nivo-caption"><p></p></div>').css({display:"none",opacity:f.captionOpacity}));if(g.currentImage.attr("title")!=""){k=g.currentImage.attr("title");if(k.substr(0,1)=="#")k=a(k).html();a(".nivo-caption p",e).html(k);a(".nivo-caption",e).fadeIn(f.animSpeed)}var l=
0;if(!f.manualAdvance&&j.length>1)l=setInterval(function(){r(e,j,f,false)},f.pauseTime);if(f.directionNav){e.append('<div class="nivo-directionNav"><a class="nivo-prevNav"> </a><a class="nivo-nextNav"> </a></div>');if(f.directionNavHide){a(".nivo-directionNav",e).hide();e.hover(function(){a(".nivo-directionNav",e).show()},function(){a(".nivo-directionNav",e).hide()})}a("a.nivo-prevNav",e).live("click",function(){if(g.running)return false;clearInterval(l);l="";g.currentSlide-=2;r(e,j,f,"prev")});
a("a.nivo-nextNav",e).live("click",function(){if(g.running)return false;clearInterval(l);l="";r(e,j,f,"next")})}if(f.controlNav){p=a('<div class="nivo-controlNav"></div>');e.append(p);for(k=0;k<j.length;k++)if(f.controlNavThumbs){var t=j.eq(k);t.is("img")||(t=t.find("img:first"));f.controlNavThumbsFromRel?p.append('<a class="nivo-control" rel="'+k+'"><img src="'+t.attr("rel")+'" alt="" /></a>'):p.append('<a class="nivo-control" rel="'+k+'"><img src="'+t.attr("src").replace(f.controlNavThumbsSearch,
f.controlNavThumbsReplace)+'" alt="" /></a>')}else p.append('<a class="nivo-control" rel="'+k+'">'+(k+1)+"</a>");a(".nivo-controlNav a:eq("+g.currentSlide+")",e).addClass("active");a(".nivo-controlNav a",e).live("click",function(){if(g.running)return false;if(a(this).hasClass("active"))return false;clearInterval(l);l="";e.css("background",'url("'+g.currentImage.attr("src")+'") no-repeat');g.currentSlide=a(this).attr("rel")-1;r(e,j,f,"control")})}f.keyboardNav&&a(window).keypress(function(b){if(b.keyCode==
"37"){if(g.running)return false;clearInterval(l);l="";g.currentSlide-=2;r(e,j,f,"prev")}if(b.keyCode=="39"){if(g.running)return false;clearInterval(l);l="";r(e,j,f,"next")}});f.pauseOnHover&&e.hover(function(){g.paused=true;clearInterval(l);l=""},function(){g.paused=false;if(l==""&&!f.manualAdvance)l=setInterval(function(){r(e,j,f,false)},f.pauseTime)});e.bind("nivo:animFinished",function(){g.running=false;a(j).each(function(){a(this).is("a")&&a(this).css("display","none")});a(j[g.currentSlide]).is("a")&&
a(j[g.currentSlide]).css("display","block");if(l==""&&!g.paused&&!f.manualAdvance)l=setInterval(function(){r(e,j,f,false)},f.pauseTime);f.afterChange.call(this)});var w=function(b,h){var c=0;a(".nivo-slice",b).each(function(){var o=a(this),d=Math.round(b.width()/h.slices);c==h.slices-1?o.css("width",b.width()-d*c+"px"):o.css("width",d+"px");c++})},r=function(b,h,c,o){var d=b.data("nivo:vars");d&&d.currentSlide==d.totalSlides-1&&c.lastSlide.call(this);if((!d||d.stop)&&!o)return false;c.beforeChange.call(this);
if(o){o=="prev"&&b.css("background",'url("'+d.currentImage.attr("src")+'") no-repeat');o=="next"&&b.css("background",'url("'+d.currentImage.attr("src")+'") no-repeat')}else b.css("background",'url("'+d.currentImage.attr("src")+'") no-repeat');d.currentSlide++;if(d.currentSlide==d.totalSlides){d.currentSlide=0;c.slideshowEnd.call(this)}if(d.currentSlide<0)d.currentSlide=d.totalSlides-1;d.currentImage=a(h[d.currentSlide]).is("img")?a(h[d.currentSlide]):a(h[d.currentSlide]).find("img:first");if(c.controlNav){a(".nivo-controlNav a",
b).removeClass("active");a(".nivo-controlNav a:eq("+d.currentSlide+")",b).addClass("active")}if(d.currentImage.attr("title")!=""){var u=d.currentImage.attr("title");if(u.substr(0,1)=="#")u=a(u).html();a(".nivo-caption",b).css("display")=="block"?a(".nivo-caption p",b).fadeOut(c.animSpeed,function(){a(this).html(u);a(this).fadeIn(c.animSpeed)}):a(".nivo-caption p",b).html(u);a(".nivo-caption",b).fadeIn(c.animSpeed)}else a(".nivo-caption",b).fadeOut(c.animSpeed);var m=0;a(".nivo-slice",b).each(function(){var i=
Math.round(b.width()/c.slices);a(this).css({height:"0px",opacity:"0",background:'url("'+d.currentImage.attr("src")+'") no-repeat -'+(i+m*i-i)+"px 0%"});m++});if(c.effect=="random"){h=["sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","slideInRight","slideInLeft"];d.randAnim=h[Math.floor(Math.random()*(h.length+1))];if(d.randAnim==undefined)d.randAnim="fade"}if(c.effect.indexOf(",")!=-1){h=c.effect.split(",");d.randAnim=h[Math.floor(Math.random()*
h.length)];if(d.randAnim==undefined)d.randAnim="fade"}d.running=true;if(c.effect=="sliceDown"||c.effect=="sliceDownRight"||d.randAnim=="sliceDownRight"||c.effect=="sliceDownLeft"||d.randAnim=="sliceDownLeft"){var n=0;m=0;w(b,c);h=a(".nivo-slice",b);if(c.effect=="sliceDownLeft"||d.randAnim=="sliceDownLeft")h=a(".nivo-slice",b)._reverse();h.each(function(){var i=a(this);i.css({top:"0px"});m==c.slices-1?setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},c.animSpeed,"",function(){b.trigger("nivo:animFinished")})},
100+n):setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},c.animSpeed)},100+n);n+=50;m++})}else if(c.effect=="sliceUp"||c.effect=="sliceUpRight"||d.randAnim=="sliceUpRight"||c.effect=="sliceUpLeft"||d.randAnim=="sliceUpLeft"){m=n=0;w(b,c);h=a(".nivo-slice",b);if(c.effect=="sliceUpLeft"||d.randAnim=="sliceUpLeft")h=a(".nivo-slice",b)._reverse();h.each(function(){var i=a(this);i.css({bottom:"0px"});m==c.slices-1?setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},c.animSpeed,"",
function(){b.trigger("nivo:animFinished")})},100+n):setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},c.animSpeed)},100+n);n+=50;m++})}else if(c.effect=="sliceUpDown"||c.effect=="sliceUpDownRight"||d.randAnim=="sliceUpDown"||c.effect=="sliceUpDownLeft"||d.randAnim=="sliceUpDownLeft"){var x=m=n=0;w(b,c);h=a(".nivo-slice",b);if(c.effect=="sliceUpDownLeft"||d.randAnim=="sliceUpDownLeft")h=a(".nivo-slice",b)._reverse();h.each(function(){var i=a(this);if(m==0){i.css("top","0px");m++}else{i.css("bottom",
"0px");m=0}x==c.slices-1?setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},c.animSpeed,"",function(){b.trigger("nivo:animFinished")})},100+n):setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},c.animSpeed)},100+n);n+=50;x++})}else if(c.effect=="fold"||d.randAnim=="fold"){m=n=0;w(b,c);a(".nivo-slice",b).each(function(){var i=a(this),y=i.width();i.css({top:"0px",height:"100%",width:"0px"});m==c.slices-1?setTimeout(function(){i.animate({width:y,opacity:"1.0"},c.animSpeed,"",function(){b.trigger("nivo:animFinished")})},
100+n):setTimeout(function(){i.animate({width:y,opacity:"1.0"},c.animSpeed)},100+n);n+=50;m++})}else if(c.effect=="fade"||d.randAnim=="fade"){var q=a(".nivo-slice:first",b);q.css({height:"100%",width:b.width()+"px"});q.animate({opacity:"1.0"},c.animSpeed*2,"",function(){b.trigger("nivo:animFinished")})}else if(c.effect=="slideInRight"||d.randAnim=="slideInRight"){q=a(".nivo-slice:first",b);q.css({height:"100%",width:"0px",opacity:"1"});q.animate({width:b.width()+"px"},c.animSpeed*2,"",function(){b.trigger("nivo:animFinished")})}else if(c.effect==
"slideInLeft"||d.randAnim=="slideInLeft"){q=a(".nivo-slice:first",b);q.css({height:"100%",width:"0px",opacity:"1",left:"",right:"0px"});q.animate({width:b.width()+"px"},c.animSpeed*2,"",function(){q.css({left:"0px",right:""});b.trigger("nivo:animFinished")})}},z=function(b){this.console&&typeof console.log!="undefined"&&console.log(b)};this.stop=function(){if(!a(s).data("nivo:vars").stop){a(s).data("nivo:vars").stop=true;z("Stop Slider")}};this.start=function(){if(a(s).data("nivo:vars").stop){a(s).data("nivo:vars").stop=
false;z("Start Slider")}};f.afterLoad.call(this)};a.fn.nivoSlider=function(s){return this.each(function(){var v=a(this);if(!v.data("nivoslider")){var f=new A(this,s);v.data("nivoslider",f)}})};a.fn.nivoSlider.defaults={effect:"random",slices:15,animSpeed:500,pauseTime:3E3,startSlide:0,directionNav:true,directionNavHide:true,controlNav:true,controlNavThumbs:false,controlNavThumbsFromRel:false,controlNavThumbsSearch:".jpg",controlNavThumbsReplace:"_thumb.jpg",keyboardNav:true,pauseOnHover:true,manualAdvance:false,
captionOpacity:0.8,beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};a.fn._reverse=[].reverse})(jQuery);
