
window.onerror = ignoreError;
function ignoreError() {
  return true;
}


function MM_swapImgRestore() {  
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {  
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() {  
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/*function FreshPBFrame()
	{
		parent.showrecord.location.reload();
		
	}*/
/*function test()
	{
		objimg=document.getElementById("img_755088806033");
		//alert(objimg.value);
		objimg.src="dsd.bmp";
		
	}
*/
function sendMsg()
	{		
		external.GetSendText("strToShow");
	}
function showface(object)
	{
		var t=object.offsetTop; 
		var l=object.offsetLeft; 
		var w=object.offsetWidth;
		var h=object.offsetHeight;
		while(object=object.offsetParent)
		{ 
			t+=object.offsetTop; 
			l+=object.offsetLeft; 
		} 
		//alert("top="+t+"\nleft="+l+"\nWidth="+w+"\nHeight="+h); 
		//alert(object.style.height);
		t=t+h;
			external.ShowFacePicker(l,t);
	}
function showinFace(strFile)
	{
		objinEdit=document.getElementById("inputtext");
		
		var img = document.createElement("IMG");
     	img.src = strFile;
		//img.id=strId;
		objinEdit.appendChild(img);
		//objinEdit.focus();

		
	//	alert(objinEdit.value);

	}
function ShowTextInTop(str)
	{
		
		objshow=document.getElementById("showtext");
		
		objshow.insertAdjacentText( "beforeEnd",str ); 


        //alert(objinEdit.value);	
	}
function ShowImgInTop(str)
	{
		
		objshow=document.getElementById("showtext");
		var img = document.createElement("IMG");
     	img.src = str
		objshow.appendChild(img);
       
	}
function temp()
	{
			
		obj=document.getElementById("showtext");
		//obj.scrollIntoView(false);
		parent.showtext.scrollBy(0,888888);
		//alert(objinEdit.value);
	}
function FreshFrame(strfile)
	{
		objshow=document.getElementById("showtext");
		objshow.src=strfile;		
		parent.showtext.location.reload();
		
	}
function ChangeState(strid,strstate)
{
	
	objimg=document.getElementById(strid);
	switch(strstate)
	{
		case "online":
		objimg.src= "../skin/icon_online.png";
		break;
		case "offline":
		objimg.src= "../skin/icon_offline.png";
		break;
		case "busy":
		objimg.src= "../skin/icon_busy.png";
		break;
		case "away":
		objimg.src= "../skin/icon_leave.png";
		break;
	}
		
		
	
}
function addlist()
{
	obj=document.getElementById("listarea");
	var img = document.createElement("IMG");
     	img.src = "../skin/IM_State_offline.bmp";
		//img.id="dsdf";
		obj.appendChild(img);
		obj.insertAdjacentText("beforeEnd","hjkhj");
		
	
}
function CheckNum( obj )
{
	var str = obj.value;
	var regu = "^[0-9]+$";
    var re = new RegExp(regu);

   if (str.search(re) == -1) {
      obj.value = "";
   }
}
//限制输入，只能输入数字
function ValidateNum( )
{
 //if ((event.keyCode < 48 || event.keyCode > 57) &&event.keyCode!=13)
 if(event.keyCode==13)
 	{
	 external.ClickCall();
	 return;
	}
if((event.shiftKey)&&(event.keyCode==56)) //*
{			
	external.ClickNum(10,0);
	return;
}
if((event.shiftKey)&&(event.keyCode==51)) //#
	{
		external.ClickNum(11,0);
		return;
	}

 if (event.keyCode < 48 || event.keyCode > 57) 
  	event.returnValue = false;
  switch(event.keyCode) 
			{
				
			case 48:  //0
				external.ClickNum(0,0);
				break;
			case 49:  //1
				external.ClickNum(1,0);
				break;				
			case 50:  //2
				external.ClickNum(2,0);
				break;
			case 51:  //3
				external.ClickNum(3,0);
				break;
			case 52:  //4
				external.ClickNum(4,0);
				break;
			case 53:  //5
				external.ClickNum(5,0);
				break;
			case 54:  //6
				external.ClickNum(6,0);
				break;
			case 55:  //7
				external.ClickNum(7,0);
				break;
			case 56:  //8
				external.ClickNum(8,0);
				break;
			case 57:  //9
				external.ClickNum(9,0);
				break;
			
			}
	
	
 
}
function SetLoginKey()
{
	if(event.KeyCody==13)
		Login();
}
function Login()
{
	var objIp=document.getElementById("ipNum");
	var objPws=document.getElementById("psw");
	if(objIp.value && objIp.value )
		external.LoginOK();
}
function SetFocus(obj)
{
	obj.focus();
	
}
function SetFocusLogin(obj)
{
	var objtext=document.getElementById("ipNum");
	objtext.focus();
	objtext.select();
}
function SetFocusMain()
{
	var objtext=document.getElementById("callNum");
	objtext.focus();
	objtext.select();
	
}



function DragPosition(x,y)
{
	var obj=document.getElementById("ipNum");
	  if(obj)
	  {
			var t=obj.offsetTop;
			
			var l=obj.offsetLeft; 
			var w=obj.offsetWidth;
			var h=obj.offsetHeight;
			while(obj=obj.offsetParent)
			{ 
				t+=obj.offsetTop; 
				l+=obj.offsetLeft; 
			} 
		
			if(x>l&& x<l+w && y>t&&y<t+h)
			{	
			  // alert("in");
				
				return false;
			}
			//alert("out");
		
			
	  }
	 
	 obj=document.getElementById("username");
	  if(obj)
	  {
			 t=obj.offsetTop;
			
			 l=obj.offsetLeft; 
			 w=obj.offsetWidth;
			 h=obj.offsetHeight;
			while(obj=obj.offsetParent)
			{ 
				t+=obj.offsetTop; 
				l+=obj.offsetLeft; 
			} 
		
			if(x>l&& x<l+w && y>t&&y<t+h)
			{	
			  // alert("in");
				
				return false;
			}
			//alert("out");
			
	  }
	   obj=document.getElementById("psw");
	  if(obj)
	  {
			 t=obj.offsetTop;
			
			 l=obj.offsetLeft; 
			 w=obj.offsetWidth;
			 h=obj.offsetHeight;
			while(obj=obj.offsetParent)
			{ 
				t+=obj.offsetTop; 
				l+=obj.offsetLeft; 
			} 
		
			if(x>l&& x<l+w && y>t&&y<t+h)
			{	
			  // alert("in");
				
				return false;
			}
			//alert("out");
			
	  }
	  obj=document.getElementById("showinfoarea");
	  if(obj)
	  {
			 t=obj.offsetTop;
			
			 l=obj.offsetLeft; 
			 w=obj.offsetWidth;
			 h=obj.offsetHeight;
			while(obj=obj.offsetParent)
			{ 
				t+=obj.offsetTop; 
				l+=obj.offsetLeft; 
			} 
		
			if(x>l&& x<l+w && y>t&&y<t+h)
			{	
			  // alert("in");
				
				return false;
			}
			//alert("out");
			
	  }
	   obj=document.getElementById("callNum");
	  if(obj)
	  {
			 t=obj.offsetTop;
			
			 l=obj.offsetLeft; 
			 w=obj.offsetWidth;
			 h=obj.offsetHeight;
			while(obj=obj.offsetParent)
			{ 
				t+=obj.offsetTop; 
				l+=obj.offsetLeft; 
			} 
		
			if(x>l&& x<l+w && y>t&&y<t+h)
			{	
			  // alert("in");
				
				return false;
			}
			//alert("out");
			
	  }
	  return true;
	 
}
function SetInputFocus()
{	
	obj=document.getElementById("callNum");
	obj.focus();
	obj.select();
	
}

function ShowMainVideo()
{
	//alert("Video");
	obj=document.getElementById("Video");
	obj2=document.getElementById("Update");
	
	obj.style.visibility="visible";
	obj2.style.visibility="hidden";
	
	
}
function ShowMainUpdate()
{
	
	obj=document.getElementById("Video");
	obj.style.visibility="hidden";
	obj2=document.getElementById("Update");	
	obj2.style.visibility="visible";
	
}
function SetInputFocus1()
{	
	obj=document.getElementById("callNum");
	obj.focus();
}

function ShowUpdate()
{
	
}
function ShowVideo()
{
	alert("video");
}
function displayDIV(div){
	//alert(document.getElementById('VolumeOut_List').style.visibility);
	var mydiv=document.getElementById(div);
   mydiv.style.visibility="visible";
};
function hideDIV(div){
 document.getElementById(div).style.visibility="hidden";
}
function setDropDownList()
{ var selectCount;
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("AllRecord_Fun.xml");
selectCount=xmlDoc.getElementsByTagName("Select").length;
if (selectCount>=33){
document.all.PopupDiv.style.height= "400px";
document.all.PopupDiv.style.overflow = "auto";
}
}