$(function() {
	var $menu = $("#navigation .menu");
	
	var $selected = $menu.find('li.active');
	
	if(typeof($selected[0]) != 'undefined')
	{
		var $moving		= $('<li />',{
			className	: 'move',
			width		: $selected[0].offsetWidth + 'px'
		});
		$moving.css('left', $selected[0].offsetLeft + 'px');
	}
	else
	{
		var $moving		= $('<li />', {
			className	: 'move',
			width		: '0px'
		});
		$moving.css('left', '0px');
	}
	
	$menu.bind('mouseleave',function(){
			moveTo($selected,400);
		  })
		 .append($moving)
		 .find('li')
		 .not('.move')
		 .bind('mouseenter',function(){
		 	var $this = $(this);
			//move the absolute div to this item
			moveTo($this,400);
		  })
		  .bind('mouseleave',function(){
			var $this = $(this);
		  });;


	function moveTo($elem,speed){
		width = parseInt($elem[0].offsetWidth) +1;
		left = parseInt($elem[0].offsetLeft) - 1;
		$moving.stop(true).animate({
			left 	: left + 'px',
			width	: width + 'px'
		}, speed, 'easeOutExpo');
	}
});


function open_secure(relative_url)
{
	base_url = 'https://secure.wansino.com/';
	window.open(base_url + relative_url, "_self", "width=935, height=795, menubar=no");
}

function open_poker_client()
{
	window.open('http://download.b2bpoker.com/client/wansino/web/wansino_client_applet.html', "_blank", "width=794, height=533, menubar=no")
}

