(function($){
	$.fn.extend({
	
		selecteSizer: function(){
			$(this).each(function(i){
				var $select = $(this);
				var selectStyle = null;
				var selectWidth = $select.width();
				
				$select.mouseenter(function(){
					selectStyle = $select.attr('style');
					var offset = $select.offset();
					$select.attr('style', 'position: absolute;');
					$select.width('auto');
					if ($select.width() < selectWidth)
						$select.width(selectWidth);
				});
				
				var select_leave = function()
				{
					$select.noHide = false;
					$select.attr('style', 'position: static; top: 0; left: 0;');
					$select.attr('style', selectStyle);
					$select.width(selectWidth);
				}
				
				$select.click(function(){
					$select.noHide = !$select.noHide;
				});
				$select.change(function(){
					$select.noHide = true;
				});
				$select.mouseleave(function(){ 
					if (!$select.noHide)
						select_leave();
				});
				$select.blur(select_leave);
				
			});
		}
	
	});
})(jQuery);

/*jQuery.fn.selecteSizer=function(C,E){var D={floatIndex:777,width:"auto",position:{type:"absolute",topOffset:0,leftOffset:0},callback:null};if(C){jQuery.extend(D,C)}var A=this;var B=0;this.each(function(){jQueryChild=jQuery(this);if(jQueryChild.attr("style")){jQueryChild.attr("ostyle",jQueryChild.attr("style"))}else{jQueryChild.attr("ostyle"," ")}jQueryChild.focus(function(){var G=jQuery(this).offset().top;var I=jQuery(this).offset().left;if(F(this)){G=jQuery(this).position().top;I=jQuery(this).position().left}var H=jQuery(this).css("margin");if(H){H="margin:"+H}else{H=""}jQuery(this).after("<select id='selectGhost' class='"+jQuery(this).attr("class")+"' style='"+H+";"+jQuery(this).attr("ostyle")+"; width:"+(jQuery(this).outerWidth())+"px;visibility:hidden'><option>&nbsp;</option></select>");jQuery(this).change();jQuery(this).css({width:D.width,position:D.position.type,top:G+D.position.topOffset,left:I+D.position.leftOffset,zIndex:D.floatIndex});if(jQuery(this).next("#selectGhost:first").width()>jQuery(this).width()){jQuery(this).attr("style",jQuery(this).attr("ostyle"));jQuery(this).next("#selectGhost:first").remove()}jQuery(this).trigger("mousedown")});jQueryChild.blur(function(){jQuery(this).next("#selectGhost:first").remove();jQuery(this).attr("style",jQuery(this).attr("ostyle"))});function F(G){var H=G;while(H.parentNode){if(jQuery(H).css("position")=="relative"||jQuery(H).css("position")=="absolute"){return true;break}H=H.parentNode}return false}if(D.callback!=null){D.callback(this)}B++});if(E!=null){E(A)}return jQuery(this)};if(console==undefined){var console={log:function(A){alert(A)}}};*/
