"use strict";!function(a){function t(t){var i=a(a(t).parents(".imgfix_wrapper_layer")[0]),s=a(i.parents(".imgfix_top_container")[0]),r=a(t).width(),f=a(t).height(),l=i.width(),d=i.height(),n=l/r,o=r*n,u=f*n;s.data("fix-fixin")?u>d&&(n=d/f,o=r*n,u=f*n):d>u&&(n=d/f,o=r*n,u=f*n);var x=i[0].id;a("#imgfix_img_style_for_"+x).remove();var c="";(null!=s.data("fix-defaults-grayscale")||null!=s.data("fix-defaults-sepia")||null!=s.data("fix-defaults-hue")||null!=s.data("fix-defaults-saturate")||null!=s.data("fix-defaults-invert")||null!=s.data("fix-defaults-brightness")||null!=s.data("fix-defaults-contrast")||null!=s.data("fix-defaults-blur"))&&(c=null!=s.data("fix-defaults-grayscale")?"grayscale("+parseInt(s.data("fix-defaults-grayscale"))+"%) ":"",c+=null!=s.data("fix-defaults-sepia")?"sepia("+parseInt(s.data("fix-defaults-sepia"))+"%) ":"",c+=null!=s.data("fix-defaults-hue")?"hue-rotate("+parseInt(s.data("fix-defaults-hue"))+"deg) ":"",c+=null!=s.data("fix-defaults-saturate")?"saturate("+parseInt(s.data("fix-defaults-saturate"))+"deg) ":"",c+=null!=s.data("fix-defaults-invert")?"invert("+parseInt(s.data("fix-defaults-invert"))+"%) ":"",c+=null!=s.data("fix-defaults-brightness")?"brightness("+parseInt(s.data("fix-defaults-brightness"))+"%) ":"",c+=null!=s.data("fix-defaults-contrast")?"contrast("+parseInt(s.data("fix-defaults-contrast"))+"%) ":"",c+=null!=s.data("fix-defaults-blur")?"blur("+parseInt(s.data("fix-defaults-blur"))+"px) ":""),c&&(c="filter: "+c+"; -webkit-filter: "+c+";");var p="";(null!=s.data("fix-grayscale")||null!=s.data("fix-sepia")||null!=s.data("fix-hue")||null!=s.data("fix-saturate")||null!=s.data("fix-invert")||null!=s.data("fix-brightness")||null!=s.data("fix-contrast")||null!=s.data("fix-blur"))&&(p=null!=s.data("fix-grayscale")?"grayscale("+parseInt(s.data("fix-grayscale"))+"%) ":null!=s.data("fix-defaults-grayscale")?"grayscale("+parseInt(s.data("fix-defaults-grayscale"))+"%) ":"",p+=null!=s.data("fix-sepia")?"sepia("+parseInt(s.data("fix-sepia"))+"%) ":null!=s.data("fix-defaults-sepia")?"sepia("+parseInt(s.data("fix-defaults-sepia"))+"%) ":"",p+=null!=s.data("fix-hue")?"hue-rotate("+parseInt(s.data("fix-hue"))+"deg) ":null!=s.data("fix-defaults-hue")?"hue-rotate("+parseInt(s.data("fix-defaults-hue"))+"deg) ":"",p+=null!=s.data("fix-saturate")?"saturate("+parseInt(s.data("fix-saturate"))+"%) ":null!=s.data("fix-defaults-saturate")?"saturate("+parseInt(s.data("fix-defaults-saturate"))+"%) ":"",p+=null!=s.data("fix-invert")?"invert("+parseInt(s.data("fix-invert"))+"%) ":null!=s.data("fix-defaults-invert")?"invert("+parseInt(s.data("fix-defaults-invert"))+"%) ":"",p+=null!=s.data("fix-brightness")?"brightness("+parseInt(s.data("fix-brightness"))+"%) ":null!=s.data("fix-defaults-brightness")?"brightness("+parseInt(s.data("fix-defaults-brightness"))+"%) ":"",p+=null!=s.data("fix-contrast")?"contrast("+parseInt(s.data("fix-contrast"))+"%) ":null!=s.data("fix-defaults-contrast")?"contrast("+parseInt(s.data("fix-defaults-contrast"))+"%) ":"",p+=null!=s.data("fix-blur")?"blur("+parseInt(s.data("fix-blur"))+"px) ":null!=s.data("fix-defaults-blur")?"blur("+parseInt(s.data("fix-defaults-blur"))+"px) ":""),p&&(p="filter: "+p+" !important; -webkit-filter: "+p+" !important;"),a("head").append('"),e(t)}function e(t){setTimeout(function(){a(t).css({opacity:a(t).data("fix-img-default-opacity")})},1)}function i(t,e){a("#imgfix_cover_slide_for_"+e).remove();var i=a(t).parents(".imgfix_top_container")[0];a(i).off();var r=t.data("slide");switch(s(t),r){case"in-up":case"in-right":case"in-down":case"in-left":case"out-up":case"out-right":case"out-down":case"out-left":t.addClass("imgfix-"+r);break;case"dynamic":t.addClass("imgfix-in-up"),a(i).on("mouseenter",t,function(t){var e=t.data.parents(".imgfix_wrapper_layer")[0].id.split("_")[3],i=a(l.family[e].element);a(this).find(".imgfix_cover_wrapper").removeClass("imgfix-in-up-right"),a(this).find(".imgfix_cover_wrapper").removeClass("imgfix-in-up-left"),a(this).find(".imgfix_cover_wrapper").removeClass("imgfix-in-down-right"),a(this).find(".imgfix_cover_wrapper").removeClass("imgfix-in-down-left");for(var r=0;ra(this).offset().top?d="down":a(f).offset().topa(this).offset().left&&(d="left"),a(f).offset().topa(this).offset().top&&a(f).offset().lefta(this).offset().left?d="down-left":a(f).offset().top>a(this).offset().top&&a(f).offset().left>a(this).offset().left&&(d="up-left"),a(f).find(".imgfix_cover_wrapper").addClass("imgfix-in-"+d),s(a(f).find(".imgfix_cover_wrapper"),"imgfix-in-"+d)}}}),a(i).on("mouseleave",t,function(t){var e=t.data.parents(".imgfix_wrapper_layer")[0].id.split("_")[3],i=a(l.family[e].element);if(!i.find(":hover").length){var r=void 0==t.offsetX?t.pageX-a(this).offset().left:t.offsetX,f=void 0==t.offsetY?t.pageY-a(this).offset().top:t.offsetY,d="";d=f<.1*t.data.height()?"down":f>.9*t.data.height()?"up":r<.1*t.data.width()?"left":"right",t.data.addClass("imgfix-in-"+d),s(t.data,"imgfix-in-"+d)}});break;default:return}a("head").append('")}function s(a,t){"imgfix-in-up"!=t&&a.removeClass("imgfix-in-up"),"imgfix-in-right"!=t&&a.removeClass("imgfix-in-right"),"imgfix-in-down"!=t&&a.removeClass("imgfix-in-down"),"imgfix-in-left"!=t&&a.removeClass("imgfix-in-left"),"imgfix-in-up-left"!=t&&a.removeClass("imgfix-in-up-left"),"imgfix-in-up-right"!=t&&a.removeClass("imgfix-in-up-right"),"imgfix-in-down-left"!=t&&a.removeClass("imgfix-in-down-left"),"imgfix-in-down-right"!=t&&a.removeClass("imgfix-in-down-right"),a.removeClass("imgfix-out-up"),a.removeClass("imgfix-out-right"),a.removeClass("imgfix-out-down"),a.removeClass("imgfix-out-left")}function r(t,e){a("#imgfix_cover_fade_for_"+e).remove();var i=t.data("fade"),s=new Object;switch(i){case"in":s={from:{opacity:0},to:{opacity:1}};break;case"out":s={from:{opacity:1},to:{opacity:0}};break;default:return}a("head").append('")}function f(t,e){a("#imgfix_cover_scale_for_"+e).remove();var i=t.data("scale"),s=new Object;switch(i){case"in":s={from:{scale:0},to:{scale:1}};break;case"out":s={from:{scale:1},to:{scale:0}};break;default:return}a("head").append('")}var l={family:new Array,init:function(e,s){var l=e.parameters?e.parameters:new Object,d=e.element;l.cover||(l.cover={}),l.defaults||(l.defaults={}),l={fixin:l.fixin?1:0,scale:l.scale?l.scale:1,easing:l.easing?l.easing:"",interval:parseInt(l.interval)>=0?l.interval:400,grayscale:parseInt(l.grayscale)>=0?l.grayscale:null,sepia:parseInt(l.sepia)>=0?l.sepia:null,hue:parseInt(l.hue)>=0?l.hue:null,saturate:parseInt(l.saturate)>=0?l.saturate:null,invert:parseInt(l.invert)>=0?l.invert:null,brightness:parseInt(l.brightness)>=0?l.brightness:null,contrast:parseInt(l.contrast)>=0?l.contrast:null,blur:parseInt(l.blur)>=0?l.blur:null,defaults:{scale:l.defaults.scale?l.defaults.scale:1,grayscale:parseInt(l.defaults.grayscale)>=0?l.defaults.grayscale:null,sepia:parseInt(l.defaults.sepia)>=0?l.defaults.sepia:null,hue:parseInt(l.defaults.hue)>=0?l.defaults.hue:null,saturate:parseInt(l.defaults.saturate)>=0?l.defaults.saturate:null,invert:parseInt(l.defaults.invert)>=0?l.defaults.invert:null,brightness:parseInt(l.defaults.brightness)>=0?l.defaults.brightness:null,contrast:parseInt(l.defaults.contrast)>=0?l.defaults.contrast:null,blur:parseInt(l.defaults.blur)>=0?l.defaults.blur:null},width:l.width?l.width:null,height:l.height?l.height:null,protectaspectratio:l.protectaspectratio||l.protectAspectRatio?l.protectaspectratio||l.protectAspectRatio:null,coverclass:l.coverclass||l.coverClass?l.coverclass||l.coverClass:"",cover:{fade:l.cover.fade?l.cover.fade:"none",slide:l.cover.slide?l.cover.slide:"none",scale:l.cover.scale?l.cover.scale:"none",easing:l.cover.easing?l.cover.easing:"",delay:l.cover.delay?l.cover.delay:0,interval:l.cover.interval?l.cover.interval:400}},e.parameters=l,d.css("overflow","hidden");for(var n=0;n1&&(x=parseFloat(x.split("%")[0]),x=x?o.width()*x/100:0),o.height(x)}if(o.data("fix-protect-aspect-ratio"))if(o.data("fix-aspect-ratio"))o.height(o.width()*o.data("fix-aspect-ratio"));else{var x=o.height(),c=o.width(),p=c?x/c:0;o.data("fix-aspect-ratio",p)}}if("static"==o.css("position")&&o.css("position","relative"),u){0==o.find("img").length?o.append(''):a(o.find("img")[0]).addClass("imgfix_src_img");for(var g=o.find("img"),v=0;v'),t(a("#imgfix_wrapper_layer_"+e.id+"_"+n+" .imgfix_src_img")[0]),u&&a("#imgfix_wrapper_layer_"+e.id+"_"+n+" .imgfix_src_img").load(function(){t(this)}),o.data("fix-cover")){var h;h=o.data("fix-cover").split(".").length>1||o.data("fix-cover").split("#").length>1?o.data("fix-cover"):"."+o.data("fix-cover"),u&&o.find(h).wrap('');var m=o.find(".imgfix_cover_wrapper");m.css({width:a(o.find(".imgfix_wrapper_layer")[0]).width()+"px",height:a(o.find(".imgfix_wrapper_layer")[0]).height()+"px"}),m.data("slide",o.data("fix-cover-slide")),m.data("fade",o.data("fix-cover-fade")),m.data("scale",o.data("fix-cover-scale")),m.data("easing",o.data("fix-cover-easing")),m.data("delay",o.data("fix-cover-delay")),m.data("interval",o.data("fix-cover-interval"));var _=m.parents(".imgfix_wrapper_layer")[0].id;a("#imgfix_cover_transitions_for_"+_).remove(),"none"!=m.data("slide")||"none"!=m.data("fade")||"none"!=m.data("scale")?(a("head").append('"),i(m,_),r(m,_),f(m,_)):a("head").append('")}}}};a.fn.imgfix=function(t){for(var e=-1,i=!1,s=0;se&&(l.family.push(new Object),e=l.family.length-1),l.family[e]={id:e,element:this,parameters:t},l.init(l.family[e],i),a(window).resize(function(){l.init(l.family[e],!0)})},a.fn.imgfixRefresh=function(){for(var t=a(this).find(".imgfix_wrapper_layer"),e=new Array,i=0;i