function getWindowInnerDimensions()
{
	var returnValue = null;
	try
	{
		if (window.innerWidth)
		{
			returnValue = new Object();
			returnValue.Width = window.innerWidth;
			returnValue.Height = window.innerHeight;
		}
		else if (document.body.parentNode.clientWidth)
		{
			returnValue = new Object();
			returnValue.Width = document.body.parentNode.clientWidth;
			returnValue.Height = document.body.parentNode.clientHeight;			
		}
		/*else if (document.body.offsetWidth)
		{
			returnValue = new Object();
			returnValue.Width = document.body.offsetWidth;
			returnValue.Height =document.body.offsetHeight;
		}*/
	}
	catch (err)
	{
		
	}
	return returnValue;
}
function fitMessage(x, y, maxX, maxY)
{
	var dimensions = getWindowInnerDimensions();	
	if (dimensions)
	{
		var width = x - dimensions.Width;
		var height = y - dimensions.Height;
		window.resizeBy(width, height);
	}		
	else
	{
		window.resizeTo(maxX, maxY);
	}	
}
function attribute(name, value)
{
	var returnValue = "";	
	if (value && value != "")
	{
		returnValue = " " + name + "=\"" + value + "\"";
	}
	return returnValue;
}
function parameter(name, value)
{
	return "<param" + attribute("name", name) + attribute("value", value) + ">";
}
function embedPlayer(playerDivId, width, height, playListSrc, autoStart, showStatusBar, volume, backgroundColor)
{
	var playerDiv = document.getElementById(playerDivId);
	if (playerDiv)
	{
		var html = "<table><tr><td" + attribute("valign", "middle") + "><!--[if IE]>";
		html += "<object" + attribute("classid", "CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6");
		html += attribute("type", "application/x-oleobject") + attribute("width", width) + attribute("height", height);
		html += attribute("codebase", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715");
		html += attribute("standby", "Loading Microsoft Windows Media Player components...") + ">"
		if (playListSrc && playListSrc != "")
		{
			html += parameter("url", playListSrc + "&emb=jsxoleurl");
		}
		html += parameter("autostart", autoStart);
		html += parameter("ShowStatusBar", showStatusBar);
		html += parameter("volume", volume) + ">";
		html += parameter("backgroundcolor", backgroundColor);
		html += parameter("windowlessVideo", true);
		html += "</object>";
		html += "<!--> <![endif]-->";
		html += "<!--[if !IE]><-->";
		html += "<object" + attribute("width", width) + attribute("height", height) + attribute("type", "application/x-mplayer2") + ">";
		if (playListSrc && playListSrc != "")
		{
			html += "<param" + attribute("name", "fileName") + attribute ("value", playListSrc + "&emb=jsxmp2file") + ">";
		}
		html += parameter("autostart", autoStart ? "1" : "0");
		html += parameter("ShowStatusBar", showStatusBar ? "1" : "0");
		html += parameter("volume", volume);
		html += parameter("backgroundcolor", backgroundColor);                   
		html += "</object>";                  
		html += "<!--> <![endif]-->";
		html += "</td></tr></table>";
		
		playerDiv.innerHTML = html;
	}
}

function embedFlash(flashDivId, halign, valign, src, tableWidth, tableHeight, cellWidth, cellHeight)
{
	var flashDiv = document.getElementById(flashDivId);
	if (flashDiv)
	{
		var html = "<table";
		if (tableWidth > -1) { html += attribute("width", tableWidth); }
		if (tableHeight > -1) { html += attribute("height", tableHeight); }
		html += "><tr><td";	
		if (cellWidth > -1) { html += attribute("width", cellWidth); }
		if (cellHeight > -1) { html += attribute("height", cellHeight); }	
		html += attribute("align", halign) +  attribute("valign", valign) + ">";
		html += "<object" + attribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");	
		html += attribute("codebase", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0");
		html += attribute("width", cellWidth) + attribute("height", cellHeight);
		html += ">";
		html += parameter("movie", src);
		html += parameter("quality", "high");
		html += "<embed" + attribute("name", "hdrflashembed") + attribute("src", src);
		html += attribute("quality", "high") + attribute("pluginspage", "http://www.macromedia.com/go/getflashplayer");
		html += attribute("type", "application/x-shockwave-flash");
		html += attribute("width", cellWidth) + attribute("height", cellHeight);
		html += "></embed></object>";
		html += "</td></tr></table>";
		
		flashDiv.innerHTML = html;
	}	
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function checkFrame(frameId, divId, frameSrc)
{
	var iframe = document.getElementById(frameId);
	if (iframe == null)
	{
		var plgDiv = document.getElementById(divId);
		if (plgDiv != null)
		{
			var msg = '<font face="Verdana, Arial, Helvetica, sans-serif"><table width="100%">';
			msg += '<tr><td><div align="justify" style="padding:4px;"><strong><font color="#FF0000">It appears that your computer has blocked the content that should be showing in this space.</font></strong></div></td></tr>';
			msg += '<tr><td><div align="justify" style="padding:4px;">This is often due to \'Ad Blocking\' settings on internet security software running on your computer. If you would like to learn more about adjusting  \'Ad Blocking \' settings, you can access a technical article by clicking on the link below:</div></td></tr>';
			msg += '<tr><td><div align="center" style="padding:4px;"><a href="http://portal.accelstream.com/helpdesk/pub/issue_view.asp?ID=10242&CATE=1" target="_blank">Adjusting Ad Blocking Settings</a></div></td></tr>';
			msg += '<tr><td><div align="justify" style="padding:4px;">If you would like to view the blocked content without adjusting your settings, you can see it in a new window by clicking on the link below:</div></td></tr>';
			msg += '<tr><td><div align="center" style="padding:4px;"><a href="' + frameSrc + '" target="_blank">Show Content in New Window</a></div></td></tr>';
			msg += '</table></font>';
			plgDiv.innerHTML = msg;					
		}
	}
}
function embedFlashPlayer(flashDivId, playerWidth, playerHeight, fileName, autoplay)
{
	var flashDiv = document.getElementById(flashDivId);
	if (flashDiv)
	{				
		var html = "<embed";
		html += attribute("src", "flashplayer/jw/mediaplayer.swf"); 
		html += attribute("width", playerWidth);
		html += attribute("height", playerHeight);
		html += attribute("allowscriptaccess", "always");
		html += attribute("allowfullscreen", "true");
		html += attribute("flashvars", "file=" + fileName + "&backcolor=0xeeffff&frontcolor=0x003399&lightcolor=0x0066cc&autostart=" + autoplay);
		html += "/>";								
		flashDiv.innerHTML = html;
	}	
}