jQuery.fn.customSelect = function() {
	return this.each(function() {  
		obj = jQuery(this);  
		obj.after("<div id=\"selectoptions\"> </div>");
		obj.find('option').each(function(i){ 
			//var str = "<span style='background:url(" + this.title + ") no-repeat left center;'>" + jQuery(this).html() + "</span>";
			var str = "<span>" + jQuery(this).html() + "</span>";
			if (jQuery(this)[0].selected != false) obj.selectedItem = str;
			jQuery("#selectoptions").append("<div id=\"" + jQuery(this).attr("value") + "\" class=\"selectitems\">"+str+"</div>");
		});
		obj.before("<input type=\"hidden\" value =\"\" name=\"" + this.name + "\" class=\"customselect\"/><div id=\"iconselect\">" + this.str + "</div><div id=\"iconselectholder\"> </div>").remove();
		jQuery("#iconselect").html(obj.selectedItem);
		jQuery("#iconselect").click(function(){
			jQuery("#iconselectholder").toggle();
		});
		//alert(jQuery("#selectoptions")[0].innerHTML);
		jQuery("#iconselectholder").append( jQuery("#selectoptions")[0] );

		jQuery(".selectitems").mouseover(function(){
			jQuery(this).addClass("hoverclass");
		});

		jQuery(".selectitems").mouseout(function(){
			jQuery(this).removeClass("hoverclass");
		});

		jQuery(".selectitems").click(function(){
			jQuery(".selectedclass").removeClass("selectedclass");
			jQuery(this).addClass("selectedclass");
			var thisselection = jQuery(this).html();
			location.href = this.id;
			jQuery(".customselect").val(this.id);
			jQuery("#iconselect").html(thisselection);
			jQuery("#iconselectholder").toggle();
		});
    });  
}

