jQuery.jScale={getnewSize:function(b,a){var c=b=="w"?"h":"w";if(typeof a=="undefined"||a==null)var d=this.ndimensions[c]*this.odimensions[b]/this.odimensions[c];else var d=/%/.test(a)?parseInt(a)/100*this.odimensions[b]:parseInt(a);this.ndimensions[b]=Math.round(d)},getnewDimensions:function(e,c,a,h){var d=e('<img src="'+c.src+'" style="position:absolute; top:0; left:0; visibility:hidden" />').prependTo("body");this.odimensions={w:d.width(),h:d.height()};var g=this.odimensions.w>this.odimensions.h?["w","h"]:["h","w"];this.ndimensions={};if(typeof a.ls!="undefined"){a[g[0]]=a.ls;a[g[1]]=null}var b=a.w?["w","h"]:a.h?["h","w"]:[];if(b.length>0){this.getnewSize(b[0],a[b[0]]);this.getnewSize(b[1],a[b[1]]);var f=h||function(){};if(a.speed>0)e(c).animate({width:this.ndimensions.w+"px",height:this.ndimensions.h+"px"},a.speed,f);else{e(c).css({width:this.ndimensions.w+"px",height:this.ndimensions.h+"px"});f.call(c)}}d.remove()}};jQuery.fn.jScale=function(a,b){return this.each(function(){var c=this;if(typeof a=="undefined"||c.tagName!="IMG")return true;if(c.complete)jQuery.jScale.getnewDimensions(jQuery,c,a,b);else $(this).bind("load",function(){jQuery.jScale.getnewDimensions(jQuery,c,a,b)})})}
