 
request=false;
function initAjax(){ 
	try{
		request= new ActiveXObject('Msxml2.XMLHTTP');
	}catch(e){
		try{
			request= new ActiveXObject('Microsoft.XMLHTTP');
		}catch(e){
			request= new XMLHttpRequest();
		}
	} 
}
if(!request)initAjax();
function $() {
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);
    if (arguments.length == 1) 
      return element;
    elements.push(element);
  }
  return elements;
}


function $A() {
  var elements = new Array();
  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.all(element);
    if (arguments.length == 1) 
      return element;
    elements.push(element);
  }
  return elements;
}
//return only one xml node's value
function getStrutsAjax(no,tag){ 
		document.getElementById("loading").style.display="none";///////////////////////////
    try{
        if(request.responseXML.getElementsByTagName(tag).length>0){
        	if(request.responseXML.getElementsByTagName(tag)[no].firstChild.data=="null"){
        		return "";
        	}else{
            	return request.responseXML.getElementsByTagName(tag)[no].firstChild.data;
            }
        }else{
            return "";
        }
    }catch(err){
        return "";
    }
}
function getStrutsAjaxLength(tag){
    try{
        if(request.responseXML.getElementsByTagName(tag).length>0){
            return request.responseXML.getElementsByTagName(tag).length;
        }else{
            return 0;
        }
    }catch(err){
        return 0;
    }
}
function clearRequest(tag){
    try{
       initAjax();
    }catch(err){
        return request=false;	
    }
}







var Ajax = {xmlhttp:function(){
	try{
		return new ActiveXObject('Msxml2.XMLHTTP');
	}catch(e){
		try{
			return new ActiveXObject('Microsoft.XMLHTTP');
		}catch(e){
			return new XMLHttpRequest();
		}
	} 
	}
};

Ajax.Request = function(){
	if (arguments.length<2) return;
	var _p = {asynchronous:true,method:"GET",parameters:""}; //default option
	for (var key in arguments[1]){ // custom option overwrite default option
		_p[key] = arguments[1][key]; 
	}
	var _x = Ajax.xmlhttp(); //xml obj
	var _url = arguments[0]; //str
	if(_p["parameters"].length>0) _p["parameters"] += '&_=';
	if(_p["method"].toUpperCase()=="GET")_url += (_url.match(/\?/) ? '&' : '?') + _p["parameters"];
	_x.open(_p["method"],_url,_p["asynchronous"]);
	_x.onreadystatechange = function(){
		if (_x.readyState==4){
			if(_x.status==200){
				_p["onComplete"]?_p["onComplete"](_x):"";
			}else{
				_p["onError"]?_p["onError"](_x):"";
			}
		}
	}
	if(_p["method"].toUpperCase()=="POST")_x.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	_x.send(_p["method"].toUpperCase()=="POST" ? _p["parameters"] : null);
};
Ajax.Response=function(){
	if (arguments.length<2) return;
	var _xmlhttp=arguments[0]; 
	var _xmlelement=arguments[1];
	try{
        if(_xmlhttp.responseXML.getElementsByTagName(_xmlelement).length>0){
        	if(_xmlhttp.responseXML.getElementsByTagName(_xmlelement)[0].firstChild.data=="null"){
        		return "";
        	}else{
            	return _xmlhttp.responseXML.getElementsByTagName(_xmlelement)[0].firstChild.data;
            }
        }else{
            return "";
        }
    }catch(err){
        return "";
    }
}









////////////////////////////////////////
//   ajax ?????????????? ????????????
//document._error_messages = new Array();
//var w;
//function doError(msg,url,ln) {
//	var _error_obj = {msg : msg, url : url, ln : ln};
//	document._error_messages[document._error_messages.length] = _error_obj;
//	str = ""
//	str += "<title>????????????????</title>"
//	str += "<script>window.onload=new Function('showError()');"
//	str += 'var nr=0;'
//	str += 'function next() {'
//	str += '   nr=Math.min(window.opener.document._error_messages.length-1,nr+1);'
//	str += '   showError();'
//	str += '}'
//	str += 'function previous() {'
//	str += '   nr=Math.max(0,nr-1);'
//	str += '   showError();'
//	str += '}'
//	str += 'function showError() {'
//	str += '   errorArray = window.opener.document._error_messages;'
//	str += '   if (errorArray.length != 0 && nr >= 0 && nr < errorArray.length) {'
//	str += '      url.innerText = errorArray[nr].url;'
//	str += '      msg.innerText = errorArray[nr].msg;'
//	str += '      ln.innerText = errorArray[nr].ln;'
//	str += '   }'
//	str += '}</script>'
//	str += "<style>"
//	str += "body {background: white; color: black; border: 5 solid navy; font-family: tahoma, arial, helvitica; font-size: 12px; margin: 10;}"
//	str += "p {font-family: tahoma, arial, helvitica; font-size: 12px; margin-left: 10px; margin-right: 5px;}"
//	str += "h3	{font-family: ???? black; font-style: italic; margin-bottom: -5; margin-left: 5; color:navy}"
//	str += "button {margin: 0; border: 1 solid #dddddd; background: #eeeeee; color: black; font-family: tahoma, arial; width: 100}"
//	str += "a {color: navy;}"
//	str += "a:hover {color: blue;}"
//	str += "</style>"
//	str += '<body scroll="no">'
//	str += "<h3>????????????????????</h3><br>&nbsp;&nbsp;??????????:"
//	str += '<strong id="url"></strong>,??????????????????!</p>'
//	str += '<p style="margin-bottom: 5;">????????????????<a href="mailto:org114@163.com">????????????????????</a></p>'
//	str += '<table style="width: 100%;" cellspacing=0 cellpadding=10><tr><td>'
//	str += '<button onclick=\'if (infoArea.style.display!="block") {infoArea.style.display = "block";window.resizeTo(400,308);this.innerText="????????";}else {infoArea.style.display="none";window.resizeTo(400,219);this.innerText="????????";}\''
//	str += 'onmouseover="this.style.borderColor=\'black\'" onmouseout="this.style.borderColor=\'#dddddd\'">????????</button>'
//	str += '</td><td align="RIGHT"><button onclick="window.close()" onmouseover="this.style.borderColor=\'black\'" onmouseout="this.style.borderColor=\'#dddddd\'">??&nbsp;&nbsp;??</button>'
//	str += '</td></tr></table>'
//	str += '<div id="infoArea" style="display: none;">'
//	str += '<div id="info" style="background: #eeeeee; margin: 5; margin-bottom: 0; border: 1 solid #dddddd;">'
//	str += '<table>'
//	str += '<tr><td><p>????:</p></td><td><p id="msg"></p></td></tr>'
//	str += '<tr><td><p>????:</p></td><td><p id="ln"></p></td></tr>'
//	str += '</table>'
//	str += '</div>'
//	str += '<table style="width: 100%;" cellspacing=0 cellpadding=10><tr><td>'
//	str += '<button onclick="previous()" onmouseover="this.style.borderColor=\'black\'" onmouseout="this.style.borderColor=\'#dddddd\'">??????</button>'
//	str += '</td><td align=right><button onclick="next()" onmouseover="this.style.borderColor=\'black\'" onmouseout="this.style.borderColor=\'#dddddd\'">??????</button>'
//	str += '</td></tr></table>'
//	str += '</div>'
//	str += '</body>'
//
//	if (!w || w.closed) {
//	var  messageBoxWidth=window.screen.width;
//	var  messageBoxHeight=window.screen.height;
//		  messageBoxWidth=(messageBoxWidth-390)/2;
//		  messageBoxHeight=(messageBoxWidth-190)/2;
//		w = window.open("","_webxf_error_win","width=390,height=190,left="+messageBoxWidth+",top="+messageBoxHeight);
//		var d = w.document;
//		d.open();
//		d.write(str);
//		d.close();
//		w.focus();
//	}
//	return true;
//}
//window.onerror = doError
///////////////////////////// 
  
var LoadFrame="";
LoadFrame+="<div id='loading' style='left:500px;top:5px;width:200px;display:none;position:absolute;background-color:orange;font-family:Tahoma;border:1px solid orange;'>";
LoadFrame+="<table width='100%' border='0' cellspacing='1' cellpadding='3' align='center' bgcolor='#ffffff'>";
LoadFrame+="<tr><td align=center>正在处理中............</td></tr>";
LoadFrame+="</table>";
LoadFrame+="</div>";
document.write(LoadFrame); 
function LoadEvent(t,l){  
		if(t){
			document.getElementById("loading").style.left=l;
			document.getElementById("loading").style.display=""; 
		}else{
			document.getElementById("loading").style.display="none"; 
		}
} 
 
