function showMlsDropdown(x)
{
	x=$(x);
	var arr = mlses.get(x.value);

	submit_user_type('agent');

	var sel = x.up('form').help_mls;
	sel.style.display = 'block';
	clear_dropdown(sel);
	sel.options[sel.options.length] = new Option('Choose your MLS', '');

	for(var i=0;i<full_mls_dropdown.length;i++)
	{
		if(arr.indexOf(full_mls_dropdown[i].value) > -1 || full_mls_dropdown[i].value == 'unlisted_mls')
			sel.options[sel.options.length] = new Option(full_mls_dropdown[i].innerHTML, full_mls_dropdown[i].value);
	}

	setTimeout(function(){submit_state(x.value)}, 100);
}

function mls_select_dropdown(x)
{
	submit_mls(x.value);
	setTimeout(function(){show_login_lightbox(function(){})}, 200);
}

function help_submit_login(user, pass)
{
	submit_user_type('client');
	setTimeout(function(){submit_login(user, pass)}, 100);
}

function clear_dropdown(sel)
{
	var len = sel.options.length;
	for(var i=0;i<len;i++)
		sel.remove(0);
}

function gather_options(sel)
{
	var len = sel.options.length;
	var arr = new Array();
	for(var i=0;i<len;i++)
		arr[i] = $(sel.options[i]).clone(true);
	return arr;
}
