/*! jqthumb v1.9.5 copyright (c) 2013-2014 dual licensed under the mit and gpl licenses. author : pak cheong version : 1.9.5 last updated : thursday, july 10th, 2014, 5:18:48 pm requirements : jquery >=v1.3.0 or zepto (with zepto-data plugin) >=v1.0.0 */ !function(a,b,c){function d(b,c){this.element=b,this.settings=a.extend({},g,c),this.settings.width=this.settings.width.tostring().replace(/px/g,""),this.settings.height=this.settings.height.tostring().replace(/px/g,""),this.settings.position.top=this.settings.position.top.tostring().replace(/px/g,""),this.settings.position.left=this.settings.position.left.tostring().replace(/px/g,""),this._defaults=g,this._name=e,"string"==typeof c?"kill"==c.tolowercase()&&this.kill(this.element):this.init()}var e="jqthumb",f={outputelems:[],inputelems:[]},g={classname:"jqthumb",width:100,height:100,position:{top:"50%",left:"50%"},source:"src",showoncomplete:!0,before:function(){},after:function(){},done:function(){}};d.prototype={init:function(){this.support_css3_attr("backgroundsize")===!1?this.noncss3supported_method(this.element,this.settings):this.css3supported_method(this.element,this.settings)},kill:function(b){if(a(b).data(e)){if(a(b).prev().data(e)!==e)return console.error("we could not find the element created by jqthumb. it is probably due to one or more element has been added right before the image element after the plugin initialization, or it was removed."),!1;var c=[];a.each(f.outputelems,function(d,e){a(e)[0]==a(b).prev()[0]||c.push(f.outputelems[d])}),f.outputelems=c,c=[],a.each(f.inputelems,function(d,e){a(e)[0]==a(b)[0]||c.push(f.inputelems[d])}),f.inputelems=c,a(b).prev().remove(),a(b).removeattr("style"),"undefined"!=typeof a(b).data(e+"-original-styles")&&a(b).attr("style",a(b).data(e+"-original-styles")),"undefined"!=typeof a(b).data(e+"-original-styles")&&a(b).removedata(e+"-original-styles"),"undefined"!=typeof a(b).data(e)&&a(b).removedata(e)}},noncss3supported_method:function(b,c){c.before.call(b,b);var d=this,f=a(b);f.data(e+"-original-styles",f.attr("style")),f.hide();var g=a("");g.bind("load",function(){var h={obj:g,size:{width:this.width,height:this.height}},i=d.percentorpixel(c.width),j=d.percentorpixel(c.height),k=a("
"),l=0;a(k).insertbefore(f).append(a(h.obj)).css({position:"relative",overflow:"hidden",width:"%"==i?c.width:c.width+"px",height:"%"==j?c.height:c.height+"px"}).data(e,e),h.size.width>h.size.height?(a(h.obj).css({width:"auto","max-height":99999999,"min-height":0,"max-width":99999999,"min-width":0,height:a(h.obj).parent().height()+"px"}),l=a(h.obj).height()/a(h.obj).width(),a(h.obj).width()").attr("src",f.attr(c.source));f.data(e+"-original-styles",f.attr("style")),f.hide(),a.each(g,function(g,h){var i=a(h);i.one("load",function(){var g=d.percentorpixel(c.width),h=d.percentorpixel(c.height),i=null,j=null;i=a("
").css({width:"%"==g?c.width:c.width+"px",height:"%"==h?c.height:c.height+"px",display:"none"}).addclass(c.classname).data(e,e),j=a("
").css({width:"100%",height:"100%","background-image":'url("'+f.attr(c.source)+'")',"background-repeat":"no-repeat","background-position":function(){var a="%"==d.percentorpixel(c.position.top)?c.position.top:c.position.top+"px",b="%"==d.percentorpixel(c.position.left)?c.position.left:c.position.left+"px";return a+" "+b}(),"background-size":"cover"}).appendto(a(i)),a(i).insertbefore(a(b)),c.showoncomplete===!0&&a(i).show(),d.checksrcattrname(b,c),c.after.call(b,a(i)),d.updateglobal(b,a(i),c)})})},updateglobal:function(b,c,d){b.global.outputelems.push(a(c)[0]),b.global.elemcounter++,f.outputelems.push(a(c)[0]),b.global.elemcounter==b.global.inputelems.length&&d.done.call(b,b.global.outputelems)},checksrcattrname:function(b,c){"src"==c.source||"undefined"!=typeof a(b).attr("src")&&""!==a(b).attr("src")||a(b).attr("src",a(b).attr(c.source))},percentorpixel:function(a){return a=a.tostring(),a.match("px$")||a.match("px$")||a.match("px$")||a.match("px$")?"px":a.match("%$")?"%":void 0},support_css3_attr:function(){{var a=c.createelement("div"),b="khtml ms o moz webkit".split(" ");b.length}return function(c){if(c in a.style)return!0;for(c=c.replace(/^[a-z]/,function(a){return a.touppercase()}),i=0;if;f++)e.push(c.get(f));return e}(a(this))};return obj={},obj[e]=function(b){return"undefined"==typeof b?void console.error('please specify an action like $.jqthumb("killall")'):(b=b.tolowercase(),void("killall"==b&&a.each(f.inputelems,function(){new d(this,"kill")})))},a.extend(a,obj),this.each(function(){var g=a(this);this.global=c,f.inputelems.push(g),"string"==typeof b?new d(this,b):g.data(e)?(new d(this,"kill"),g.data(e,new d(this,b))):g.data(e,new d(this,b))})}}(window.jquery||window.zepto,window,document);