var result = 0;
var currentLayerID;

function showMenu(id) 
{
	clearTimeout(result);
	
	currentLayerID = id;
	
	jQuery("#" + id).css("display", "block");
}

function hideMenu()
{
	clearTimeout(result);
	
	jQuery("#" + currentLayerID).css("display", "none");
}

function closeItTime()
{
	result = setTimeout("hideMenu()", 500);
}

function startImageRoller()
{
	document.getElementById("background").startRoller()
}

function stopImageRoller()
{
	document.getElementById("background").stopRoller()
}

function resizeLine()
{
	position = jQuery("#line").offset();
		
	lineWidth = $(window).width() - position.left;
	
	jQuery("#line").width(lineWidth);	
}

function getParam(name)
{
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp( regexS );
	var results = regex.exec( window.location.href );
	
	if( results == null )
		return "";
	else
		return results[1];
}

jQuery(window).resize(function() {
	resizeLine();
});

if(getParam("stopRoller") == 1)
	var flashvars = { 
		xmlImages: "xml/images.xml",
		interval: 10000000,
		duration: 3
	};
else
	var flashvars = { 
		xmlImages: "xml/images.xml",
		interval: 8000,
		duration: 3
	};

var params = {
	wmode: "transparent"
};

swfobject.embedSWF("swf/background.swf", "background", "100%", "100%", "10.0.0", "", flashvars, params);
