function getStageDimensions()
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	var dim = new Array();
	dim[0] = myWidth;
	dim[1] = myHeight;
	return dim;
}

function setDivSize(divid, newW, newH)
{	
	document.getElementById(divid).style.width = newW+"px";
	document.getElementById(divid).style.height = newH+"px";
}

function getDivPosition(divid)
{
	//to get style position you have to set them manually first (in flash)
	var divX = document.getElementById(divid).style.left;
	var ind = divX.indexOf("px");
	divX = divX.substr(0,ind);
	
	var divY = document.getElementById(divid).style.top;

	ind = divY.indexOf("px");
	divY = divY.substr(0,ind);
	
	var pos = new Array();
	pos[0] = divX;
	pos[1] = divY;
	
	return pos;
}

function setDivPosition(divid, newLeft, newTop)
{
	document.getElementById(divid).style.left = newLeft + "px";
	document.getElementById(divid).style.top = newTop + "px";
}

function setDivVisibility(divid, type)
{
	document.getElementById(divid).style.visibility = type;	
}
	
function getFlashMovie(movieName) 
{
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}


function talkToFlash()
{
	//setFlashPosition("flash",myX, myY);
	var text = "javascript talking back - go resetStage!"
	getFlashMovie("index").sendTextToFlash(text);
}


