(function($){
	$.fn.extend({
		customStyle : function() {
			if(!$.browser.msie || ($.browser.msie&&$.browser.version>6)) {
				return this.each(function() {
					var _t = this,
						height = 19,
						padding = 3,
						interval = setInterval(function() {
							var select = $(_t).css({
								border : 'none',
								padding: 0,
								position : 'absolute',
								opacity : 0,
								height: height + (2*padding),
								left: 0,
								top: $.browser.webkit && !window.chrome ? 5: 0,
								zIndex : 1
							});
							if (select.height() > 0 && select.width() > 0) {
								var width = select.outerWidth() - (2*padding),
									currentSelected = select.find(':selected'),
									wrapper = $("<span />").css({
											display : 'inline-block',
											position: 'relative',
											height : 15,
											width: select.outerWidth()
										}),
									overlay = $('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner" style="display: block">'+currentSelected.text()+'</span></span>').css({
											display : 'block',
											position : 'absolute',
											left : 0,
											top : 0,
											zIndex : 0,
											width: width,
											paddingRight : padding,
											paddingLeft : padding
										}).click(function() {
											select.focus();
										}),
									inner = overlay.find(".customStyleSelectBoxInner").css({
											height: height,
											lineHeight : height + "px",
											paddingTop : padding,
											paddingBottom : padding,
											paddingLeft : 5
										});
								
								select.wrap(wrapper);
								select.after(overlay);
								select.change(function(){
									inner.text(select.find(':selected').text()).parent().addClass('changed');
								});
								clearInterval(interval);
							}
						}, 100);
				});
			}
		}
	});
})(jQuery);
