(function($){
 $.fn.extend({
 
 	customStyle : function(options) {
	  if(!$.browser.msie || ($.browser.msie&&$.browser.version>6)){
	  return this.each(function() {
	  
			var currentSelected = $(this).find('option:selected');
			$(this).after('<div class="customStyleSelectBox"><div class="customStyleSelectBoxInner">'+currentSelected.text()+'</div></div>').css({position:'absolute', opacity:0,fontSize:$(this).next().css('font-size')});
			var selectBoxdiv = $(this).next();
			var selectBoxWidth = parseInt($(this).width()) - parseInt(selectBoxdiv.css('padding-left')) -parseInt(selectBoxdiv.css('padding-right'));		
			//alert ($(this).width());
			var selectBoxdivInner = selectBoxdiv.find(':first-child');
			
		
			var lol = $(this).attr("class");
			//alert (lol);
			
			if (lol == "type_lengte styled_lengte") { 
			
				//alert ("jaaaaah"); 
				selectBoxdiv.css({width:60, display:'inline-block'});
				selectBoxdivInner.css({display:'inline-block'});
			
			} else {
				
				selectBoxdiv.css({display:'inline-block'});
				selectBoxdivInner.css({display:'inline-block'});
			
			}
	
			
			
			
			
			
			var selectBoxHeight = parseInt(selectBoxdiv.height()) + parseInt(selectBoxdiv.css('padding-top')) + parseInt(selectBoxdiv.css('padding-bottom'));
			$(this).height(selectBoxHeight).change(function(){
			
				//selectBoxdivInner.text($(this).val()).parent().addClass('changed');
			
				var selected = $(this).find('option:selected').text();
				selectBoxdivInner.text(selected).parent().addClass('changed');
		
			
		
			});
			
	  });
	  }
	}
 });
})(jQuery);



$(function(){

$('select.styled').customStyle();
$('select.styled_lengte').customStyle();

});

