
function openSelect(t,n){
	if (n.next('div.unique_select_list').visible()){
		n.next('div.unique_select_list').hide();
	}else{
		n.next('div.unique_select_list').show();
	}
}


function initUniqueSelects(){
	var selects = Element.select(document,'.unique_select');

	for (var x=0,node; node=selects[x++];){
		//alert(node.offsetTop);
		node.next('div.unique_select_list').setStyle({ top: node.offsetTop+'px', left: node.offsetLeft+'px'});
		Event.stopObserving($(node),'click');
		Event.observe($(node),'click',openSelect.bindAsEventListener(this,node));
		
		var lis = node.next('div.unique_select_list').select('li');
		for (var y=0,linode; linode = lis[y++];){
			Event.stopObserving($(linode),'mouseover');
			Event.observe($(linode),'mouseover',function(e){
				this.addClassName('hover');
			});
			Event.stopObserving($(linode),'mouseout');
			Event.observe($(linode),'mouseout',function(e){
				this.removeClassName('hover');
			});
		}
	}
	
}

function uniqueSelect(link,value){
	$(link).up('div.unique_select_list').previous('div.unique_select').update(link.innerHTML);
	$(link).up('div.unique_select_list').previous('input.unique_select_value').value = value;
	$(link).up('div.unique_select_list').hide();
	
	
}
