var tempField = null;

function setLastValue(e)
{
	tempField = e;
}

function goToGame(gameName)
{
	// alert(gameName);
	url = document.getElementById("ddValue0").value;
	gameNameShort = gameName.replace(/ /g,"");
	gameNameShort = gameNameShort.replace(/'/g,"");
	urlEnd = "game/"+gameNameShort+".html";
	urlRight = url.replace(/game.html/, urlEnd);
	window.location = urlRight;
}

$(document).ready(function() {
	var $items = $('#listBox6 ul li');
	var $listBox = $('#listBox6');
	var minWidth = $('#gameNameShow').outerWidth();

	$('#gameNameShow').click(function() {
		if($listBox.css("display")=="none") {
			$listBox.css("left",$('#gameNameShow').eq(0).offset().left).css("min-width",minWidth);
			$listBox.show("fast", function() {
				$listBox.scrollTop(0).eq(0).focus();
			});
		}
		else {
			$listBox.hide("fast");
		}
	});

	$items.click(function(e) {
		
//		$('#gameNameShow').val($(this).text());
		$('#ddValue6').val($(this).attr("value"));
		$listBox.hide("fast");
		goToGame($(this).text());
	});
	
	$items.hover(function() {
			$(this).addClass("highLight");
		}, function() {
			$(this).removeClass("highLight");
		}
	);

	$listBox.blur(function(e) {
		$listBox.hide("fast");
	});
});

