/*
//Copyright Quanova Corparation ,www.cnetcc.com
//Author:fanduansheng
*/
function Request(strName)
{
var strHref = window.location.search;
var intPos = strHref.indexOf("?"); //取得?所在的位置
var strRight = strHref.substr(intPos + 1);//取得?后面的一串字符
var arrTmp = strRight.split("&");//以&为分隔符将得到的字符串赋给数组arrTemp
		
	for(var i = 0; i < arrTmp.length; i++)
	{
		var arrTemp = arrTmp[i].split("=");
		if(arrTemp[0].toUpperCase() == strName.toUpperCase()) 
		{
			
			return arrTemp[1];
		}
		
	//如果传入的字符strName等于a或b或c，就返回对应的字符
	}
return "";
}

function win_onLoad(){ 
	var width = document.all["TmBri8001"].offsetWidth+300;     
	var height = document.all["TmBri8001"].offsetHeight+400;  

	width = eval(width); 
	height = eval(height); 
	if (width <300) 
	width = 300; 
	else if (width > screen.width) 
	width = screen.width; 
	 
	if (height < 400) 
	height = 400; 
	else if (height > screen.height) 
	height = screen.height; 
	 
	window.resizeTo(width,height);
	//window.moveTo(0,20);

}

function tmbri()
{
	var strParaName = "cc_code";
	var strParaCalltype = "calltype";
	var strCode = Request(strParaName);
	var calltype = Request(strParaCalltype);
	
	document.title +=Request("real_code");
	
	try{
		if(calltype ==3)
		{
		   var ReCalltype =  TmBri8001.TBStartCallPSTNEx2(strCode, 0);
		   if(ReCalltype == 0)
		   {
		      alert("呼叫失败!");
		   }
		   
		}
		else if(calltype == 2)
		{
			TmBri8001.TBStartCallPSTNEx(strCode,"","","",0);
		}
		else
		{
		 	TmBri8001.TBStartCallVID(strCode,"",calltype);
		}
		install_web801.style.display='none';
	   }
	catch(e){
		ocx.style.display=''
		install_web801.style.display='none'
	   }  
}
function callaction()
{
	document.calling.calltype.value = 0;
}
function txtaction()
{
		document.calling.calltype.value = 1;
}
function voipaction()
{
		document.calling.calltype.value = 2;
}
function voipencryptionaction()
{
       document.calling.calltype.value = 3;
}

function cc_onsubmit() 
{
	var cc_code = document.calling.cc_code.value;
	var tmpcodeArray;
	var tmpcode="";
	if(cc_code.indexOf('*')!= -1)
	{
		tmpcodeArray = cc_code.split("*");
		tmpcode = tmpcodeArray[0].replace(/\d+/,'');
	}
	else
	{
		if(cc_code.indexOf('@')!= -1)
		{
			tmpcodeArray = cc_code.split("@");
			tmpcode = tmpcodeArray[0].replace(/\d+/,'');
		}
		else
		{
			tmpcode = cc_code.replace(/\d+/,'');
		}
	}
	
	
//	var tmpCheck = tmpcode.replace(/\W+/,'');

	if(cc_code == '' || tmpcode != '')
	{
		document.calling.cc_code.focus();
		alert("cc号码不合法，应该为数字或者分隔符'@','*' !");
		return false;
	}
	else
	{
		if(document.calling.calltype.value =='')
		    document.calling.calltype.value = 0;
		//var strUrl = "call.aspx?cc_code=" + cc_code +"&calltype="+document.calling.calltype.value;
		//window.open(strUrl,'calling',  'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=248,height=200,left=750,top=245');
		return true;		
	}
	return true;
}

