	//获取Http请求对象，这个对象用于客户端向服务
    //端发送异步的http请求
    function getHTTPObject() {                       
          var http;
          var browser = navigator.appName;

          if(browser == "Microsoft Internet Explorer") 
          {
                //如果用户使用IE，就返回XMLHTTP的ActiveX对象
                http = new ActiveXObject("Microsoft.XMLHTTP"); 
          }
          else
          {
                //否则返回一个XMLHttpRequest对象
                http = new XMLHttpRequest(); 
          }

          return http;
    }
function getObj(name) {
	return document.getElementsByName(name).item(0);
}
function init() {
	if (document.forms.length <= 0) {
		return;
	}
	for (i = 0; i < document.forms(0).all.length; i++) {
		srcElem = document.forms(0).all(i);
		if (srcElem.type == "text" || srcElem.type == "password") {
			if (srcElem.disabled == false && srcElem.readOnly == false) {
				srcElem.focus();
				return;
			}
		}
	}
}

//图片按比例缩放
var imgFlag=false;
function resizeImage(ImgD,w,h){
	var image=new Image();
	var iwidth = w; //定义允许图片宽度，当宽度大于这个值时等比例缩小
	var iheight = h; //定义允许图片高度，当宽度大于这个值时等比例缩小
	image.src=ImgD.src;
	if(image.width>0 && image.height>0){
	imgFlag=true;
	if(image.width/image.height>= iwidth/iheight){
	if(image.width>iwidth){ 
	ImgD.width=iwidth;
	ImgD.height=(image.height*iwidth)/image.width;
	}else{
	ImgD.width=image.width; 
	ImgD.height=image.height;
	}
	}
	else{
	if(image.height>iheight){ 
	ImgD.height=iheight;
	ImgD.width=(image.width*iheight)/image.height; 
	}else{
	ImgD.width=image.width; 
	ImgD.height=image.height;
	}
	}
	}
	ImgD.style.top=(h-ImgD.height)/2+"px";
	ImgD.style.left=(w-ImgD.width)/2+"px";
} 

//function filterKey(e)
//{
//	
//    var keynum;
//    var keychar;
//    var numcheck;  
//    if(window.event) // IE
//    {
//        keynum = e.keyCode;
//        if(keynum==13)
//        {
//            sub();
//        }
//        else
//        {
//            return;
//        }
//    }
//    else if(e.which) // Netscape/Firefox/Opera
//    {
//        keynum = e.which;
//        if(keynum==13)
//        {
//            sub();
//        }
//        else
//        {
//            return;
//        }
//    }	
//
//}

