$.fn.customSelect = function() {
	return this.each( function() {
		obj = $(this);
		var idcontenedor = this.id;
        //alert(this.id)
		obj.after("<div id=\"selectoptions" + idcontenedor + "\"> </div>");
		
		obj.find('option').each(function(i){ 
			$("#selectoptions" + idcontenedor).append("<div id=\"" + $(this).attr("value") + "\" class=\"selectitems" + idcontenedor +"\"><span>" + $(this).html() + "</span></div>");
		});
        
		obj.before("<div id=\"iconselect" + idcontenedor + "\" class=\"iconselect\">" + this.title + "</div>"
				+"<div id=\"iconselectholder" + idcontenedor + "\" class=\"iconselectholder\"> </div>"
                + "<input type=\"hidden\" value =\"\" id=\"customselect" + idcontenedor + "\" value=0 name=\"customselect" + idcontenedor + "\"/>").remove();
		
		
		$("#iconselect" + idcontenedor).click( function() {
			$("#iconselectholder" + idcontenedor).toggle("slow");
		});
		$("#iconselectholder" + idcontenedor).append($("#selectoptions" + idcontenedor)[0]);
		$(".selectitems" + idcontenedor).mouseover( function() {
			$(this).addClass("hoverclass");
		});
		$(".selectitems" + idcontenedor).mouseout( function() {
			$(this).removeClass("hoverclass");
		});
		$(".selectitems" + idcontenedor).click( function() {
			$(".selectedclass").removeClass("selectedclass");
			$(this).addClass("selectedclass");
			var thisselection = $(this).html();
            //alert(this.id)        
			$("#customselect" + idcontenedor).val(this.id);
            //alert("#customselect" + idcontenedor)
			$("#iconselect"+idcontenedor).html(thisselection);
            if(idcontenedor=='tipo')
            {
			    $("#iconselectholder"+idcontenedor).toggle("slow",function(){
                ObtenerLimitePaginas()
                })
            }
            else
            {
                $("#iconselectholder"+idcontenedor).toggle("slow")
            }
		});
	});
	// do the rest of the plugin, using url and settings
}
