var obj = null;
var myTimer = 0;
var ajaxTimer = 0;
var xmlHttp = null;
var dontCheck = 0;
var firstTimeThrough = 0;
var flashName = "";
var bg_content = "";
var content = "";

var speed = 0;
var minimum = 0;
var maximum = 0;

function init() {
	ajaxFunction();
}

function ajaxFunction()
{
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		// Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				//alert("Your browser does not support AJAX!");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=ajaxTest();
}

function ajaxTest()
{
	if (firstTimeThrough < 1)
	{
		xmlHttp.open("POST","FlashMovieSelector.aspx",true);
		xmlHttp.send(null);
		firstTimeThrough = 1;
		ajaxTest();
	}
	else
	{
		if (dontCheck < 1)
		{
			if(xmlHttp.readyState!=4)
			{
				ajaxTimer = setTimeout(ajaxTest, 1);
			}
			else
			{
				dontCheck = 1;
				//alert(xmlHttp.responseText);
				if (xmlHttp.responseText == "loadNum=1")
				{
					obj = document.getElementById('HiddenDiv');
	
					speed = 1;
					minimum = parseInt(obj.style.height)*-1;
					maximum = 0;
					
					obj.style.bottom = minimum + 'px';
					
					moveUp();
				}
			}
		}
	}
}

function moveUp() {
	if (parseInt(obj.style.bottom) < maximum-5) {
		obj.style.visibility = "visible";
		obj.style.display = "block";
		obj.style.bottom = parseInt(obj.style.bottom)+5+'px';
		document.body.style.overflow = 'hidden';
		myTimer = setTimeout(moveUp, speed);
	} else {
		myTimer = setTimeout(moveDown, 15000); // This is the number of seconds times 1000.
		document.body.style.overflow = 'auto';
	}
}

function moveDown() {
	if (parseInt(obj.style.bottom) > minimum+5) {
		obj.style.bottom = parseInt(obj.style.bottom)-5+'px';
		document.body.style.overflow = 'hidden';
		myTimer = setTimeout(moveDown, speed);
	} else {
		document.body.style.overflow = 'auto';
		obj.style.visibility = "hidden";
		obj.style.display = "none";
	}
}