// JavaScript Document
// Popup code
function openPopup(url, name, w, h, scroll) {
     if (document.all) {
        var winX = (screen.availWidth - w)*.5;
        var winY = (screen.availHeight - h)*.5;
	 if (scroll) {
	 	scroll = 'yes';
	}
	else {
		scroll = 'no';
	}
        popupWin = window.open(url, name, "status=no,scrollbars=" + scroll + ",menubar=no,toolbar=no,width=" + w + ",height=" + h + ",left=" + winX + ",top=" + winY);
     } else {
  	if (scroll) {
		scroll = 1;
	}
	else {
		scroll = 0;
	}
        var winX = window.screenX + ((window.outerWidth - w) / 2);
        var winY = window.screenY + ((window.outerHeight - h) / 2);
        popupWin = window.open(url, name, "status=0,scrollbars=" + scroll + ",menubar=0,toolbar=0,width=" + w + ",height=" + h + ",screenX=" + winX + ",screenY=" + winY);
     }
     return popupWin;
}
  
function openVideoPopup (first_name, type) {
	if (type == 'mov') {
		var newwindow = openPopup('',first_name,320,240, false);
		newwindow.document.write('<html><body style="margin:0;padding:0;background:#000;text-align:center;">');
		newwindow.document.write('<object width="320" height="240" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" width="320" height="256" align="middle">\n');
		newwindow.document.write('<param name="autoplay" value="true" />\n');
		newwindow.document.write('<param name="scale" value="aspect" />\n');
		newwindow.document.write('<param name="bgcolor" value="black" />\n');
		newwindow.document.write('<param name="src" value="/videos/' + first_name +'.mov" />\n');
		newwindow.document.write('<embed src="/videos/' + first_name + '.mov" autoplay="true" scale="aspect" width="320" height="240" align="middle" bgcolor="black" pluginspage="http://www.apple.com/quicktime/download/"></embed>');
		newwindow.document.write('</object>\n');
	}
	else if ( type == 'wmv' ) {
		var newwindow = openPopup('',first_name,320,240, false);
		newwindow.document.write('<html><body style="margin:0 auto;padding:0;background:#000;text-align:center;">');
		newwindow.document.write('<object width="320" height="240" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="application/x-oleobject" standby="Loading Microsoft Windows Media Player components..." codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">');
		newwindow.document.write('<param name="autoplay" value="true" />\n');
		newwindow.document.write('<param name="bgcolor" value="black" />\n');
		newwindow.document.write('<param name="FileName" value="/videos/' + first_name + '.wmv" />\n');
		newwindow.document.write('<param name="showcontrols" value="true">\n');
		newwindow.document.write('<embed type="application/x-mplayer2" filename="/videos/' + first_name + '.wmv" src="/videos/' + first_name + '.wmv" width="320" height="240" bgcolor="black"></embed>');
		newwindow.document.write('</object>\n');
	}
	newwindow.document.close();
}