var isIE=(navigator.appName.indexOf("Microsoft")!=-1);
var isMoz=(navigator.appName.indexOf("Netscape")!=-1);
if(isMoz){
	Event.prototype.__defineGetter__("srcElement",function(){var node=this.target;while(node.nodeType!=1){node=node.parentNode}return node})
	Event.prototype.__defineGetter__("x",function(){return this.clientX+2})
	Event.prototype.__defineGetter__("y",function(){return this.clientY+2})
}
String.prototype.inc=function(k1){return this.indexOf(k1)>-1?true:false}

//获取对象
function oo(obj){return document.getElementById(obj)}

function get_xy(e){
	var a=new Array()
	var t=e.offsetTop;
	var l=e.offsetLeft;
	var w=e.offsetWidth;
	var h=e.offsetHeight;
	while(e=e.offsetParent){
		t+=e.offsetTop;
		l+=e.offsetLeft;
	}
	a[0]=t;a[1]=l;a[2]=w;a[3]=h
  return a;
}
var sys_tz=null

//显示小窗口
function show_win(w,h,l){
	oo("sys_win").style.width=w
	oo("sys_win").style.height=h
	//oo("sys_win").style.left=(document.body.scrollWidth-w)
	oo("sys_win").style.left=((document.body.clientWidth-w)/2)
	
	//oo("sys_win").style.top=document.body.clientHeight/2+document.body.scrollTop-h/2
	//oo("sys_win").style.top=(document.body.clientTop - h)/2
	//oo("sys_win").style.top=document.body.clientHeight/2
	oo("sys_win").style.top=200
	//oo("pagemask").style.display="block";
	
	oo("sys_bg").style.display=oo("sys_win").style.display=""
	oo("show_content").innerHTML=l
}

//隐藏小窗口
function close_win(){
	oo("sys_bg").style.display=oo("sys_win").style.display="none"
	//oo("pagemask").style.display="none";
}
function tz_down(e){
	var a1=e.x-parseInt(oo("sys_win").style.left)
	var a2=e.y-parseInt(oo("sys_win").style.top)
	sys_tz=a1+"|"+a2
}
function tz_move(e){
	if(sys_tz==null)
		return
	var a=sys_tz.split("|")
	oo("sys_win").style.top=e.y-a[1]
	oo("sys_win").style.left=e.x-a[0]
}
document.onmouseover=function(e){
	e=e==null?event:e
	if(sys_tz!=null){
		var a=sys_tz.split("|")
		oo("sys_win").style.top=e.y-a[1]
		oo("sys_win").style.left=e.x-a[0]
	}
}
document.onmouseup=function(){sys_tz=null}
function msg(key,tag,echo){
	/*
		var l="<table width='220' border='0' cellspacing='0' cellpadding='0'>\
			<tr><td width='70' align=right><img src='/js/images/sys_info"+(tag==null?"":"_ok")+".gif' width='58' height='58'></td>\
			<td style='padding-left:10px'><b>"+key+"</b></td></tr>\
			<tr><td colspan='2' align=center style='padding-left:30px;text-align:center;'><img src='/js/images/qr.gif' class='hand' onclick='close_win();"+(echo==null?"":echo)+"' width='65' height='24' onMouseOver='this.src=\"/js/images/qr2.gif\"' onMouseOut='this.src=\"/js/images/qr.gif\"'></td></tr>\
			</table>"
		show_win(300,160,l)
		*/
		alert(key);
}
//--------------------------------------------------------------------------------------
function getServerHTML(url,key,hint_info,echo){
	var req = null;
	   
		if(window.XMLHttpRequest){
			req = new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var msxml = new Array('MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP');
			for(var i=0;i<msxml.length;i++){
				try{
					req = new ActiveXObject(msxml[i]);
				    break;
				}catch(e){}
			}
			try{req.overrideMimeType('text/xml')}catch(e){}
		}
	 req.open('post',url, true);
	 req.onreadystatechange = function(){
		if(req.readyState==4){
			if(req.status==200){
				var str=req.responseText
				if(str=="1"){
					msg(hint_info,1,echo)
                    document.fm.reset();
                    rnd();
					return false
				}
				
				if(url=="/account/changeUserinfoServlet.b"){
				
				  if(str=="valide"){
				    msg("验证码不正确！");
				  }
				  if(str=="2"){
				    msg("用户名不能为空");
				  }
				  if(str=="3"){
				    msg("密码不能为空");
				  }
				  if(str=="4"){
				    msg("有空值！");
				  }
				  if(str=="erroruname"){
				  
				    msg("用户名密码有误");
				  }
				  if(str=="editinfo"){
				    document.location.href="http://";
				  }
				  if(str=="5"){
				   msg("修改失败");
				  }
				  if(str=="6"){
				   msg("你的老提问或回答不正确！");
				  }
				}
				if(url=="/account/GetPwdCtrl.b"){
				  if(str=="-1"){
				   msg("验证码不正确！");
				  }
				  if(str=="-2"){
				   msg("用户名不能为空");
				  }
				  if(str=="-3"){
				   msg("用户名不存在");
				  }
				}
				return	false
			}else{msg('服务器连接超时!');return false}
		}
	 }
	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	req.send(key);
}



function getHTML(url,key,hint_info,echo){
	var req = null;
		if(window.XMLHttpRequest){
			req = new XMLHttpRequest();
		}else if(window.ActiveXObject){
			var msxml = new Array('MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP');
			for(var i=0;i<msxml.length;i++){
				try{
					req = new ActiveXObject(msxml[i]);
				    break;
				}catch(e){}
			}
			try{req.overrideMimeType('text/xml')}catch(e){}
		}
	 req.open('post',url, true);
	 req.onreadystatechange = function(){
		if(req.readyState==4){
			if(req.status==200){
				var str=req.responseText
				if(str=="1"){
					msg(hint_info,1,echo)
					return true
				}
				error_info(str)
				return	false
			}else{msg('服务器连接超时!');return false}
		}
	 }
	req.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
	req.send(key);
}
document.write("<div id=\"sys_bg\" onselectstart=\"return false\" style=\"position:absolute;display:none;top:0;left:0;background:#ffffff;width:100%;height:100%;z-index:99;filter:alpha(opacity=0);-moz-opacity:0\"></div>\
				<table id=\"sys_win\" border=\"0\" cellspacing=\"0\" onselectstart=\"return false\" cellpadding=\"0\" style=\"position:absolute;display:none;width:200;height:160;left:125;top:200;filter : progid:DXImageTransform.Microsoft.Shadow ( enabled=t , color=#cccccc , direction=135 , strength=5 );z-index:100\">\
				  <tr onmousedown=\"tz_down(event);return false\" onselectstart=\"return false\"> \
				    <td height=\"32\" width=\"5\"><img src=\"/js/images/w_top_left.gif\" width=\"5\" height=\"32\"></td>\
				    <td background=\"/js/images/w_top_bg.gif\" style=\"padding-left:5px\">\
						<table width=100%>\
							<tr>\
								<td width=20><img src=\"/js/images/w_style.gif\" width=\"15\" height=\"15\"></td>\
								<td style=\"color:#D63700;padding-top:3px\">提示信息：</td>\
								<td width=20><img src=\"/js/images/wclose.gif\" width=\"14\" height=\"14\" onMouseOver=\"this.src='/js/images/wclose2.gif'\" onMouseDown=\"this.src='/js/images/wclose3.gif'\" onClick=\"this.onmouseover();close_win()\" onMouseOut=\"this.src='/js/images/wclose.gif'\"></td>\
							</tr>\
						</table>\
				     </td>\
				    <td width=\"5\"><img src=\"/js/images/w_top_right.gif\" width=\"5\" height=\"32\"></td>\
				  </tr>\
				  <tr> \
				    <td background=\"/js/images/w_middle_left.gif\"></td>\
				    <td bgcolor=\"#FEF2E4\" valign=\"top\" align=\"center\" style=\"padding-bottom:10px\"> \
				      <table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"100%\">\
				        <tr> \
				          <td width=\"3\" height=\"3\"><img src=\"/js/images/w_n_top_left.gif\" width=\"3\" height=\"3\"></td>\
				          <td background=\"/js/images/w_n_top_bg.gif\"></td>\
				          <td width=\"5\"><img src=\"/js/images/w_n_top_right.gif\" width=\"5\" height=\"3\"></td>\
				        </tr>\
				        <tr> \
				          <td background=\"/js/images/w_n_middle_left.gif\"></td>\
				          <td bgcolor=\"#FFFFFF\" style=\"padding:10px\" id=show_content>\
				          </td>\
				          <td background=\"/js/images/w_n_middle_right.gif\"></td>\
				        </tr>\
				        <tr> \
				          <td height=\"7\"><img src=\"/js/images/w_n_buttom_left.gif\" width=\"3\" height=\"7\"></td>\
				          <td background=\"/js/images/w_n_buttom_bg.gif\"></td>\
				          <td width=\"5\"><img src=\"/js/images/w_n_buttom_right.gif\" width=\"5\" height=\"7\"></td>\
				        </tr>\
				      </table>\
				    </td>\
				    <td background=\"/js/images/w_middle_right.gif\"></td>\
				  </tr>\
				  <tr> \
				    <td height=\"5\"><img src=\"/js/images/w_buttom_left.gif\" width=\"5\" height=\"5\"></td>\
				    <td background=\"/js/images/w_buttom_bg.gif\"></td>\
				    <td background=\"/js/images/w_buttom_right.gif\"></td>\
				  </tr>\
				</table>");

//var hint="" 如果进入某页面时需要提示信息,就定义hint并赋值，否则hint为空,注意,此变量在页面中定义,且需在调用本js文件之前定义
if(typeof(hint)=="string"){if(hint!=""){msg(hint)}}
