var UniqueID = 321; // Make each link open in a new window 
var newWinOffset = 20; // Position of first pop-up
var videoHeightAdj = 240;
var winHeight = 180;
var controllerHeight = 42;
var winTitle = 'kim holloway: media';

function PlayerOpen(mediaType,mediaFileDesc,mediaFilePath) {

	if (mediaType == 'video') {
		 winHeight = winHeight + videoHeightAdj;
		 controllerHeight = controllerHeight + videoHeightAdj;
	}
	PlayWin = window.open('',UniqueID,'width=350,height=' + winHeight + ',top=' + newWinOffset +',left=' + newWinOffset + ',resizable=1,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');
	PlayWin.focus(); 

	var winContent = "<html>\r<head>\r<title>\r" + winTitle + "\r</title>\r</head>\r\r<body bgcolor=\"#CCCCFF\">\r"; 
	winContent += "<div align=\"center\"><strong style=\"font-size:1.2em;font-family:Verdana,sans-serif;line-height:1.5em\">" + mediaFileDesc + "</strong></div>\r\r";
	
	winContent += "<div align=\"center\"><object align=\"middle\" width=\"320\" height='" + controllerHeight + "'>\r"; 
	winContent += "<param  name=\"SRC\" value=\"" + mediaFilePath + "\">\r";
	winContent += "<param name=\"AUTOPLAY\" value=\"true\">\r"; 
	winContent += "<param name=\"CONTROLLER\" value=\"true\">\r";
	winContent += "<param  name=\"BGCOLOR\" value=\"#CCCCFF\">\r"; 
	winContent += "<embed  src=\"" + mediaFilePath + "\"  autostart=\"TRUE\" loop=\"FALSE\" width=\"320\" height=\"" + controllerHeight + "\" controller=\"TRUE\" bgcolor=\"#CCCCFF\"></embed>\r";
	winContent += "</object></div>\r\r"; 
	
	winContent += "<div align=\"center\"><form><input type=\"button\" value=\"Close\" onclick=\"javascript:window.close();\"></form></div>\r\r"; 
	winContent += "</body>\r</html>\r"; 
	
	PlayWin.document.write(winContent); 
	PlayWin.document.close(); // "Finalizes" new  window 
	UniqueID = UniqueID + 1; 
	newWinOffset = newWinOffset + 20 // subsequent pop-ups will be this many pixels  lower 
	if (mediaType == 'video') {
		 winHeight = winHeight - videoHeightAdj;
		 controllerHeight = controllerHeight - videoHeightAdj;
	}

 }
 
function newHTMLByID(elementid,content) {
	if (document.getElementById) {
		rng = document.createRange();
		el = document.getElementById(elementid);
		rng.setStartBefore(el);
		htmlFrag = rng.createContextualFragment(content);
		while (el.hasChildNodes())
			el.removeChild(el.lastChild);
		el.appendChild(htmlFrag);
	}
}


