//Global Vars for SWFObject
var so="";
var soID ="";
//
var nFormHeight=0;
var nFormHeightLimit=585;
var nFormHeightCounter=0;
var nSpeed=30;
var nID=10;
var open_interval="";
var close_interval="";
//


//Hides blocker overlay when form is open
function hideSwfBlocker() {
	so.call("hideBlocker");
}
function createSwfSnapshot(){
	so.call("createSnapshot");
}
function showForm(sPath)
{	
	clearInterval(close_interval);
	document.getElementById("formFrame").src = sPath;
	open_interval = setInterval("animateFormIn()", nID);
	var t=setTimeout("createSwfSnapshot()",1000)
	//createSwfSnapshot();
}
function startFormInInterval(){
	
//do nothing
}

function closeForm()
{
	clearInterval(open_interval);
	close_interval = setInterval("animateFormOut()", nID);
}

function animateFormIn(){
	//printTrace("animateFormIn display->"+document.getElementById("formOverlay").style.display);
	if (document.getElementById) { // DOM3 = IE5, NS6 
		document.getElementById("formOverlay").style.display = 'block';
		document.getElementById("formOverlay").style.height = nFormHeightCounter+"px";
	} 
	checkInCounter();
	
}

function animateFormOut(){
	
	document.getElementById("formOverlay").style.height = nFormHeightCounter+"px";
	document.getElementById("formFrame").style.display = 'none';	
	checkOutCounter();
}

function printTrace(output){
	document.getElementById("trace").innerHTML +="<br/>"+output;
}

function checkInCounter(){
	nFormHeightCounter+=nSpeed;
	if(nFormHeightCounter>=nFormHeightLimit){
		clearInterval(open_interval);
		resetFormDisplay(true);
		document.getElementById("formOverlay").style.height=nFormHeightCounter+"px";
	}

}

function checkOutCounter(){
	nFormHeightCounter-=nSpeed;
	var y = document.getElementById("formOverlay").style.height;
	var _y = (y.substr(0, y.length-2));
	var value = Math.floor((nFormHeightLimit - _y)/2);
	if(nFormHeightCounter<=0){
		clearInterval(close_interval);
		hideSwfBlocker();
		resetFormDisplay(false);
		document.getElementById("formOverlay").style.height=nFormHeightCounter+"px";
	}
	

}

function resetFormDisplay(bFormOpen){
	if(bFormOpen){
		nFormHeightCounter=nFormHeightLimit;
		document.getElementById("formOverlay").style.display = 'block';
		document.getElementById("formFrame").style.display = 'block';
	}else{
		nFormHeightCounter=0;
		document.getElementById("formOverlay").style.display = 'block';
		document.getElementById("formFrame").style.display = 'none';
	}
	
}
