var remote=null; 
var remotex = 100; var remotey = 100;

function display(url, w, h, winname) {
  if (w == null){ w = "640"; }
  if (h == null){ h = "480"; }
  if (winname == null){ winname = "ReportWindow"; }
  if (navigator.appName.indexOf("Microsoft")>=0) {
	args = "width="+w+",height="+h+",resizable=yes,scrollbars=yes,menubar=no,status=0,left="+remotex+",top="+remotey;
  } else {
	args = "width="+w+",height="+h+",resizable=yes,scrollbars=yes,menubar=no,status=0,screenX="+100+",screenY="+100;
  }
  if (remote && !remote.closed) { remote.focus(); } else { remote=window.open(url,winname,args); remote.focus(); }
  if (remote && !remote.opener) remote.opener = self;
}

function closeWin() {
	if (navigator.appName.indexOf("Microsoft")>=0) {
		opener.remotex = self.screenLeft; opener.remotey = self.screenTop;
	} else {
		opener.remotex = self.screenX; opener.remotey = self.screenY;
	}
 	self.close();
} 

function loadVideo(container, file, width){
    var swf = 'movieplayer.swf';
    var obj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="254" id="fullscreen" align="middle">'+
    '<param name="allowScriptAccess" value="sameDomain" />'+
    '<param name="movie" value="'+swf+'" />'+
    '<param name="quality" value="high" />'+
    '<param name="salign" value="tl" />'+
    '<param name="bgcolor" value="#dddddd" />'+
    '<param name="FlashVars" value="vidpath='+file+'">'+
    '<embed src="'+swf+'" FlashVars="vidpath='+file+'" quality="high" salign="tl" bgcolor="#dddddd" width="'+width+'" height="254" name="fullscreen" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
    '</object>'+"\n";
    document.getElementById(container).style.width = width+'px';
    document.getElementById(container).innerHTML = obj;
}

function loadAudio(container, file){
    var swf = 'xspf_player.swf?song_url='+file+'&song_title=Micha the Mouth&autoplay=true';
    var obj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="15" id="xspf_player" align="middle">'+
    '<param name="allowScriptAccess" value="sameDomain" />'+
    '<param name="movie" value="'+swf+'" />'+
    '<param name="quality" value="high" />'+
    '<param name="bgcolor" value="#e6e6e6" />'+
    '<embed src="'+swf+'" quality="high" bgcolor="#e6e6e6" width="400" height="15" name="xspf_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
    '</object>'+"\n";
    document.getElementById(container).innerHTML = obj;
}

function insertSWF(container, id, movie, w, h, bg){
    var swf = movie;
    var obj = '<object id="'+id+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+w+'" height="'+h+'">'+
	'<param name="movie" value="'+swf+'" />'+
    '<param name="allowScriptAccess" value="sameDomain" />'+
	'<param name="base" value="." />'+
	'<param name="quality" value="high" />'+
	'<param name="wmode" value="opaque" />'+
	'<param name="bgcolor" value="'+bg+'" />'+"\n"+
	'<embed name="'+id+'" src="'+swf+'" allowScriptAccess="sameDomain" base="." quality="high" wmode="opaque" bgcolor="'+bg+'"  width="'+w+'" height="'+h+'" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer"></embed></object>'+"\n";
	document.getElementById(container).innerHTML = obj;
}

function playSound(){
    insertSWF('introsound', 'sound', 'soundplayer.swf?soundfile=../media/mp3/democlip.mp3&r='+Number(new Date()), 4, 4, '#FFFFFF');
}
function playSoundTop(){
    insertSWF('introsound', 'sound', 'soundplayer.swf?soundfile=./media/mp3/democlip.mp3&r='+Number(new Date()), 4, 4, '#FFFFFF');
}


