var selector = new Class({
	Implements:[Options, Events],
	Binds:[],
	options:{
		trigger:null,
		close:null,
		hid:null,
		controlClass:"selectClass"
	},
	initialize:function(options){
		this.setOptions(options);
		this.build();
	},
	build:function(){
		this.trigger = $(this.options.trigger);
		this.close = $(this.options.close);
		this.hid = $(this.options.hid);
		this.alist = this.close.getElements("a");
		this.trigger.addEvent('click', this.openSelect.bind(this));
		this.close.addEvent('mouseleave',this.closeSelect.bind(this));
		this.iteration();
	},
	openSelect:function(){
		this.close.removeClass(this.options.controlClass);
	},
	closeSelect:function(){
		this.close.addClass(this.options.controlClass);
	},
	update:function(hval,val,rval){
		this.trigger.value = val;
		if(this.request){this.request.value = (rval?rval:"")};
		if(this.hid){this.hid.value = hval;}
	},
	iteration:function(){
		var _this = this;
		this.alist.each(function(item){
			item.addEvent("click",function(event){
				if($chk(this.get('rel'))){
					event.preventDefault();
					_this.closeSelect();
					_this.update(this.get("rel"),this.get("text"),this.get("id"));
				}
			});
		});
	}
});

var DefaultValue = new Class({
	initialize: function(el, disp){
		$(el).value = disp;
		$(el).addEvents({
			'blur':function(){
				if(this.value.trim() == "") this.value = disp;
			},
			'focus':function(){
				if(this.value.trim() == disp) this.value="";
			}
		});
	}
});