var safariSizeCorrection = false;

function writeFlashUpgrade()
{
	document.title = document.title.slice(0, 47) + " - Flash Player Installation";
	var MMdoctitle = document.title;

	var productInstallOETags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
	+ 'width="100%" height="100%"'
	+ 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
	+ '<param name="movie" value="swf/playerProductInstall.swf?MMredirectURL='+MMredirectURL+'&MMplayerType=ActiveX&MMdoctitle='+MMdoctitle+'" />'
	+ '<param name="quality" value="high" /><param name="bgcolor" value="#1C1C1C" />'
	+ '<embed src="swf/playerProductInstall.swf?MMredirectURL='+MMredirectURL+'&MMplayerType=PlugIn" quality="high" bgcolor="#1C1C1C" '
	+ 'width="100%" height="100%" name="detectiontest" aligh="middle"'
	+ 'play="true"'
	+ 'loop="false"'
	+ 'quality="high"'
	+ 'allowScriptAccess="sameDomain"'
	+ 'type="application/x-shockwave-flash"'
	+ 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
	+ '<\/embed>'
	+ '<\/object>';
	
	var container = document.body;
	container.innerHTML = productInstallOETags;
}

function writeFlash(path, width, height, containerName, movieName)
{
	// if we've detected an acceptable version
    var oeTags = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    + 'width="' + width + '" height="' + height + '"'
    + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="' + containerName + '_movie">'
    + '<param name="movie" value="' + path + '" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="bgcolor" value="#1C1C1C" />';
	
    oeTags += '<embed src="' + path + '" menu="false" quality="high" bgcolor="#1C1C1C" '
	+ 'name="' + containerName + '_movie" '
    + 'width="' + width + '" height="' + height + '" name="' + containerName + '_swf" align="middle"'
    + 'play="true"'
    + 'loop="false"'
    + 'quality="high"';
	
	oeTags += 'allowScriptAccess="sameDomain"'
    + 'type="application/x-shockwave-flash"'
    + 'name="' + movieName + '" '
    + 'id="' + movieName + '" '
    + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
    + '<\/embed>'
    + '<\/object>';
	
	var container = document.getElementById(containerName);
	container.innerHTML = oeTags;
}

function writeNoFlash()
{
	var alternateContent = ''
  	+ '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#1C1C1C"><tr><td align="center" valign="middle">'
   	+ '<a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"><img src="images/noflash.jpg" width="266" height="243" border="0" alt=""></a></td></tr></table>';
	
	var container = document.body;
	container.innerHTML = alternateContent;   
}

function popWindow(path, winName, width, height)
{
	if(!width)
		var width = screen.width;
	
	if(!height)
		var height = screen.height;
	
	if(screen.width > 1680)
		width = 1680;
	
	var scroll = 'yes';
	var toolbar = 'no';
	var status = 'no';
	
	var screenX, screenY, leftvar, rightvar, leftprop, topprop, features;
	
	if(navigator.appName == "Microsoft Internet Explorer") {
		screenY = document.body.offsetHeight;
		screenX = window.screen.availWidth;
	} else {
		screenY = window.outerHeight
		screenX = window.outerWidth
	}
	
	leftvar = (screenX - width) / 2;
	rightvar = (screenY - height) / 2;
	
	if(navigator.appName == "Microsoft Internet Explorer") {
		leftprop = leftvar;
		topprop = rightvar;
	} else {
		leftprop = (leftvar - pageXOffset);
		topprop = (rightvar - pageYOffset);
	}
	
	features = "width=" + width + ",height=" + height + ",top=" + topprop + ",left=" + leftprop + ', scrollbars=' + scroll + ', toolbar=' + toolbar + ', status=' + status + ', noresize'
	
	window.open(path,winName,features);
}

function resize()
{
	var isSafari = (navigator.appVersion.indexOf("Safari") != -1) ? true : false;
	var contentArea = document.getElementById("main");

	if(isSafari && !safariSizeCorrection)
	{
		safariSizeCorrection = true;
		setTimeout("resize()", 500);
	}

	if(isIE)
	{
		winW = document.body.offsetWidth - 22;
		winH = document.body.offsetHeight - 5;
	}
	else
	{
		winW = window.innerWidth;
		winH = window.innerHeight;
	}
	
	if(winW > 1014)
		contentArea.style.width = winW;
	else		
		contentArea.style.width = 1014;
	
	if(winH > 714)
		contentArea.style.height = winH;
	else
	{
		if(winW > 1018 && !isSafari)
			contentArea.style.width = winW - 20;
		
		contentArea.style.height = 714;
	}
}

