var wind=0;
// mm - Multimedia type:
//		1: Video, plays directly as an object (avi/mpg/mov)
//		2: Image, loads via a <img> tag
//		3: Direct URL link/Fixed Window
//		4: Direct URL link/Resizable Window
// sb - scrollbars? (YES or NO)

function openinwindow(url,w,h,mm,sb) {
	if (wind) {
		if (!wind.closed) {
			wind.close();
		}
	}
	if (sb=="False") {
		sb='NO'
	} else {
		sb='YES'
		w=w+18;
	}
	if (mm==4) {
		resizable='YES'; 
	} else {
		resizable='NO';
	}
	
	if (mm==3 || mm==4 || mm==5) {
		wind=window.open(url,'mm','WIDTH=' + w +',HEIGHT=' + h + ',SCROLLBARS='+sb +',resizable='+resizable);
		wind.moveTo(screen.width-w-20,screen.height/2-(h/2))
	} else {
		wind=window.open('','mm','WIDTH=' + w +',HEIGHT=' + h + ',SCROLLBARS='+sb);
		wind.moveTo(screen.width-w-20,screen.height/2-(h/2))
		wind.document.writeln("<HTML><HEAD><TITLE>Image Viewer/6footmedia</TITLE></HEAD>");
		wind.document.writeln("<BODY bgcolor='#cccccc' marginheight='0' leftmargin='0' topmargin='0' bottommargin='0'>");
		if (mm==1) {
		ext=url.substring(url.length-3,url.length);
		if (ext=="avi" || ext=="mpg") {
			wind.document.writeln('<object id="MediaPlayer" classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" type="application/x-oleobject" standby="Loading Microsoft Windows Media Player components..." width="' + w + '" height="' + h + '">');
			wind.document.writeln('				<param name="url" value="http://www.6footmedia.com/' + url +'">');
			wind.document.writeln('				<param name="autostart" value="true">');
			wind.document.writeln('				<param name="uimode" value="full">');
			wind.document.writeln('			</object>');
		} else 
			if (ext=="mov") {
				wind.document.writeln('	<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" id="QuicktimeMovie" WIDTH="' + w +'" HEIGHT="' + h + '" codebase="HTTP://www.apple.com/qtactivex/qtplugin.cab">');
				wind.document.writeln('  <param name="src" value="../Scripts/' + url + '">');
				wind.document.writeln('  <param name="autoplay" value="true">');
				wind.document.writeln('  <param name="loop" value="true">');
				wind.document.writeln('  <param name="controller" value="true">');
				wind.document.writeln("     <embed src='../Scripts/" + url + "' WIDTH='" + w +"' HEIGHT='" + h + "' AUTOPLAY='TRUE' CONTROLLER='FALSE' PLUGINSPACE='http://www.apple.com/quicktime/download/' ENABLEJAVASCRIPT='TRUE' NAME='QuicktimeMovie'>");
				wind.document.writeln('     </embed></object>');
			}
	    }
	    if (mm==2) {
			wind.document.writeln("<IMG SRC='../Scripts/" + url + "'>");
		}
		wind.document.writeln("</BODY></HTML>");
	}
}