/* Streaming video */
function openVideo(template,fname,msg){
	if(navigator.userAgent.indexOf("MSIE") > -1){
		vidWindow = window.open("", "cotVideoWindow", "width=320,height=504");
	} else {
		vidWindow = window.open("", "cotVideoWindow", "width=320,height=517");
	}
	vidWindow.moveTo(screen.width/4,screen.height/8);
	vidWindow.self.focus();
	vidWindow.document.writeln("<html>");
	vidWindow.document.writeln("<head>");
	vidWindow.document.writeln("<title>City of Toronto - Video stream</title>");
	vidWindow.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=iso-utf8' />");
    vidWindow.document.writeln("</head>");
	vidWindow.document.writeln("<style type='text/css'>");
	vidWindow.document.writeln("<!--");
	vidWindow.document.write("body {");
	vidWindow.document.write("margin-left: 0px;");
	vidWindow.document.write("margin-top: 0px;");
	vidWindow.document.write("margin-right: 0px;");
	vidWindow.document.write("margin-bottom: 0px;");
	vidWindow.document.write("font-family: Arial;");
	vidWindow.document.writeln("}");
	if(navigator.userAgent.indexOf("MSIE") > -1){
		vidWindow.document.write("#vmsg {");
		vidWindow.document.write("color: #fff; font-size: 0.8em;padding: 5px;height: 100px; width:320px; overflow: auto;");
		vidWindow.document.writeln("}");
	} else {
		vidWindow.document.write("#vmsg {");
		vidWindow.document.write("color: #fff; font-size: 0.8em;padding: 5px;height: 100px; width:310px; overflow: auto;");
		vidWindow.document.writeln("}");
	}
	vidWindow.document.write("#copy, #copy a {");
	vidWindow.document.write("color: #fff; font-size: 12px;padding: 5px; text-align: right;");
	vidWindow.document.writeln("}");
	switch (template){
		case 1:
			vidWindow.document.writeln("td{background-color:#064E80;}");
			break
		case 2:
			vidWindow.document.writeln("td{background-color:#663366;}");
			break
		case 3:
			vidWindow.document.writeln("td{background-color:#CC9900;}");
			break
		case 4:
			vidWindow.document.writeln("td{background-color:#336633;}");
			break
		case 5:
			vidWindow.document.writeln("td{background-color:#009999;}");
			break
		case null:
			alert('Please choose a template');
			break
	}
	vidWindow.document.writeln("-->");
	vidWindow.document.writeln("</style>");
	vidWindow.document.writeln("<body bgcolor='#ffffff' margin='0'>");
	vidWindow.document.writeln("<table width='320' border='0' cellspacing='0' cellpadding='0'>");
	vidWindow.document.writeln("<tr>");
	switch (template){
		case 1:
			vidWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section1_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 2:
			vidWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section2_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 3:
			vidWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section3_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 4:
			vidWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section4_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 5:
			vidWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/insideto_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
	}
	vidWindow.document.writeln("</tr>");
	vidWindow.document.writeln("<tr>");
	vidWindow.document.writeln("<td>");
	vidWindow.document.writeln("<object width='320' height='312' id='cot-streaming-video' classid='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' standby='Please wait loading Microsoft Windows Media Player components...' type='application/x-oleobject'>");
	vidWindow.document.writeln("<param name='ShowControls' value='1'>");
	vidWindow.document.writeln("<param name='filename' value='"+fname+"'>");
	vidWindow.document.writeln("<param name='ShowDisplay' value='0'>");
	vidWindow.document.writeln("<param name='ShowStatusBar' value='1'>");
	vidWindow.document.writeln("<param name='AutoSize' value='0'>");
	vidWindow.document.writeln("<embed src='"+fname+"' filename='"+fname+"' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' type='application/x-mplayer2' width='320' height='312' name='cot-streaming-video' autostart='true' ShowControls='1' ShowStatusBar='1' AutoSize='0'></embed></object>");
	vidWindow.document.writeln('</object>');
	vidWindow.document.write("</td>");
	vidWindow.document.write("</tr>");
	vidWindow.document.write("<tr>");
	vidWindow.document.write("<td height='100' valign='top'><div id='vmsg' style='border-bottom: 1px #333 dashed;'>"+msg+"</div></td>");
	vidWindow.document.write("</tr>");
	vidWindow.document.write("<tr>");
	vidWindow.document.write("<td id='copy' height='20'>&copy;<a href='http://www.toronto.ca/copyright.htm' target='_blank'>City of Toronto, 2010</a></td>");
	vidWindow.document.write("</tr>");
	vidWindow.document.write("</table>");
	vidWindow.document.write("</body>");
	vidWindow.document.write("</html>");
}

/* Streaming audio */
function openAudio(template,fname,msg){
	if(navigator.userAgent.indexOf("MSIE") > -1){
		audWindow = window.open("", "cotAudioWindow", "width=320,height=262");
	} else {
		audWindow = window.open("", "cotAudioWindow", "width=322,height=276");
	}
	audWindow.moveTo(screen.width/4,screen.height/8);
	audWindow.self.focus();
	audWindow.document.writeln("<html>");
	audWindow.document.writeln("<head>");
	audWindow.document.writeln("<title>City of Toronto - Audio stream</title>");
	audWindow.document.writeln("<meta http-equiv='Content-Type' content='text/html; charset=iso-utf8'></head>");
	audWindow.document.writeln("<style type='text/css'>");
	audWindow.document.writeln("<!--");
	audWindow.document.write("body {");
	audWindow.document.write("margin-left: 0px;");
	audWindow.document.write("margin-top: 0px;");
	audWindow.document.write("margin-right: 0px;");
	audWindow.document.write("margin-bottom: 0px;");
	audWindow.document.write("font-family: Arial;");
	audWindow.document.writeln("}");
	if(navigator.userAgent.indexOf("MSIE") > -1){
		audWindow.document.write("#vmsg {");
		audWindow.document.write("color: #fff; font-size: 0.8em;padding: 5px;height: 100px; width:320px; overflow: auto;");
		audWindow.document.writeln("}");
	} else {
		audWindow.document.write("#vmsg {");
		audWindow.document.write("color: #fff; font-size: 0.8em;padding: 5px;height: 100px; width:310px; overflow: auto;");
		audWindow.document.writeln("}");
	}
	audWindow.document.write("#copy, #copy a {");
	audWindow.document.write("color: #fff; font-size: 12px;padding: 5px; text-align: right;");
	audWindow.document.writeln("}");
	switch (template){
		case 1:
			audWindow.document.writeln("td{background-color:#064E80;}");
			break
		case 2:
			audWindow.document.writeln("td{background-color:#663366;}");
			break
		case 3:
			audWindow.document.writeln("td{background-color:#CC9900;}");
			break
		case 4:
			audWindow.document.writeln("td{background-color:#336633;}");
			break
		case 5:
			audWindow.document.writeln("td{background-color:#009999;}");
			break
		case null:
			alert('Please choose a template');
			break
	}
	audWindow.document.writeln("-->");
	audWindow.document.writeln("</style>");
	audWindow.document.writeln("<body bgcolor='#ffffff' margin='0'>");
	audWindow.document.writeln("<table width='320' border='0' cellspacing='0' cellpadding='0'>");
	audWindow.document.writeln("<tr>");
	switch (template){
		case 1:
			audWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section1_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 2:
			audWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section2_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 3:
			audWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section3_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 4:
			audWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/section4_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
		case 5:
			audWindow.document.writeln("<td><a href='javascript: window.close()'><img src='/streaming/images/insideto_media_header.gif' alt='Close window' width='320' height='69' border='0'></a></td>");
			break
	}
	audWindow.document.writeln("</tr>");
	audWindow.document.write("<tr>");
	audWindow.document.write("<td height='100' valign='top'><div id='vmsg' style=''>"+msg+"</div></td>");
	audWindow.document.write("</tr>");
	audWindow.document.writeln("<tr>");
	audWindow.document.writeln("<td>");
	audWindow.document.writeln("<object width='320' height='72' id='cot-streaming-audio' classid='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' standby='Please wait loading Microsoft Windows Media Player components...' type='application/x-oleobject'>");
	audWindow.document.writeln("<param name='ShowControls' value='1'>");
	audWindow.document.writeln("<param name='filename' value='"+fname+"'>");
	audWindow.document.writeln("<param name='ShowDisplay' value='0'>");
	audWindow.document.writeln("<param name='ShowStatusBar' value='1'>");
	audWindow.document.writeln("<param name='AutoSize' value='0'>");
	audWindow.document.writeln("<embed src='"+fname+"' filename='"+fname+"' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' type='application/x-mplayer2' width='320' height='70' name='cot-streaming-audio' autostart='true' ShowControls='1' ShowStatusBar='1' AutoSize='0'></embed></object>");
	audWindow.document.writeln('</object>');
	audWindow.document.write("</td>");
	audWindow.document.write("</tr>");
	audWindow.document.write("<tr>");
	audWindow.document.write("<td id='copy' height='20'>&copy;<a href='http://www.toronto.ca/copyright.htm' target='_blank'>City of Toronto, 2010</a></td>");
	audWindow.document.write("</tr>");
	audWindow.document.write("</table>");
	audWindow.document.write("</body>");
	audWindow.document.write("</html>");
}
