
var downUrl = "http://www.cnvhr.com/download/neosetup.exe";
var codebase = "http://www.cnvhr.com/download/neoactivex.cab#Version=1,0,0,1029";
var classid = "C220E775-094C-4AF8-8004-15C2D73CCCF2";


var neourl = "http://127.0.0.1:5805/";

var objname = 'NeoActivex.NeoCtl';
var iniFile = "neo.cfg";
var protoca = "neo";

/*
downUrl 插件下载地址。
codebase activex安装包下载地址 及版本信息.
classid activex classid.

objname activex注册 object name.
iniFile activex 初始化文件地址。
protoca 插件注册协议。

*/


function mailto(name,url)
{
	var subject = "您的朋友向您推荐视频";
	var body = "您的朋友为您推荐了视频"+name+"，您可以通过如下网址进行观看："+url+"";

	//创建邮件 URL
	var doc = "mailto:?subject="+subject+"&body="+body;

	// 弹出信件
	window.location = doc;
}

function copyToClipBoard(value,obj)
{
	window.clipboardData.setData("Text",value);			 
	alert(obj+"号复制成功，请粘贴添加为好友！");
	//obj.
}

function copyToClipBoard2(obj)
{
	value = document.getElementById(obj).value;
	window.clipboardData.setData("Text",value);			 
	alert("内容已复制至粘贴板中！");
	//obj.
}

function del(type,id)
{
	if(window.confirm("是否确认删除"))
	{
		base_url=neourl+protoca+"?cmd=";
		cmd=(type=="pd")?"removelive":"removevodtitle";
		id_title=(type=="pd")?"channelid":"vodtitleid";	
		BM="http://"+window.location.host+window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")+1)+"neov-list.jsp?pcateid=my";
		window.location.href=base_url+cmd+"&"+id_title+"="+id+"&BM="+BM;
		return true;
	}
	//return false;
}

function neo_exists(){
var flag=if_exists();
if (flag=="1")
{
	alert("您好，如果操作不能正确执行，请检查是否安装我们的播放插件。");
	return false;
}
else {
	return true;
}
}
function if_exists(){
	//flag 检测浏览器，客户端；0--ie 已经安装；1--ie 未安装；2--其他浏览器；目前只支持ie
	//var objname='NeoActivex.NeoCtl'
    var neo_object=false;
	var flag='';
	if(window.ActiveXObject)
	{
		try{
			
			neo_object= new ActiveXObject(objname);
			//flag='0'
			//alert('dd')
			}
		catch(x) {
			flag='1';
			//alert('鹅')
			//installActivex();
			//try{
				//neo_objct=new ActiveXObject(objname);
			//}
			//catch(e){
				//flag="1";
			//}
			}

		if (neo_object)
		{
			//alert("try to load neo");
			neo_object.SetParam("IniFile", iniFile);
			neo_object.SetParam( "URL", "%1");
			neo_object.init();
			flag='0';
		}

	}
	else
	{
		flag='2';
	}
	//alert('flag='+flag);
	return flag;
}

function installActivex (){
var neoHTML;
var version = "1,0,0,1029"
neoHTML = '<OBJECT class=CNeoCtl id=neoactivex';
neoHTML += ' codeBase='+codebase;
neoHTML += ' height=1 width=1';
neoHTML += ' classid=CLSID:'+classid+'>';
neoHTML += '</OBJECT>';
document.all.neoDIV.innerHTML = neoHTML;
alert('dd');
}

function  trim(str)
{
	for(var  i  =  0  ;  i<str.length  &&  str.charAt(i)==" "  ;  i++  )  ;
	for(var  j  =str.length;  j>0  &&  str.charAt(j-1)==" "  ;  j--)  ;
	if(i>j)  return  "";  
	return  str.substring(i,j);  
}

function get_id ($id)
{
	if (document.all && document.getElementById)
	{
		return document.all($id);
	}
	else if (!document.all && document.getElementById)
	{
		return document.getElementById($id);
	}
	else
	{
		return false;
	}
}

function fullpath ()
{
	$file = get_id('file');
	$hiddenfile = get_id('hiddenfile');
	$hiddenfile.value = $file.value;
	return neo_exists();
}
function play(chan)
{
//alert(chan)
window.NTV.location.href=chan;
}

function download()
{
	window.open(downUrl);
}
