﻿IEver=navigator.appVersion.substring(navigator.appVersion.indexOf('MSIE')+5,navigator.appVersion.indexOf(';',17));
if(IEver=="6.0")
    {
      ie6 = true;
      width_add = 30; 
      height_add = 30;
      hand_add = -10;
    }
else
    {
      ie6 = false;
      width_add = 30;
      height_add = 30;
      hand_add = 10;
    }
function OpenWindow(PlayerURL)
{
  if (ie6)
	newwindow=window.open('','','fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=-1');
  else
	newwindow=window.open('','','fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=-1');
	newwindow.moveTo(100,100);
	newwindow.resizeTo(600+width_add,380+height_add+hand_add);
	newwindow.focus();
	newwindow.location=PlayerURL;
}

function ValidCheck(s)
{
	try
	{
		if ( !ocxstatus() )
		{
			if( is_ie() )
			{
				alert("您没有安装WebPlayer9播放器！请先下载WebPlayer9。");
				window.open("http://www.webplayer9.com/download/WP9Setup.P2P.exe", '_self'); //下载软件的页面
				return false;
			}
			else
			{
				alert("如果您使用FireFox无法正常观看，请使用IE浏览器打开此页面！");
				return false;
			} 
		}
		else
		{
			try
			{
				OpenWindow(s);
				//window.open( s,'_blank' );
			}
			catch(e)
			{
				//OpenWindow(s);
				//alert('打开播放器时出错。');
			}
		}
	}
	catch(e)
	{
		alert('判断控件时出错。');
		return false;
	}
	return false;
}
function is_ie()
{
	try
	{
		var agt = navigator.userAgent.toLowerCase();
		var ie = ((agt.indexOf("msie") != -1));
		if ( ie )
		{
			return true;
		}
		else
		{
			return false;
		}
	}
	catch(e) {
		alert('判断浏览器类型时出错。');
	}
	return false;
}
function ocxstatus()
{
	var NewObj;
	try
	{
		NewObj = new ActiveXObject("XMEDIAPLAYER.XMediaPlayerCtrl.1");
		if ( typeof NewObj != 'undefined' )
		{
			NewObj = null;
			return true;
		}
	}
	catch(e)
	{
		NewObj = null;
		return false;
	}
}