// JavaScript Document

var comboBox_shown = false;

function get(id) {
	return document.getElementById(id);
}
function showE(el, show) {
	if (el && el.style) return el.style.display = (show)? 'block':'none';
}


function comboBox_select(suggestedText)
{
	get('searchFor').value = suggestedText;
	
	get('searchFor').onBlur = null;
	
	comboBox_hide();	
}

function comboBox_show()
{
	showE(get('categories'), true);
	
	get('comboBoxArrow_categories').src = 'images/arrowUp.png';
	get('categories').focus();
	get('searchFor').focus();
	
	//get('searchFor').onBlur = setTimeout(comboBox_hide, 100);
	
	comboBox_shown = true;
}

function comboBox_hide()
{
	if(comboBox_shown)
	{
		showE(get('categories'), false);
		
		get('comboBoxArrow_categories').src = 'images/arrowDown.png';
		
		comboBox_shown = false;
		
		get('searchFor').onBlur = null;
	}
}

function comboBox_toggle()
{
	if(comboBox_shown)
	{
		comboBox_hide();	
	}
	else
	{
		comboBox_show();	
	}
}
