
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)})}})};function equalHeight(group){var tallest=0;var al='';var i=0;var arrMinHeight=new Array();group.each(function(){arrMinHeight.push($(this).height());var thisHeight=$(this).height();if(thisHeight>tallest){tallest=thisHeight;}});group.each(function(){var pad=tallest-arrMinHeight[i];al+=pad+',';$('.img',this).css('margin-bottom',pad+'px');i++;})
group.height(tallest);}
function columHeight()
{if($("#l_col").height()>$("#r_col").height())
{$("#r_col").height($("#l_col").height());}
if($("#r_col").height()>$("#l_col").height())
{$("#l_col").height($("#r_col").height());}}
$(window).load(function(){$('.towar .img img').each(function(index,domELe){if($(this).width()>150)
{$(this).jScale({w:'150px'});}});if($('.product .image img').width()>150)
{$('.product .image img').jScale({w:'150px'});}
if($('.towar3 .img img').width()>150)
{$('.towar3 .img img').jScale({w:'150px'});}
equalHeight($(".towar"));equalHeight($(".towar3"));columHeight();});