// JavaScript Document
Event.observe(document,'dom:loaded',init_dropdown);

function init_dropdown() {	
	$('dropdown_choice_arrow').observe('click',	dropdown_showlist.bindAsEventListener($('dropdown_choice_options')));
	$('dropdown_choice_selection').observe('click',	dropdown_showlist.bindAsEventListener($('dropdown_choice_options')));
	document.observe('click', dropdown_hidelist.bindAsEventListener($('dropdown_choice_options')));
	$$('.dropdown_choice').each( function (n) { 
		n.observe('mouseover', dropdown_mover.bindAsEventListener(n)); 
		n.observe('mouseout', dropdown_mout.bindAsEventListener(n)); 
		n.observe('click', dropdown_click.bindAsEventListener(n)); 
	} );
}

function dropdown_showlist(event) {
	if (this.getStyle('display') != 'block' ) { 
		this.setStyle({display:'block'});	
	} else {
		this.setStyle({display:'none'});	
	}
	Event.stop(event);
}

function dropdown_hidelist(event) {
	this.setStyle({display:'none'});	
}

function dropdown_mover(event) {
	this.setStyle({backgroundColor:'#e9e9e9'});
}

function dropdown_mout(event) {
	this.setStyle({backgroundColor:'#fdfdfd'});
}

function dropdown_click(event) {
	$('subject').value = this.innerHTML;
	$('dropdown_choice_selection').update(this.innerHTML)
	$('dropdown_choice_options').setStyle({display:'none'});
}

//background-color:#e9e9e9