/* jQMinMax v0.1 - Copyright (c) 2006 Dave Cardwell (http://davecardwell.co.uk/)
   Modified and compressed using http://jscompress.com/ */
new function(){$.minmax={active:false,native:false};$(document).ready(function(){return;var test=document.createElement('div');$(test).css({'width':'1px','min-width':'2px'});$('body').append(test);$.minmax.native=(test.offsetWidth&&test.offsetWidth==2);$(test).remove();if($.minmax.native)
return;$.minmax.active=true;$.minmax.expressions();$(':minmax').minmax();});$.minmax.expressions=function(){var p=new Array('min-width','min-height','max-width','max-height');var minmax=new Array();for(var i=0;i<p.length;i++){var expr="$.css(a,'"+p[i]+"')!='0px'&&"
+"$.css(a,'"+p[i]+"')!='auto'&&"
+"$.css(a,'"+p[i]+"')!=window.undefined";if(p[i].charAt(2)=='x')
expr+="&&$.css(a,'"+p[i]+"')!='none'";$.expr[':'][p[i]]=expr;minmax[i]='('+expr+')';}
$.expr[':']['minmax']=minmax.join('||');};$.fn.minmax=function(){return $(this).each(function(){var constraint={'min-width':calculate(this,'min-width'),'max-width':calculate(this,'max-width'),'min-height':calculate(this,'min-height'),'max-height':calculate(this,'max-height')};var width=this.offsetWidth;var height=this.offsetHeight;var newWidth=width;var newHeight=height;if(constraint['max-width']!=window.undefined&&newWidth>constraint['max-width'])
newWidth=constraint['max-width'];if(constraint['min-width']!=window.undefined&&newWidth<constraint['min-width'])
newWidth=constraint['min-width'];if(constraint['max-height']!=window.undefined&&newHeight>constraint['max-height'])
newHeight=constraint['max-height'];if(constraint['min-height']!=window.undefined&&newHeight<constraint['min-height'])
newHeight=constraint['min-height'];if(newWidth!=width)
$(this).css('width',newWidth);if(newHeight!=height)
$(this).css('height',newHeight);});};function calculate(obj,p){var raw=$(obj).css(p);if(raw==window.undefined||raw=='auto')
return window.undefined;var result;result=raw.match(/^\+?(\d*(?:\.\d+)?)%$/);if(result){return Math.round(Number((/width$/.test(p)?$(obj).parent().get(0).offsetWidth:$(obj).parent().get(0).offsetHeight)*result[1]/100));}
result=raw.match(/^\+?(\d*(?:\.\d+)?)(?:px)?$/);if(result){return Number(result[1]);}
return window.undefined;}}();

