function createTestObj(divid,objid,pathstr)
{
  document.write('<div id="'+divid+'">');
  document.write('<OBJECT id="DVSTool" style="WIDTH: 0px; HEIGHT: 0px"');
  document.write(' codeBase="'+pathstr+'DVSTools.cab#version=1,0,1,0"');
  document.write(' classid="clsid:C7DEAFF2-1DEB-4647-9631-43C09BB8CEC6">');
  document.write('  <PARAM NAME="_Version" VALUE="65536">');
  document.write('  <PARAM NAME="_ExtentX" VALUE="212">');
  document.write('  <PARAM NAME="_ExtentY" VALUE="212">');
  document.write('  <PARAM NAME="_StockProps" VALUE="0">');
  document.write('</OBJECT>');
  document.write('<OBJECT id="'+objid+'"');
  document.write(' style="LEFT: 0px; WIDTH: 352px; TOP: 0px; HEIGHT: 240px"');
  document.write(' codeBase="'+pathstr+'xVideoShow.cab#version=1,0,4,5"');
  document.write(' classid="clsid:A8C1E502-4FCF-4AF2-ADDB-ABF540CA5BA7">');
  document.write('  <PARAM NAME="_Version" VALUE="65536">');
  document.write('  <PARAM NAME="_ExtentX" VALUE="17648">');
  document.write('  <PARAM NAME="_ExtentY" VALUE="12621">');
  document.write('  <PARAM NAME="_StockProps" VALUE="0">');
  document.write('無法使用ActiveX');
  document.write('</OBJECT>');
  document.write('</div>');
}
function createObj(divid,objid,pathstr)
{
  document.write('<div id="'+divid+'">');
  document.write('<OBJECT id="DVSTool" style="WIDTH: 0px; HEIGHT: 0px"');
  document.write(' codeBase="'+pathstr+'DVSTools.cab#version=1,0,1,0"');
  document.write(' classid="clsid:C7DEAFF2-1DEB-4647-9631-43C09BB8CEC6">');
  document.write('  <PARAM NAME="_Version" VALUE="65536">');
  document.write('  <PARAM NAME="_ExtentX" VALUE="212">');
  document.write('  <PARAM NAME="_ExtentY" VALUE="212">');
  document.write('  <PARAM NAME="_StockProps" VALUE="0">');
  document.write('</OBJECT>');
  document.write('<OBJECT id="'+objid+'"');
  document.write(' style="LEFT: 0px; WIDTH: 352px; TOP: 0px; HEIGHT: 240px"');
  document.write(' codeBase="'+pathstr+'xVideoShow.cab#version=1,0,4,5"');
  document.write(' classid="clsid:A8C1E502-4FCF-4AF2-ADDB-ABF540CA5BA7">');
  document.write('  <PARAM NAME="_Version" VALUE="65536">');
  document.write('  <PARAM NAME="_ExtentX" VALUE="17648">');
  document.write('  <PARAM NAME="_ExtentY" VALUE="12621">');
  document.write('  <PARAM NAME="_StockProps" VALUE="0">');
  document.write('無法使用ActiveX');
  document.write('</OBJECT>');
  document.write('</div>');
}

window.appVersion = window.navigator.appVersion;
if(window.appVersion!=null)
{
window.appVersion = window.appVersion.toUpperCase();
window.MacIE5 = ((window.appVersion.toUpperCase().indexOf("MSIE") >=0) && (window.appVersion.toUpperCase().indexOf("MACINTOSH") >=0) && (window.appVersion.indexOf("5.0") >=0));
}
window.OPR =(window.opera!=null)|| false;
window.IE = (document.all && (!window.OPR))|| false;
window.IE55 = (window.IE && window.createPopup!=null && document.createComment==null) || false;
window.MOZ = (window.outerWidth && !window.OPR && (window.navigator.product!=null)) || false;
if( window.MOZ )
{
	window.NN = ( window.navigator.userAgent.toLowerCase().indexOf("netscape") >=0 );
	if( window.NN )
	{
		window.NN8 = ( window.navigator.userAgent.toLowerCase().indexOf("netscape/8") >=0 );
	}
	window.FF = ( window.navigator.userAgent.toLowerCase().indexOf("firefox") >=0 );
}
window.IE50 = (window.IE && (document.createTextNode!=null) && (window.createPopup==null)) || false;
window.IE60= (window.IE && document.createComment!=null ) || false;
window.IE40 = (document.all && !window.IE50 && !window.IE55 && !window.IE60 &&(window.opera==null) ) || false;
window.MS =( window.navigator.userAgent.toLowerCase().indexOf("windows") >= 0 ) || false ;
window.MAC =( window.navigator.appVersion.toLowerCase().indexOf("mac") >= 0 ) || false ;
if(window.IE)
{
window.WIN98 = (window.navigator.userAgent.toLowerCase().indexOf("windows 98")>=0);
/* windows 98 has serous pronlem with DirectX when use filter, we need to remove that;*/
}

function startview(objid,v1,v2,v3,v4)
{
  if( window.MS )
  {
    if( window.IE )
    {
      var ocxobj = document.getElementById(objid);
      if( ocxobj )
      {
        ocxobj.RemoteCommand(101,-1,0);
        ocxobj.RemoteCommand(2,-1,0);
        ocxobj.RemoteView(v1,v2,"root","pass", v3,v4);
        ocxobj.VPSetLayout(1);
        ocxobj.RemoteCommand(0,1,0);
        ocxobj.RemoteCommand(201,-1,0);
        ocxobj.RemoteCommand(202,-1,0);
        ocxobj.RemoteCommand(300,-1,0)
        ocxobj.RemoteCommand(301,0,0);
      }
      else
      {
        //alert("nofind "+objid);
      }
    }
  }
}
function startplay(objid,v1,v2,v3,v4,v5)
{
  if( window.MS )
  {
    if( window.IE )
    {
      var ocxobj = document.getElementById(objid);
      if( ocxobj )
      {
        ocxobj.RemoteCommand(101,-1,0);
        ocxobj.RemoteCommand(2,-1,0);
        ocxobj.RemotePlay(v1,v2,"root","pass", v3,v4,v5);
        ocxobj.RemoteCommand(0,1,0);
        ocxobj.VPSetLayout(1);
        ocxobj.RemoteCommand(1,-1, 1);
        ocxobj.RemoteCommand(201,-1,0);
        ocxobj.RemoteCommand(202,-1,0);
        ocxobj.RemoteCommand(300,-1,0);
        ocxobj.RemoteCommand(301,0,0);
        ocxobj.RemoteCommand(202,-1,0);
      }
      else
      {
        //alert("nofind "+objid);
      }
    }
  }
}
function play_onclick(objid)
{
  if( window.MS )
  {
    if( window.IE )
    {
      var ocxobj = document.getElementById(objid);
      if( ocxobj )
      {
        ocxobj.RemoteCommand(1,-1,1);
      }
      else
      {
        //alert("nofind "+objid);
      }
    }
  }
}

function stop_onclick(objid) {
  if( window.MS )
  {
    if( window.IE )
    {
      var ocxobj = document.getElementById(objid);
      if( ocxobj )
      {
        ocxobj.RemoteCommand(1,-1,0);
      }
      else
      {
        //alert("nofind "+objid);
      }
    }
  }
}

function checkDiv(divid,pathstr,v,d)
{
var wid={"61.56.8.80":2,"61.57.34.162":4,"172.17.232.100":5,"163.29.194.195":6,"61.60.93.254":7,"210.69.92.162":8,"61.60.83.74":9,"61.60.12.250":10,"211.79.172.154":11,"211.79.139.210":12,"61.60.127.200":13,"210.241.103.122":14,"210.241.103.130":15,"61.67.89.194":16,"61.67.89.170":17,"61.67.91.66":18,"61.60.89.254":19,"61.60.4.2":20,"61.57.35.98":21,"210.69.56.180":22,
"211.79.172.194":23,"163.29.26.105":24,"211.79.151.50":25,"61.67.86.202":26,"210.69.56.242":27,"210.241.41.123":28,"210.241.59.133":29,"211.79.151.10":30,"61.60.108.218":31,"163.29.253.80":32,"61.57.59.210":32,"61.60.20.18":33,"203.71.9.151":34,"211.79.185.50":35,"211.79.185.42":36,"210.69.170.20":37,"210.69.46.145":38,"203.69.229.46":39,"61.60.102.76":40,"61.60.102.106":41,"163.29.185.100":42,"61.67.86.226":43,"61.67.86.218":44,"61.60.52.130":45,"61.67.86.162":46,"61.67.79.2":47,"61.57.59.130":48,"163.29.110.10":48,"61.60.123.218":49,"211.79.139.18":50,"61.60.54.194":51,"61.60.54.178":52,"210.241.8.137":53,"211.79.142.243":54,
"61.60.40.172":55,"61.60.68.58":57,"61.60.68.58":58,"61.60.38.10":59,"210.69.32.222":60,"61.60.33.18":61,"210.69.129.133":62,"210.69.170.24":63,"61.60.88.186":64,"61.218.202.3":65};

  if( window.MS )
  {
  	if( window.IE )
  	{
  	}
  	else if( window.MOZ )
  	{
  		var infodiv = document.getElementById(divid);
  		var page = null;
  		if( window.FF )
  		{
  			if( infodiv )
  			{
  				page ="firefox";
  			}
  		}
  		else if( window.NN )
  		{
  			if( window.NN8 )
  			{
  				if( infodiv )
  				{
  					page ="netscape";
  				}
  			}
  			else
  			{
  				alert('尚未支援Netscape 8 以下版本');
  			}
  		}
  		else
  		{
  			page ="mozilla";
  		}
  		if( page != null )
  		{
  			if( infodiv )
  			{
  				infodiv.innerHTML = "<iframe src='"+pathstr+"ffview.html?vip="+v+"&devid="+wid[d]+"' width='320' height='240' frameborder='0' scrolling='no'/>";
  			}
  		}
  	}
  	else
  	{
  		alert('尚未支援此版本');
  	}
  }
  else
  {
  	alert('尚未支援此OS');
  }
}
