if(window.ActiveXObject){
   document.execCommand("BackgroundImageCache",false,true);
}

//create the httprequest obj.
function createHttpRequest(){
   var http_request = false;
   if(window.ActiveXObject){ // IE 
   	   	try {
           http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
           try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
   }
   else if(window.XMLHttpRequest){ //Mozilla 
   	   	http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {//MiME 
           http_request.overrideMimeType("text/xml");
        }
   }
   if(!http_request){ return false; }
   else return http_request;
}
//for IE7 And FF window.event.keyCode
function keepKeyNum(e)
{
	 var code = -1;
   if (!e) var e = window.event
   if (e.keyCode) code = e.keyCode;
   else if (e.which) code = e.which;
   
   return code;
}
String.prototype.replaceAll  = function(s1,s2){    
	return this.replace(new RegExp(s1,"gm"),s2);    
}
//for Firefox DOM add innerText arr£º
var lBrowser = {};
lBrowser.agt = navigator.userAgent.toLowerCase();
lBrowser.isW3C = document.getElementById ? true:false;
lBrowser.isIE = ((lBrowser.agt.indexOf("msie") != -1) && (lBrowser.agt.indexOf("opera") == -1) && (lBrowser.agt.indexOf("omniweb") == -1));
lBrowser.isNS6 = lBrowser.isW3C && (navigator.appName=="Netscape") ;
lBrowser.isOpera = lBrowser.agt.indexOf("opera") != -1;
lBrowser.isGecko = lBrowser.agt.indexOf("gecko") != -1;
lBrowser.ieTrueBody =function (){
  return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
};

if(lBrowser.isNS6){ //firefox innerText define
  HTMLElement.prototype.__defineGetter__( "innerText", 
  function(){ 
  return this.textContent; 
  } 
  ); 
  HTMLElement.prototype.__defineSetter__( "innerText", 
  function(sText){ 
  this.textContent=sText; 
  } 
  ); 
}
function RemoveArray(array,attachId)
{
    for(var i=0,n=0;i<array.length;i++)
    {
        if(array[i]!=attachId)
        {
            array[n++]=array[i]
        }
    }
    array.length -= 1;
}
Array.prototype.remove = function (obj) {
    return RemoveArray(this,obj);
};
function trim(str){
	return str.replace(/(^\s*)|(\s*$)/g, "");
}
function findcomXY(o){
    var to=new Object();
	to.left=to.right=to.top=to.bottom=0;
	var twidth=o.offsetWidth;
	var theight=o.offsetHeight;

	while(o!=null&&o!=document.body){
		to.left+=o.offsetLeft;
		to.top+=o.offsetTop;
		o=o.offsetParent;
	}
	to.right=to.left+twidth;
	to.bottom=to.top+theight;
	return to;	
}