	// 检查是否下载了乙太天下通
	function checkETelLogin(msg)
	{
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");
			if((objEtelClient != null )&&(objEtelClient.IsRuning()))
			{
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm(msg)){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	}
	
	// 发送手机短讯
	function sendSMS(mID)
	{
		var url = "smssend.php";
		if (mID) {
			url = url+'?mID='+mID;
		}
		window.open(url,'YTSMSWindow','width=400,height=300,resizeable=0');
		return false;
	}
	
	// 呼叫落地电话
	function CallTelphone(strNmb)
	{
		var tel=strNmb;
		if (strNmb.substring(0, 1) != '0') {
			tel='0'+tel;
		}
		MakeCall(tel);
		return false;
	}
	
	// 呼叫天下通，号码前面加[0]是呼叫电话
	function MakeCall(strNmb)
	{
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");
			if((objEtelClient != null )&&(objEtelClient.IsRuning()))
			{			
				objEtelClient.MakeCall(strNmb);
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	}
	
	function MakeCallTelAd(strNmb, etelno)//电话广告
	{	
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.isruning))
			{			
				objEtelClient.MakeCall(strNmb);
			}
			else
			{
				location.href="http://"+etelno+".yt333.cn/guanggao/gghuot.php?userids="+etelno;
			}
		}catch(e){
			location.href="http://"+etelno+".yt333.cn/guanggao/gghuot.php?userids="+etelno;
		}
	}
	
	function StartClient()
	{
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if(objEtelClient != null ) 
			{
				objEtelClient.StartEtel();
			}
		}catch(e){
		}
		return false;
	}
	
	// 亿文
	function StartEFile()
	{
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if(objEtelClient != null ) objEtelClient.StartEFile();
		}catch(e){
		}
		return false;
	}
	
	// 视频会议
	function StartVideoConf()
	{
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.IsRuning())){
				objEtelClient.StartVideoConf();
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	}
	
	// 电话会议
	function StartTelConf()
	{
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.IsRuning())){
				objEtelClient.StartTelConf();
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	}

	// 文字聊天
	function StartChat(strNmb)
	{
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.IsRuning())){
				objEtelClient.Chat(strNmb);
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	
	}

	//电话回叫
	function MakeCallBack(tel1, tel2)
	{
		if (tel1 == "")
		{
			alert("请输入主叫号码！");
			return false;
		}
		if (tel2 == "")
		{
			alert("请输入回叫号码！");
			return false;
		}
		var telno1;
		var telno2;
		if (tel1.substring(0, 1) == '0')
			telno1 = tel1;
		else
			telno1 = "0" + tel1;

		if (tel2.substring(0, 1) == '0')
			telno2 = tel2;
		else
			telno2 = "0" + tel2;
		if (telno1.length < 5)
		{
			alert("请输入有效的主叫号码");
			return false;
		}
		if (telno2.length < 5)
		{
			alert("请输入有效的被叫号码");
			return false;
		}
		// var address = "http://222.41.97.206/index.htm?svcode=65636&cmd=addtoconf&user=" + user + "&nmblist=" + telno1 + "|" + telno2;
		var nmblist = '|' + telno1 + '|' + telno2;
		var url = "tongxun/meeting/inc/makecallback.php";

		xmlhttp=GetXMLHttpRequest();
		xmlhttp.onreadystatechange=function(){
			if (4==xmlhttp.readyState){
				if (200==xmlhttp.status){
					if(xmlhttp.responseText.replace(/(^\s*)|(\s*$)/g,"") == 'notfee') {
						alert('您的可用余额不足，请充值再打电话！');
					}else{
						alert('正在呼叫！');
					}
				}
			}
		}
		var arg = 'calltype=callback&username='+top.mEtelNo+'&userpass='+top.mPasswd+'&telno='+telno2+'&type=0';
		xmlhttp.open("POST",url,true);
		xmlhttp.setRequestHeader('User-Agent','XMLHTTP/1.0');
		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf8");
		xmlhttp.send(arg);
		return false;
	}

	function  isTel(phoneNo1, phoneNo2){
		var pattern=/(\(\d{3}\)|\d{3}-|(\(\d{4}\)|\d{4}-))?\d{8}|(\(\d{3}\)|\d{3}-|(\(\d{4}\)|\d{4}-))?\d{7}|\d{11}/;
		if(!pattern.test(phoneNo1)){
			alert("电话号码格式不正确或为空");
			return false;
		}
		if(pattern.test(phoneNo2)){
			return true;
		}else{
			alert("电话号码格式不正确或为空");
			return false;
		}
	}

	function SendMail(strNmb) {
		//if (strNmb == '') {
		//	alert('您必须先登录才能和会员通讯！');
		//	return false;
		//}
		//视频邮箱
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.IsRuning())){
				objEtelClient.SendMail(strNmb);
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	}

	function Record() {
		// 录像
		alert(1);
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.IsRuning())){
				objEtelClient.StartRecorder();
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	}

	function Video() {
		// 
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.IsRuning())){
				// 功能未实现
				objEtelClient.StartVideo();
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
				window.open(top.ytponedownloadurl);
			}
		}
		return false;
	}

	function HangUpETel() {
		// 挂断
		try
		{
			var objEtelClient;	
			objEtelClient = new ActiveXObject("YTCom.Application.1");

			if((objEtelClient != null )&&(objEtelClient.IsRuning())) {
				// 功能未实现
				objEtelClient.HangUp();
			}else{
				objEtelClient.LoadApplication();
			}
		}catch(e){
			//if(confirm('你尚未安装乙太天下通，是否现在去下载安装！')){
			//	window.open("http://www.yt333.cn/setup2008.exe");
			//}
		}
		return false;
	}

