/*Methods for resizing the flash stage at runtime.

Changed in order to fix intermittent bug on mac & safari 3.1.2 (5525.20.1)

If you have safari the flash div is resized to a whole number after a delay of 1 sec, this *appears* to have fixed the problem

- GM
*/

var newHeight;
var newWidth;
var changeDivId;
var haveSafari = checkSafari();

function setFlashWidth()
{
    //alert('setting width to ' + newWidth);	document.getElementById(changeDivId).style.width = newWidth+"px";}
function setFlashHeight()
{
	//alert('setting height to ' + newHeight);
	document.getElementById(changeDivId).style.height = newHeight+"px";
}
function setFlashSize(divid, newW, newH)
{
    
    changeDivId = divid;
    // was sending floats previously
    newWidth = Math.round(newW);
    newHeight = Math.round(newH);
    
    // avoid setting flash div dimensions unnecessarily
    var nextWidthPix = newWidth+"px";
    var currWidthPix = document.getElementById(changeDivId).style.width;
    if (nextWidthPix != currWidthPix)
    {    
        if (haveSafari)
        {
            setTimeout("setFlashWidth()",1000);
        }
        else
        {
            setFlashWidth();
        }
    }
    
    var nextHeightPix = newWidth+"px";
    var currHeightPix = document.getElementById(changeDivId).style.height;
    if (nextHeightPix != currHeightPix)
    { 
        if (haveSafari)
        {
            setTimeout("setFlashHeight()",1000);
        }
        else
        {
            setFlashHeight();
        }
    }}

function checkSafari()
{
    haveSafari = false;
    
    var ua = navigator.userAgent.toLowerCase();
    var safari = ua.indexOf("safari");
    if (safari != -1) haveSafari = true;

    return haveSafari;
}