(function($) {
	
	$(function() {
		$('.oi-select').oiSelect();
	});
	
	$.fn.oiSelect = function() {
		
		return this.each(function() {
		
			var $obj = $(this);
			
			$obj.wrap('<span class="oi-select-wrapper"><\/span>');
			
			var $wrapper = $obj.parent();
			
			$wrapper.css({
				position: 'relative'
			});

			$wrapper.prepend('<span class="oi-select-text"><\/span>');
			var $text = $wrapper.children('.oi-select-text');
						
			$text.html(this.options[this.selectedIndex].innerHTML);
			
			$obj.css({
				opacity: 0
			});
			
			$obj
			.change(function() {
				$text.html(this.options[this.selectedIndex].innerHTML);
			})
			.keyup(function() {
				$text.html(this.options[this.selectedIndex].innerHTML);
			});
			
			
		});
		
	}
	
	
})(jQuery);