(function($){ 
jQuery.fn.hackSelectedWidthInIE = function() {
    return this.each(function(){
        
        if($.browser.msie && this.tagName.toLowerCase() == "select")
        {
            var select = $(this);
            var parent = select.parent();
            var selectBox = document.createElement("div");
            var selectWidth = select.width();
            
            $(selectBox)
                .css("position", "relative")
                .css("text-align", "center")
                .css("display", "inline");
            
            select
                .wrap(selectBox)
                .mouseover(function(){                        
                    showSelect(select, selectBox);
                    select
                        .bind("click", function(){
                            showSelect(select, selectBox);
                            select.unbind("mouseout");                            
                        })
                        .bind("mouseout", function(){
                            hideSelect(select, selectBox, selectWidth);
                        });                     
                })                   
                .blur(function(){
                    hideSelect(select, selectBox, selectWidth);
                    select.bind("click", function(){
                        showSelect(select, selectBox);
                    });
                })
                .change(function(){
                    hideSelect(select, selectBox, selectWidth);
                    select.unbind("click");
                });
        }
    });
    
    function showSelect(select, selectBox){
        if(select.css("width") != "auto")
        {
            $(selectBox)
                .css("display", "inline")
                .css("position", "relative");
	        select
                .css("position", "relative")
                .css("top", 0)
                .css("left", 0)
                .css("width", "auto");
        }
    }
    
    function hideSelect(select, selectBox, selectWidth){
        $(selectBox)
            .css("display", "inline")
            .css("width", selectWidth + "px")
            .css("position", "relative");
        select
            .css("position", "relative")
            .css("top", 0)
            .css("left", 0)
            .css("width", selectWidth + "px");
    }
}
})(jQuery); 

