
function open_win(file_name, intHeight, intWidth){
  MyWindow = window.open(file_name, "WebWizard", "status=no,scrollbars=yes,resizable=yes,Left=0,Top=0, Height="+ intHeight +", Width="+ intWidth +"");
  MyWindow.focus();
}

function open_pps(file_name){
    
  var screenW = screen.width;
  var screenH = screen.height;
  MyWindow = window.open(file_name, "WebWizard", "status=no,scrollbars=no,resizable=no, maximize=yes,Left=0,Top=0, Height="+ screenH +", Width="+ screenW +"");
  MyWindow.focus();
}

function openImg(imgFile){  

  if(imgFile.indexOf(".pps") != -1) {
	open_pps(imgFile);
  } else { //if(imgFile.indexOf(".jpg") != -1 || imgFile.indexOf(".gif") != -1) {
	  var screenW = screen.width;
	  var screenH = screen.height;
	
	  MyWindow = window.open("", "WebWizard", "status=no,scrollbars=no,resizable=no,Left=200,Top=50, Height=300, Width=300");
	  MyWindow.focus();
	  
	  MyWindow.document.open();
	  
	  MyWindow.document.writeln('<html><head><title>View Image</title></head><body onload="scale_window()" topmargin="0" leftmargin="0">');
	  MyWindow.document.writeln('<form name="viewImg">');
	  MyWindow.document.writeln('<a href="javascript:window.close()"><img src="' + imgFile + '" name="imgName" border="0" alt="Click to close"></a>');
	  MyWindow.document.writeln('</form>');
	  MyWindow.document.writeln('<script language="javascript">');
	  MyWindow.document.writeln('function scale_window(){');
	  MyWindow.document.writeln('var ImgHeight = viewImg.imgName.height;');
	  MyWindow.document.writeln('var ImgWidth = viewImg.imgName.width;');
	  MyWindow.document.writeln('if ((ImgHeight > 0) || (ImgWidth > 0)) {');
	  MyWindow.document.writeln('window.resizeTo(ImgWidth + 10, ImgHeight + 29);');
	  MyWindow.document.writeln('window.moveTo((screenW - ImgWidth)/2, (screenH - ImgHeight)/2);');
	  //MyWindow.document.writeln('alert((screenW - ImgWidth)/2);');
	  //MyWindow.document.writeln('alert((screenH - ImgHeight)/2);');
	  MyWindow.document.writeln('}');
	  MyWindow.document.writeln('}');
	  MyWindow.document.writeln('</script>');
	  MyWindow.document.writeln('</body></html>');
	 
	  
	  MyWindow.document.close();
  }
}

function buildWMPlayer(w,h, url, title)
{
	h+=64;//to compensate for toolbar
	
	document.write("<table border='0' cellpadding='0' align='center'><tr><td>");
	if (window.ActiveXObject && (navigator.userAgent.indexOf('Windows') != -1))
	{
		document.write('<object id="nolplayerWM" classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" height="'+h+'" width="'+w+'">');
		document.write('<param name="uiMode" value="full" />');
		document.write('<param name="autoStart" value="false" />');
		document.write('<param name="stretchToFit" value="true" />');
		document.write('<param name="URL" value="'+url+'" />');
		//if (url.clippos){document.write('<param name="currentPosition" value="'+url.clippos+'" />');}
		document.write('Your browser does not support the ActiveX Windows Media Player');
		document.write('</object>');
	}
	else if(navigator.mimeTypes)
	{
		document.write('<object id="nolplayerWM" name="nolplayerWM" width="'+w+'" height="'+h+'" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">');
		document.write('<param name="FileName" value="'+url+'" />');
		document.write('<param name="ShowControls" value="1" />');
		document.write('<param name="ShowDisplay" value="0" />');
		document.write('<param name="AutoStart" value="0" />');
		document.write('<param name="ShowStatusBar" value="1" />');
		document.write('<embed type="application/x-mplayer2" src="'+url+'" id="nolplayer1" name="nolplayer1" ShowControls=1 ShowDisplay=0 AutoStart=0 ShowStatusBar=1 width="'+w+'" height="'+h+'"></embed>');
		document.write('</object>');
		document.write('<noembed>This browser appears to be unable to display clips inline the player.<br /><a href="+url+">&gt;Play the clip in Windows Media Player</a></noembed></object>');
	}
	document.write("</td></tr><tr><td align='center'><I><B>"+title+"</B></I></td></tr></table>");
}