/*
 * 	Simple JavaScript Library
 *  (c) 2007 Simple Adaptation
 *  
 *  Author: Michael Duff, Simple Adaptation
 *  AutoClearInput.js, version .8.3
 *
/*-------------------------------------------------------------------*/

var AutoSelectToLink = new Class({
						 
	initialize: function(className) {
		this.className = className;
		var actionItems = $$('.'+this.className);
		
		$each(actionItems, function(el){
			this._createSpan(el); 
			el.setStyle('display', 'none');
		}, this);
		
	},
	
	_swapSelect: function(event, el) {
		var tmpSpan = $(el.id + '-span');
		tmpSpan.setStyle('display', 'none');
		el.setStyle('display', 'inline');
	},
	
	_createSpan: function(el) {
		var text = el.options[el.selectedIndex].text;
		var span = new Element('span').injectAfter(el);
		var a = new Element('a').appendText(text).injectInside(span);
		a.href = 'javascript:void(0);';
		span.id = el.id + '-span';
		span.addClass(el.id+'-span');
		
		a.addEvent('click', this._swapSelect.bindWithEvent(this, el));
		
	},
	
	blank: function() {} /* just so as I add more i dont have to do commas */					 

});