function playmms(id,type,place){
    var myPlayerControl;
//    myPlayerControl = '<OBJECT id="mediaPlayer" width="392" height="300" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" standby="Welcome to VTC - VOD, please wait..." type="application/x-oleobject">';
//    myPlayerControl = myPlayerControl + '    <param name="URL" value="view_media.aspx?pid=' + id + '" >';
//    myPlayerControl = myPlayerControl + '    <param name="rate" value="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="balance" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="currentPosition" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="defaultFrame" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="playCount" VALUE="1">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="CursorType" VALUE="-1">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="autoStart" VALUE="1">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="currentMarker" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="invokeURLs" VALUE="-1">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="volume" VALUE="100">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="mute" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="stretchToFit" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="windowlessVideo" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="enabled" VALUE="1">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="fullScreen" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="enableContextMenu" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <PARAM NAME="enableErrorDialogs" VALUE="0">';
//    myPlayerControl = myPlayerControl + '    <EMBED type="application/x-mplayer2" pluginspage="http://microsoft.com/windows/mediaplayer/en/download/" id="mediaPlayer" name="mediaPlayer" width="392" height="300" src="view_media.aspx?pid=' + id + '" AutoSize="1" AutoStart="1" ClickToPlay="1" DisplaySize="0" EnableContextMenu="0" volume="100" EnableFullScreenControls="0" EnableTracker="0" Mute="0" PlayCount="1"  ShowControls="0" ShowAudioControls="0"  ShowDisplay="1" ShowGotoBar="0" ShowPositionControls="0"  ShowStatusBar="0" ShowTracker="0">';
//    myPlayerControl = myPlayerControl + '    </embed>';
//    myPlayerControl = myPlayerControl + '    </OBJECT>';
myPlayerControl ='<object id="Player" width="392" height="300" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">';
myPlayerControl +=' <param name="URL" value="view_media.aspx?'+type+'=' + id + '">';
myPlayerControl +=' <param name="SendPlayStateChangeEvents" value="True">';
myPlayerControl +='  <param name="AutoStart" value="True">';
myPlayerControl +='  <param name="ShowControls" value="False">';
myPlayerControl +='  <param name="ShowStatusBar" value="True">';
myPlayerControl +='  <param name="uiMode" value="none">';
myPlayerControl +='  <EMBED type="application/x-mplayer2"';
myPlayerControl +='  pluginspage="http://microsoft.com/windows/mediaplayer/en/download/"';
myPlayerControl +='  width="392" height="300" src="view_media.aspx?'+type+'=' + id + '"';
myPlayerControl +='  AutoSize="1" AutoStart="1" ClickToPlay="1" DisplaySize="1" EnableContextMenu="0" volume="100" ';
myPlayerControl +='	EnableFullScreenControls="1" EnableTracker="0" Mute="0" PlayCount="0"  ShowControls="0"  ';
myPlayerControl +='	ShowAudioControls="0" ShowDisplay="0" ShowGotoBar="0" ShowPositionControls="0"  ShowStatusBar="0" ';
myPlayerControl +='	ShowTracker="0">';
myPlayerControl +='     </embed> ';
myPlayerControl +='     </object>';
    document.getElementById(place).innerHTML=myPlayerControl;
}
function gup( name ){
          name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
            var regexS = "[\\?&]"+name+"=([^&#]*)";
            var regex = new RegExp( regexS );
            var results = regex.exec( window.location.href );
            if( results == null )    return "";
            else    return results[1];
        }
function GetXmlHttpObject()
{
  var xmlHttp=null;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}
function pickRandom(range) {
if (Math.random)
return Math.round(Math.random() * (range-1));
else {
var now = new Date();
return (now.getTime() / 1000) % range;
}
}
function ShowPicture(urlImage, iWidth, iHeight)
		{
		var url = "view_image.aspx?img=" + urlImage;
		
		var width=iWidth-10;
		var height=iHeight-10;
		var LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
		var TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
		if(iHeight<screen.height)
		{
			window.open(url,pickRandom(1000),'top='+TopPosition+',left='+LeftPosition+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+width+',height='+height+'').focus();
		}
		else
		{
			window.open(url,pickRandom(1000),'top='+TopPosition+',left='+LeftPosition+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height+'').focus();
		}
		}
function doSearchAll()
{
var keyword= document.getElementById("keyword").value;
var cbCategory= document.getElementById("cbCategory").value;
window.location.href="search.aspx?action=searchresult&keyword=" + keyword + "&cbCategory=" + cbCategory;
}
function openPollWindow(PollID)
{
	var answer = "";
	var frmForm = document.PollForm;
	for (i = 0; i < frmForm.elements.length; i++)
	{	
		e = frmForm.elements[i];
		if (e.name == "Poll" + PollID && e.checked == true)
		{
			answer = answer + "&answer=" +  e.value;
		}
	}
	//alert(answer);
	pollWindow = window.open('poll_result.aspx?pid=' + PollID + answer,'AQContextHelp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=300,height=300').focus();
}
function viewPollWindow(PollID)
{
	var answer = "";
	pollWindow = window.open('poll_result.aspx?pid=' + PollID + answer,'AQContextHelp','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=300,height=300').focus();
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function openEditor(formName, ImageFolder, strUrl)
{
	
	strUrl = strUrl + "?form=" + formName + "&folder=" + ImageFolder;
	var width=680;
	var height=400;
	var LeftPosition = (screen.width) ? (screen.width-width)/2 : 0;
	var TopPosition = (screen.height) ? (screen.height-height)/2 : 0;
	window.open(strUrl,'OnlineEditor','top='+TopPosition+',left='+LeftPosition+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+width+',height='+height+'').focus();

}

function checkMemberLogin(strReturnUrl)
{
	var objUsername = document.getElementById('txtLoginUserName');
	var objPassword = document.getElementById('txtLoginPassword');
	var strAlert = "";
	strAlert = strAlert + EsolCheckRequireField(objUsername, "Please enter your username!\n");
	strAlert = strAlert + EsolCheckRequireField(objPassword, "Please enter your password!\n");
	if(strAlert != "")
	{
		alert(strAlert);
		return false;
	}
	else
	{
		document.frmForm.action = "login.aspx?returnUrl=" + strReturnUrl;
		return true;
	}
}
function doSearch()
{
	var objKeyword = document.getElementById('txtKeywordSearch');
	
	window.location.href="search.aspx?keyword=" + objKeyword.value;
}