function openVideoWin(filename, width, height, loop, controller, autoplay){

var newWindow

//close an open window if open (delete these lines if you want multiple windows open, but give each window a new name using a random variable
if (newWindow && !newWindow.closed)
{
newWindow.close();
}


//make the text to write to the new window
//all variables not passed to the function must be assigned here

//if controller is to be shown add 16 for Quicktime, 32 for Windows Media Player to the height
var controller_height = 16 //may need to calc based upon browser, etc
if(controller == 1)
{
//add controller height
height = parseInt(height) + parseInt(controller_height);
}

text = "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>";
text += "<html>\n<head>\n<title>" + filename + "</title></head>\n<body align='left' leftmargin='0' topmargin='0' bgcolor='#000000'>\n";
text += "<OBJECT CLASSID='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'\n" ;
text += "WIDTH='" + width + "'\n";
text += "HEIGHT='" + height + "'\n";
text += "CODEBASE='http://www.apple.com/qtactivex/qtplugin.cabversion=6,0,2,0'>\n";
text += "<PARAM NAME='controller' VALUE='" + controller + "'>\n";
text += "<PARAM NAME='type' VALUE='video/quicktime'>\n";
text += "<PARAM NAME='autoplay' VALUE='" + autoplay + "'>\n";
text += "<PARAM NAME='target' VALUE='myself'>\n";
text += "<PARAM NAME='SRC' VALUE='" + filename + "'>\n";
text += "<PARAM NAME='LOOP' VALUE='" + loop + "'>\n";
text += "<PARAM NAME='pluginspage' VALUE='http://www.apple.com/quicktime/download/indext.html'>\n";
text += "<EMBED WIDTH='" + width + "'";
text += "HEIGHT='" + height + "'";
text += "CONTROLLER='" + controller + "'";
text += "TARGET='" + controller + "'";
text += "SRC='" + filename + "'";
text += "TYPE='video/quicktime'";
text += "AUTOPLAY='" + autoplay + "'";
text += "LOOP ='" + loop + "'";
text += "BGCOLOR='#000000'";
text += "CACHE='true'";
text += "KIOSKMODE='true'";
text += "PLAYEVERYFRAME='true'";
text += "PLUGINSPAGE='http://www.apple.com/quicktime/download/indext.html'>";
text += "</EMBED>";
text += "</OBJECT>\n";
text += "\n</body>\n</html>\n";

//text is written so now open a new window, write the text and focus the window
newWindow=window.open('','VideoPlayer','width=' + width + ',height=' + height + ',resizable') ;
newWindow.document.write(text);
newWindow.focus();
newWindow.document.close();
}
