function reportError(msg,url,line){
line-=1;
var str='You have found an error as below: \n\n';
str+='Err:'+msg+'on line:'+(line);
alert(str);
window.onerror=null;
return true;
}
window.onerror=reportError;

xmlHttp = false;
function CreatexmlHttp(){
	var xmlHttp = false;
	try{
	   xmlHttp = new XMLHttpRequest();
	}catch(trymicrosoft){
	   try{
	      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	   }catch(othermicrosoft){
	       try{
		      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		   }catch(failed){
		      xmlHttp = false;
		   }
	   }
	}
	return xmlHttp;
}

function VarExists(v){
      if(!v || v == 'undefined') return true;
	  return false;
}
//xmlHttp的Post方法
function xmlHttpPost(url,post,handle,bu){
	     xmlHttp = CreatexmlHttp();
	     if(!VarExists(url)) return false;
	     if(!VarExists(post)) var post = '';
		 if(!VarExists(handle)) var handle = function(){
		    if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
			  var text = xmlHttp.responseText;
			}
		 }
		 if(!VarExists(bu)) var bu = true;

		 xmlHttp.onreadystatechange = handle;		 
		 xmlHttp.open('POST',url,bu);
		 xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
         xmlHttp.setRequestHeader("Content-Length",post.length);
		 xmlHttp.send(post);
}


//返回对像
//能用 ID
function $(ID){
    var obj = document.getElementById(ID);
	if(obj == null || obj == '') return false;
	return obj;
}

//返回FORM 中的一个值 type可用与 input等

function GetVal(ID){
    var obj = $(ID);
	if(obj !== false) return obj.value;
	else return '';
}

//隐藏对像
function HiddenObject(ID){
   var Node = $(ID);
   if(Node){
        Node.style.visibility = "hidden";
        Node.style.display = 'none';
   }
}
//显示对像
function BlockObject(ID){
    var Node = $(ID);
	if(Node){
	   Node.style.visibility = "visible";
       Node.style.display = 'block';
	}
}