/**
* jQuery iView Slider v2.0
*
* @version: 2.0.1 - August 17, 2012
*
* @author: Hemn Chawroka
* hemn@iprodev.com
* http://iprodev.com/
*
*/
(function(d,v,q){function y(){z=v[s](function(){o.each(function(){var a=d(this),b=a.width(),c=a.height(),f=d.data(this,u);if(b!==f.w||c!==f.h)a.trigger(w,[f.w=b,f.h=c])});y()},p[A])}var B=function(a,b){var c=this;c.options=b;c.sliderContent=a;c.sliderInner=c.sliderContent.html();c.sliderContent.html("
"+c.sliderInner+"
");c.slider=d(".iviewSlider",c.sliderContent);c.slider.css("position","relative");c.defs={slide:0,total:0,image:"",images:[],width:c.sliderContent.width(),
height:c.sliderContent.height(),timer:b.timer.toLowerCase(),lock:!1,paused:b.autoAdvance?!1:!0,time:b.pauseTime,easing:b.easing};c.disableSelection(c.slider[0]);c.slides=c.slider.children();c.slides.each(function(){var a=d(this);c.defs.images.push(a.data("iview:image"));a.data("iview:thumbnail")&&c.defs.images.push(a.data("iview:thumbnail"));a.css("display","none");if("video"==a.data("iview:type")){var f=a.children().eq(0),e=d('');a.append(e);f.appendTo(d("div.iview-video-container",e));e.css({width:c.defs.width,height:c.defs.height,top:"-"+c.defs.height+"px"}).hide();a.addClass("iview-video").css({cursor:"pointer"})}c.defs.total++}).css({width:c.defs.width,height:c.defs.height});c.sliderContent.append('');var f=d("#iview-preloader",c.sliderContent),e=d("div",f);f.css({top:c.defs.height/2-f.height()/2+"px",left:c.defs.width/2-f.width()/2+"px"});
c.sliderContent.append('');c.iviewTimer=d("#iview-timer",c.sliderContent);c.iviewTimer.hide();d(".iview-caption",c.slider).each(function(){var a=d(this);a.html(''+a.html()+"
")});b.startSlide=b.randomStart?Math.floor(Math.random()*c.defs.total):b.startSlide;b.startSlide=0=c.defs.total?c.defs.total-1:b.startSlide;c.defs.slide=b.startSlide;c.defs.image=c.slides.eq(c.defs.slide);c.defs.time=c.defs.image.data("iview:pausetime")?
c.defs.image.data("iview:pausetime"):b.pauseTime;c.defs.easing=c.defs.image.data("iview:easing")?c.defs.image.data("iview:easing"):b.easing;c.pieDegree=0;var g=b.timerPadding,k=b.timerDiameter,h=b.timerStroke;if(1'+a.options.previousLabel+''+a.options.nextLabel+""),d(".iview-directionNav",a.sliderContent).css({opacity:a.options.directionNavHoverOpacity}),
a.sliderContent.hover(function(){d(".iview-directionNav",a.sliderContent).stop().animate({opacity:1},300)},function(){d(".iview-directionNav",a.sliderContent).stop().animate({opacity:a.options.directionNavHoverOpacity},300)}),d("a.iview-prevNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.defs.slide=a.defs.slide-2;a.goTo("prev")}),d("a.iview-nextNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.goTo("next")}));if(a.options.controlNav){var b=
'',c="";!a.options.directionNav&&a.options.controlNavNextPrev&&(b+='
'+a.options.previousLabel+"");for(var b=b+'
',f=0;f";a.options.controlNavThumbs?(e=e.data("iview:thumbnail")?e.data("iview:thumbnail"):e.data("iview:image"),b+=''):(e=e.data("iview:thumbnail")?e.data("iview:thumbnail"):
e.data("iview:image"),b+=''+(f+1)+"",a.options.controlNavTooltip&&(c+=''));b+=""}b+="
";!a.options.directionNav&&a.options.controlNavNextPrev&&(b+='
'+a.options.nextLabel+"");b+="
";!a.options.controlNavThumbs&&a.options.controlNavTooltip&&(b+='");
a.sliderContent.append(b);d(".iview-controlNav a.iview-control:eq("+a.defs.slide+")",a.sliderContent).addClass("active");d("a.iview-controlPrevNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.defs.slide=a.defs.slide-2;a.goTo("prev")});d("a.iview-controlNextNav",a.sliderContent).live("click",function(){if(a.defs.lock)return false;a.cleanTimer();a.goTo("next")});d(".iview-controlNav a.iview-control",a.sliderContent).live("click",function(){if(a.defs.lock||d(this).hasClass("active"))return false;
a.cleanTimer();a.slider.css("background",'url("'+a.defs.image.data("iview:image")+'") no-repeat');a.defs.slide=d(this).attr("rel")-1;a.goTo("control")});d(".iview-controlNav",a.sliderContent).css({opacity:a.options.controlNavHoverOpacity});a.sliderContent.hover(function(){d(".iview-controlNav",a.sliderContent).stop().animate({opacity:1},300);a.sliderContent.addClass("iview-hover")},function(){d(".iview-controlNav",a.sliderContent).stop().animate({opacity:a.options.controlNavHoverOpacity},300);a.sliderContent.removeClass("iview-hover")});
var g=null;d(".iview-controlNav a.iview-control",a.sliderContent).hover(function(){var b=d(this),c=b.attr("rel"),f=d("#iview-tooltip",a.sliderContent),e=d("div.holder",f),l=b.offset().left-a.sliderContent.offset().left-f.outerWidth()/2+a.options.tooltipX,b=b.offset().top-a.sliderContent.offset().top-f.outerHeight()+a.options.tooltipY,n=d("div[rel="+c+"]");scrollLeft=c*n.width();f.stop().animate({left:l,top:b,opacity:1},300);f.not(":visible")&&f.fadeIn(300);e.stop().animate({scrollLeft:scrollLeft},
300);clearTimeout(g)},function(){var b=d("#iview-tooltip",a.sliderContent);g=setTimeout(function(){b.animate({opacity:0},300,function(){b.hide()})},200)})}a.sliderContent.bind("mouseover.iView mousemove.iView",function(){a.options.pauseOnHover&&!a.defs.paused&&a.cleanTimer();a.sliderContent.addClass("iview-hover")}).bind("mouseout.iView",function(){a.options.pauseOnHover&&(!a.defs.paused&&a.timer==null&&a.pieDegree<=359&&a.options.autoAdvance)&&a.setTimer();a.sliderContent.removeClass("iview-hover")})},
setCaption:function(){var a=this,b=a.slides.eq(a.defs.slide),c=0;d(".iview-caption",b).each(function(){var b=d(this),e=b.data("transition")?d.trim(b.data("transition").toLowerCase()):"fade",g=b.data("speed")?b.data("speed"):a.options.captionSpeed,k=b.data("easing")?b.data("easing"):a.options.captionEasing,h="undefined"!=b.data("x")?b.data("x"):"center",i="undefined"!=b.data("y")?b.data("y"):"center",j=b.data("width")?b.data("width"):b.width(),l=b.data("height")?b.data("height"):b.height(),n=b.outerWidth(),
o=b.outerHeight();"center"==h&&(h=a.defs.width/2-n/2);"center"==i&&(i=a.defs.height/2-o/2);var m=d(".caption-contain",b);b.css({opacity:0});m.css({opacity:0,position:"relative",width:j,height:l});switch(e){case "wipedown":b.css({top:i-l,left:h});m.css({top:l+3*l,left:0});break;case "wipeup":b.css({top:i+l,left:h});m.css({top:l-3*l,left:0});break;case "wiperight":b.css({top:i,left:h-j});m.css({top:0,left:j+2*j});break;case "wipeleft":b.css({top:i,left:h+j});m.css({top:0,left:j-2*j});break;case "fade":b.css({top:i,
left:h});m.css({top:0,left:0});break;case "expanddown":b.css({top:i,left:h,height:0});m.css({top:l+3*l,left:0});break;case "expandup":b.css({top:i+l,left:h,height:0});m.css({top:l-3*l,left:0});break;case "expandright":b.css({top:i,left:h,width:0});m.css({top:0,left:j+2*j});break;case "expandleft":b.css({top:i,left:h+j,width:0}),m.css({top:0,left:j-2*j})}setTimeout(function(){b.animate({opacity:a.options.captionOpacity,top:i,left:h,width:j,height:l},g,k,function(){})},c);setTimeout(function(){m.animate({opacity:a.options.captionOpacity,
top:0,left:0},g,k)},c+100);c+=250})},processTimer:function(){if("360bar"==this.defs.timer){var a=0==this.pieDegree?0:this.pieDegree+0.9;this.timerPath.attr({arc:[a,this.R]})}else"pie"==this.defs.timer?(a=0==this.pieDegree?0:this.pieDegree+0.9,this.pieTimer.attr({segment:[a,this.R]})):this.barTimer.css({width:100*(this.pieDegree/360)+"%"});this.pieDegree+=3},transitionEnd:function(a){a.options.onAfterChange.call(this);a.defs.lock=!1;a.slides.css("display","none");a.slides.eq(a.defs.slide).show();a.slider.css("background",
'url("'+a.defs.image.data("iview:image")+'") no-repeat');d(".iview-strip, .iview-block",a.slider).remove();a.defs.time=a.defs.image.data("iview:pausetime")?a.defs.image.data("iview:pausetime"):a.options.pauseTime;a.iviewTimer.animate({opacity:a.options.timerOpacity});a.pieDegree=0;a.processTimer();a.setCaption(a.options);null==a.timer&&!a.defs.paused&&(a.timer=setInterval(function(){a.timerCall(a)},a.defs.time/120))},addStrips:function(a,b){for(var b=b?b:this.options,c=0;c').css({width:f,height:e,top:k,left:h,background:'url("'+this.defs.image.data("iview:image")+'") no-repeat '+g,opacity:0});this.slider.append(g)}},addBlocks:function(){for(var a=Math.round(this.slider.width()/
this.options.blockCols),b=Math.round(this.slider.height()/this.options.blockRows),c=0;c').css({width:a+"px",height:b+"px",top:c*b+"px",left:f*a+"px",background:'url("'+this.defs.image.data("iview:image")+'") no-repeat '+e,opacity:0});this.slider.append(e)}},runTransition:function(a){var b=this;switch(a){case "strip-up-right":case "strip-up-left":b.addStrips();
var c=0,f=0,e=d(".iview-strip",b.slider);"strip-up-left"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this);a.css({top:"",bottom:"0px"});setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++})},100+c);c+=50});break;case "strip-down":case "strip-down-right":case "strip-down-left":b.addStrips();var f=c=0,e=d(".iview-strip",b.slider);"strip-down-left"==a&&(e=d(".iview-strip",
b.slider).reverse());e.each(function(){var a=d(this);a.css({bottom:"",top:"0px"});setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++})},100+c);c+=50});break;case "strip-left-right":case "strip-left-right-up":case "strip-left-right-down":b.addStrips(!0);var g=f=c=0,e=d(".iview-strip",b.slider);"strip-left-right-down"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this);
0==f?(a.css({right:"",left:"0px"}),f++):(a.css({left:"",right:"0px"}),f=0);setTimeout(function(){a.animate({width:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){g==b.options.strips-1&&b.transitionEnd(b);g++})},100+c);c+=50});break;case "strip-up-down":case "strip-up-down-right":case "strip-up-down-left":b.addStrips();g=f=c=0;e=d(".iview-strip",b.slider);"strip-up-down-left"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this);0==f?(a.css({bottom:"",
top:"0px"}),f++):(a.css({top:"",bottom:"0px"}),f=0);setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){g==b.options.strips-1&&b.transitionEnd(b);g++})},100+c);c+=50});break;case "left-curtain":case "right-curtain":case "top-curtain":case "bottom-curtain":"left-curtain"==a||"right-curtain"==a?b.addStrips():b.addStrips(!0);f=c=0;e=d(".iview-strip",b.slider);if("right-curtain"==a||"bottom-curtain"==a)e=d(".iview-strip",b.slider).reverse();
e.each(function(){var e=d(this),g=e.width(),h=e.height();"left-curtain"==a||"right-curtain"==a?e.css({top:"0px",height:"100%",width:"0px"}):e.css({left:"0px",height:"0px",width:"100%"});setTimeout(function(){"left-curtain"==a||"right-curtain"==a?e.animate({width:g,opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++}):e.animate({height:h,opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);
f++})},100+c);c+=50});break;case "strip-up-right":case "strip-up-left":b.addStrips();f=c=0;e=d(".iview-strip",b.slider);"strip-up-left"==a&&(e=d(".iview-strip",b.slider).reverse());e.each(function(){var a=d(this);a.css({bottom:"0px"});setTimeout(function(){a.animate({height:"100%",opacity:"1.0"},b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);f++})},100+c);c+=50});break;case "strip-left-fade":case "strip-right-fade":case "strip-top-fade":case "strip-bottom-fade":"strip-left-fade"==
a||"strip-right-fade"==a?b.addStrips():b.addStrips(!0);f=c=0;e=d(".iview-strip",b.slider);if("strip-right-fade"==a||"strip-bottom-fade"==a)e=d(".iview-strip",b.slider).reverse();e.each(function(){var e=d(this),g=e.width(),h=e.height();"strip-left-fade"==a||"strip-right-fade"==a?e.css({top:"0px",height:"100%",width:g}):e.css({left:"0px",height:h,width:"100%"});setTimeout(function(){e.animate({opacity:"1.0"},1.7*b.options.animationSpeed,b.defs.easing,function(){f==b.options.strips-1&&b.transitionEnd(b);
f++})},100+c);c+=35});break;case "slide-in-up":case "slide-in-down":opts={strips:1};b.addStrips(!1,opts);var e=d(".iview-strip:first",b.slider),k=0,k="slide-in-up"==a?"-"+b.defs.height+"px":b.defs.height+"px";e.css({top:k,height:"100%",width:b.defs.width});e.animate({top:"0px",opacity:1},2*b.options.animationSpeed,b.defs.easing,function(){b.transitionEnd(b)});break;case "zigzag-top":case "zigzag-bottom":case "zigzag-grow-top":case "zigzag-grow-bottom":case "zigzag-drop-top":case "zigzag-drop-bottom":b.addBlocks();
for(var h=b.options.blockCols*b.options.blockRows,c=0,i=[],e=d(".iview-block",b.slider),j=0;j=k;n--)i.push(d(e[n]));else for(n=k;nthis.defs.slide&&(this.defs.slide=this.defs.total-1);this.defs.image=this.slides.eq(this.defs.slide);this.options.controlNav&&(d(".iview-controlNav a.iview-control",this.sliderContent).removeClass("active"),d(".iview-controlNav a.iview-control:eq("+this.defs.slide+")",this.sliderContent).addClass("active"));a=this.options.fx;"random"==this.options.fx.toLowerCase()&&(a="left-curtain right-curtain top-curtain bottom-curtain strip-down-right strip-down-left strip-up-right strip-up-left strip-up-down strip-up-down-left strip-left-right strip-left-right-down slide-in-right slide-in-left slide-in-up slide-in-down fade block-random block-fade block-fade-reverse block-expand block-expand-reverse block-expand-random zigzag-top zigzag-bottom zigzag-grow-top zigzag-grow-bottom zigzag-drop-top zigzag-drop-bottom strip-left-fade strip-right-fade strip-top-fade strip-bottom-fade block-drop-random".split(" "),
a=a[Math.floor(Math.random()*(a.length+1))],a==q&&(a="fade"),a=d.trim(a.toLowerCase()));-1!=this.options.fx.indexOf(",")&&(a=this.options.fx.split(","),a=a[Math.floor(Math.random()*a.length)],a==q&&(a="fade"),a=d.trim(a.toLowerCase()));this.defs.image.data("iview:transition")&&(a=this.defs.image.data("iview:transition").split(","),a=a[Math.floor(Math.random()*a.length)],a=d.trim(a.toLowerCase()));this.defs.easing=this.defs.image.data("iview:easing")?this.defs.image.data("iview:easing"):this.options.easing;
this.defs.lock=!0;this.runTransition(a)},playSlider:function(){null==this.timer&&this.defs.paused&&(this.iviewTimer.removeClass("paused").attr("title",this.options.pauseLabel),this.setTimer(),this.defs.paused=!1,this.options.onPlay.call(this))},stopSlider:function(){this.iviewTimer.addClass("paused").attr("title",this.options.playLabel);this.cleanTimer();this.defs.paused=!0;this.options.onPause.call(this)},setTimerPosition:function(){for(var a=this.options.timerPosition.toLowerCase().split("-"),b=
0;bd.event.special.swipe.scrollSupressionThreshold&&a.preventDefault()}}var f=b.originalEvent.touches?
b.originalEvent.touches[0]:b,e={time:(new Date).getTime(),coords:[f.pageX,f.pageY],origin:d(b.target)},g;a.bind(C,c).one(F,function(){a.unbind(C,c);e&&g&&g.time-e.timed.event.special.swipe.horizontalDistanceThreshold&&Math.abs(e.coords[1]-g.coords[1])g.coords[0]?"swipeleft":"swiperight");e=g=q})})}};d.each({swipeleft:"swipe",
swiperight:"swipe"},function(a,b){d.event.special[a]={setup:function(){d(this).bind(b,d.noop)}}})})(jQuery,this);