// Menu div object
var menu_div = null;
// Timeout reference
var timeout = null;

var animated = null;

// Shows menu
function linkstart()
{
	if (!animated)
	{
		var width = 1280;
		if (window.innerWidth) width = window.innerWidth - 20;
		else if (document.body.offsetWidth) width = document.body.offsetWidth - 4;

		left = 0;
		left = (width - 986) / 2;
		left += 975;

		menu_div = document.getElementById("kdInternet");
		menu_div.style.left = left + "px";
		start_animation();
		menu_div.style.display = "inline";
	}
	if (timeout) unsettimeout();
}

// Hides menu after 500 ms
function linkstop()
{
	timeout0 = setTimeout(stop_animation, 500);
	timeout = setTimeout(settimeout, 850);
}

// Hides menu
function settimeout()
{
	menu_div = document.getElementById("kdInternet");
	menu_div.style.display = "none";
	animated = false;
}

// Unsets timeout
function unsettimeout()
{
	if (timeout) clearTimeout(timeout);
	if (timeout0) clearTimeout(timeout0);
	timeout = null;
	timeout0 = null;
}



function id(id) {
	return document.getElementById(id);
}

// Configure Doolox Core - system function and path to it
function start_animation()
{
	ex3 = new Animator().addSubject(new CSSStyleSubject(id('kdInternet'), "width: 20px; left: " + (left) + "px; height: 20px;", "width: 480px; left: " + (left - 460) + "px; height: 500px;"));
	ex3.play();
	animated = true;
}

function stop_animation()
{
	ex3 = new Animator().addSubject(new CSSStyleSubject(id('kdInternet'), "width: 480px; left: " + (left - 460) + "px; height: 500px;", "width: 20px; left: " + (left) + "px; height: 20px;"));
	ex3.play();
	animated = false;
}

