﻿// JScript File

var volume = 0;
	
function handleKeys() {
	var iCTRLKey = 17;
	var iSpaceBar = 32;
	var iPeriod = 190;
	var iUpArrow = 38;
	var iDownArrow = 40;
	var iSKey = 83;
	if (typeof(document.MediaPlayer1) != 'undefined') {
		if (window.event.ctrlKey) {
			if (window.event.keyCode != iCTRLKey) {
				if (window.event.keyCode == iSpaceBar && document.MediaPlayer1.filename != "") {
				
//					alert('Bang');
//					alert(document.MediaPlayer1.playstate);
				
					if (document.MediaPlayer1.playstate == 2) {
						document.MediaPlayer1.pause();
					} else {
//						alert('Play');                    
                        var curpos = document.MediaPlayer1.CurrentPosition;
                        curpos = curpos-1;
                        document.MediaPlayer1.CurrentPosition=curpos;
						document.MediaPlayer1.play();
					}
					event.keyCode = 0;
					event.returnValue = false;
					event.cancelBubble = true;
//					document.all("ReplyText").focus();
					return false;
				}
				else if (window.event.keyCode == iPeriod && document.MediaPlayer1.filename != "") {
					document.MediaPlayer1.stop();
					document.MediaPlayer1.currentposition = 0;
					
					event.keyCode = 0;
					event.returnValue = false;
					event.cancelBubble = true;
//					document.all("ReplyText").focus();
					return false;
				}
				else if (window.event.keyCode == iUpArrow) {
					volume = volume + 500;
					if (volume >= 0) {
					volume = 0;
					}
					document.MediaPlayer1.volume = volume;
					
					event.keyCode = 0;
					event.returnValue = false;
					event.cancelBubble = true;
//					document.all("ReplyText").focus();
					return false;
				}
			
				else if (window.event.keyCode == iDownArrow) {
					volume = volume - 500;
					if (volume <= -10000) {
					volume = -10000;
					}
					document.MediaPlayer1.volume = volume;
					
					event.keyCode = 0;
					event.returnValue = false;
					event.cancelBubble = true;
//					document.all("ReplyText").focus();
					return false;
				}
				
				else if (window.event.keyCode == iSKey) {
					reply_OnClick();
					event.keyCode = 0;
					event.returnValue = false;
					event.cancelBubble = true;
//					document.all("ReplyText").focus();
					return false;
				}	
			}
		}
	}
}

function MediaPlayer1(FileName)
{
	MediaPlayer2(FileName, true);
}

function MediaPlayerSmall(FileName)
{
	MediaPlayerSmall2(FileName, true);
}

function MediaPlayer2(FileName, AutoPlay)
{
	document.write('<object id="MediaPlayer1" width="100%" height="70"');
	document.write('classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"');
	document.write('standby="Loading Microsoft® Windows® Media Player components..."');
	document.write('type="application/x-oleobject">');
	document.write('<param name="AutoStart" value="');
	if (AutoPlay) document.write('true');
	else document.write('false');
	document.write('" /><param name="FileName" value="');
	document.write(FileName)
	document.write('" /><param name="ShowControls" value="True" />');
	document.write('<param name="ShowStatusBar" value="True" />');
	document.write('<param name="AutoSize" value="True" />');
	document.write('<param name="Volume" value="100" />');
	document.write('<embed type="application/x-mplayer2" src="');
	document.write(FileName)
	document.write('" name="MediaPlayer1" width="100%" height="70" volume="100" ');
	document.write('transparentatstart="0" animationatstart="0" ');
	document.write('showstatusbar="1" showpositioncontrols="1" enablepositioncontrols="1" ');
	document.write('autostart="');
	if (AutoPlay) document.write('1');
	else document.write('0');
	document.write('" showcontrols="1"></embed></object>');
}

function MediaPlayerSmall2(FileName, AutoPlay)
{
	document.write('<object id="MediaPlayer1" width="100%" height="46"');
	document.write('classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"');
	document.write('standby="Loading Microsoft® Windows® Media Player components..."');
	document.write('type="application/x-oleobject">');
	document.write('<param name="AutoStart" value="');
	if (AutoPlay) document.write('true');
	else document.write('false');
	document.write('" /><param name="FileName" value="');
	document.write(FileName)
	document.write('" /><param name="ShowControls" value="True" />');
	document.write('<param name="ShowStatusBar" value="False" />');
	document.write('<param name="AutoSize" value="True" />');
	document.write('<param name="Volume" value="100" />');
	document.write('<embed type="application/x-mplayer2" src="');
	document.write(FileName)
	document.write('" name="MediaPlayer1" width="100%" height="46" volume="100" ');
	document.write('transparentatstart="0" animationatstart="0" ');
	document.write('showstatusbar="1" showpositioncontrols="1" enablepositioncontrols="1" ');
	document.write('autostart="');
	if (AutoPlay) document.write('1');
	else document.write('0');
	document.write('" showcontrols="1"></embed></object>');
}


function AddFlag()

{
    
    //on every genuine postback request we append a value to the existing hidden field value
    document.getElementById("ctl00_Flag").value = document.getElementById("ctl00_Flag").value + 'P'; 

}
 

