Proto.UI.select2href=Class.create({
	index:0,
    initialize: function() 
    {
    
    this.options = Object.extend({
            className:'ProtoSelect2href',
            element:false
            }, arguments[0] || { });
     	this.data=[];
     	this.element=_(this.options.element);
      try{
      var cntr=0;
      Element.select(this.element,'option').each(function(o){
      if(o.tagName=="OPTION"){
      if(o.selected){this.index=cntr;}
      	cntr++;
		      	this.data.push({
		      		value:o.value,
		      		text:o.innerHTML
		      	});}
      	}.bind(this));
      	}catch(er){ alert(er.message);}
      	
      	this.input = new Element("input",{type:'hidden',name:this.element.name,id:this.element.id});
      	this.element.parentNode.insertBefore(this.input,this.element);
      	this.href = new Element("a",{href:'#','class':this.options.className});
      	this.element.parentNode.insertBefore(this.href,this.element);
      	this.href.observe("click",function(e){Event.stop(e);this.change();}.bind(this));
      	Element.remove(this.element);
      	this.change();
      
     },
     change:function()
     {
     	this.href.update(this.data[this.index].text);
     	this.input.value=this.data[this.index].value;
     	this.index++;
     	if(this.index>=this.data.length){this.index=0;}
     }            
});