$.fn.form = function() {
	
	$("select", this).each(function() {
		
		list = '';
		for(var i = 0; i < $("option", this).size(); i++) {
			list += '<li';
			if(i == 0)
				list += ' class="active"';
			list += '>' + $("option:eq(" + i + ")", this).text(); + '</li>';
		}
		
		$(this).css("position", "absolute").css("left", "-99999px")
			.before('<span class="select"><span class="con">' + $(":selected", this).text() + '</span><span class="arrow"></span><ul>' + list + '</ul></span>')
			.prev().each(function() {
			
				$("ul", this).css("width", 10000);
				
				heighest = 0;
				$("li", this).each(function() {
					
					$(this).css("float", "left");
					width = $(this).width();
					if(width > heighest)
						heighest = width;
					
					$(this).css("float", "none");
				
				});
				
				if(heighest < 153)
					heighest = 153;
				
				$("ul", this).css("width", heighest + 20);
				$("li", this).each(function() {
					
					$(this).css("width", heighest);
				
				});
			
			}).click(function() {
			
			$(".select ul:visible").slideUp(300, function() { $(this).parent().css("z-index", 2); }).css("z-index", 2);
			$(document).click(function() {
				
				$(".select ul:visible").slideUp(300, function() { $(this).parent().css("z-index", 2); }).css("z-index", 2);
				$(this).unbind("click");
				
			});
			
			if($("ul:visible", this).size()) {
				
				$("ul", this).slideUp(300, function() { $(this).parent().css("z-index", 2); });
			
			}
			else {
				
				$(this).css("z-index", 4).next().focus();
				$("ul", this).slideDown(300, function() { $(this).parent().css("z-index", 3); }).css("z-index", 3).find(">li").unbind("click").click(function() {
					$(this).parent().find("li").removeClass("active");
					$(this).addClass("active");
					width = $(this).width();
					$(this).removeClass("hover");
					list = $(this).parent().parent();
					list.next().find("option:eq(" + $(this).parent().find(">li").index(this) + ")").attr("selected", true);
					list.html('<span class="con">' + list.next().find(":selected").text() + '</span><span class="arrow"></span><ul>' + $(this).parent().html() + '</ul>').find(">ul").css("width", width + 20).slideUp(300, function() { $(this).parent().css("z-index", 2); }).css("z-index", 2);
					return false;
				}).unbind("hover").hover(function() {
					$(this).addClass("hover");
				}, function() {
					$(this).removeClass("hover");
				});
			
			}
			
			return false;
		
		}).find("ul").hide();
		
		$(this).focus(function() {
			
			$(this).prev().addClass("select-active");
			
		}).blur(function() {
		
			$(this).prev().removeClass("select-active");
		
		});
	
	});
	
}
