﻿function $(_id)
{
  return document.getElementById(_id);
}
function getAjaxObj()
    {
      httpRequest=false;     
      if(window.XMLHttpRequest)
      {
        httpRequest = new XMLHttpRequest();
        if(httpRequest.overrideMimeType)
        {
          httpRequest.overrideMimeType("text/xml");
        }
      }
      else if(window.ActiveXObject)
      {
        try
        {
          httpRequest=new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch(e)
        {
          try
          {
            httpRequest=new ActiveXObject("Microsoft.XMLHTTP");
          }
          catch(ex)
          {
          }
        }
      }
      if(!httpRequest)
      {
        alert("不能创建Ajax对象");
        return false;
      }     
      return httpRequest;
}
var WQajax=false;
var loadImage= new Array();
loadImage[0]="image/icos/red_bg.gif";
loadImage[1]="image/icos/wh_bg.gif"
function WQajaxRequest(RequestMethod,RequestUrl,RequestArgs,RequestPost)
{
  WQajax=false;
  WQajax=getAjaxObj();
  WQajax.onreadystatechange=RequestPost;      
  WQajax.open(RequestMethod,RequestUrl,true)
  if(RequestMethod=="POST")
  {
    WQajax.setRequestHeader("Content-Length",RequestArgs.length);
    WQajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  }
  WQajax.send(RequestArgs);
}
function getNavigatorType()
{
	n_name=navigator.appName;
	n_version=parseFloat(navigator.appVersion);
	n_agent=navigator.userAgent;	
	if(n_agent.indexOf("Firefox")!=-1)return "Firefox";
	if(n_agent.indexOf("Safari")!=-1)return "Safari";
	if(n_agent.indexOf("Opera")!=-1)return "Opera";
	if(n_agent.indexOf("MSIE 7.0")!=-1)return "MSIE 7.0";
	if(n_agent.indexOf("MSIE 6.0")!=-1)return "MSIE 6.0";
	return "MSIE 8.0";
}
function getTrim(Text)
{
 _text=Text.replace("&","");
 _text=_text.replace("　","");
 _text=_text.replace("?","");
 _text=_text.replace("=","");
 _text=_text.replace("'","");
 return _text;
}
function getTrimDIV(Text)
{
  _text=Text.replace("<div>","").replace("</div>","");
  return _text;
}
function formstatus(obj,isbool)
{
  if(!isbool)
  {
    obj.style.borderColor="#fe676c";
    obj.style.backgroundImage='url("'+loadImage[0]+'")';
  }
  else
  {
    obj.style.borderColor="#cfcfcf";
    obj.style.backgroundImage='url("'+loadImage[1]+'")';
  }  
}

