/* jScale Image Scaler v1.01 Author: JavaScript Kit at http://www.javascriptkit.com */jQuery.jScale={getnewSize:function(side,nvalue){var otherside=side=="w"?"h":"w";if(typeof nvalue=="undefined"||nvalue==null)var newSize=this.ndimensions[otherside]*this.odimensions[side]/this.odimensions[otherside];else var newSize=/%/.test(nvalue)?parseInt(nvalue)/100*this.odimensions[side]:parseInt(nvalue);this.ndimensions[side]=Math.round(newSize)},getnewDimensions:function($,imgref,setting,callback){var $tempimg=$('<img src="'+imgref.src+'" style="position:absolute; top:0; left:0; visibility:hidden" />').prependTo("body");
this.odimensions={w:$tempimg.width(),h:$tempimg.height()};var sortbysize=this.odimensions.w>this.odimensions.h?["w","h"]:["h","w"];this.ndimensions={};if(typeof setting.ls!="undefined"){setting[sortbysize[0]]=setting.ls;setting[sortbysize[1]]=null}var sortbyavail=setting.w?["w","h"]:setting.h?["h","w"]:[];if(sortbyavail.length>0){this.getnewSize(sortbyavail[0],setting[sortbyavail[0]]);this.getnewSize(sortbyavail[1],setting[sortbyavail[1]]);var callbackfunc=callback||function(){};if(setting.speed>
0)$(imgref).animate({width:this.ndimensions.w+"px",height:this.ndimensions.h+"px"},setting.speed,callbackfunc);else{$(imgref).css({width:this.ndimensions.w+"px",height:this.ndimensions.h+"px"});callbackfunc.call(imgref)}}$tempimg.remove()}};
jQuery.fn.jScale=function(setting,callback){return this.each(function(){var imgref=this;if(typeof setting=="undefined"||imgref.tagName!="IMG")return true;if(imgref.complete)jQuery.jScale.getnewDimensions(jQuery,imgref,setting,callback);else $(this).bind("load",function(){jQuery.jScale.getnewDimensions(jQuery,imgref,setting,callback)})})}; 
