$.fn.customSelect = function() {
    // define defaults and override with options, if available
    // by extending the default settings, we don't modify the argument
    return this.each(function() { if(!this.customize){
        var obj = $(this), node = this,
        opts=obj.after("<div class=\"selectoptions\"> </div>"),
        selectoptions = opts.get(0).nextSibling;
        this.customize = 1;
        obj.find('option').each(function(i){
            $(selectoptions).append("<div id=\"" + $(this).attr("value") + "\" class=\"selectitems\"><span class=\"option_"+i+"\">" + $(this).html() + "</span></div>");
        });
        obj.before("<input type=\"hidden\" value =\"\" name=\"" + this.name + "\" class=\"manufacturers_id\"/><div class=\"iconselect\">" + (this.title || this.options[this.options.selectedIndex].text ) + "</div><div class=\"iconselectholder\"> </div>");
        var iconselect = this.previousSibling.previousSibling,
		iconselectholder = this.previousSibling;
		this.style.display = 'none';
        $(iconselect).click(function(){
            $(iconselectholder).toggle("slow");
        });
        $(iconselectholder).append( $(selectoptions)[0] );
        $(".selectitems").mouseover(function(){
            $(this).addClass("hoverclass");
        });
        $(".selectitems").mouseout(function(){
            $(this).removeClass("hoverclass");
        });
        $(document).click(
			function(e){
				e=e||event;
				var targ=e.target||e.srcElement;
				//if(targ && targ.className!=="iconselect"){$('.iconselectholder').hide("slow")}	
			    $('.iconselectholder').hide()
			}
		);
        $(".selectitems").click(function(){
            $(".selectedclass").removeClass("selectedclass");
            $(this).addClass("selectedclass");
            var thisselection = $(this).html();
            $(".manufacturers_id").val(this.id);
            $(iconselect).html(thisselection);
            $(iconselectholder).show("slow");
            if(node.onchange || node.getAttribute('onchange') || node.onChange || node.getAttribute('onChange')){
				node.options.selectedIndex = this.firstChild.className.substr(7)*1	
			    node.onchange()
			}
			else{
			   document.location= "/index.php/manufacturers_id/" + this.id
			}
        });
    }});  
// do the rest of the plugin, using url and settings
}

