/*-------------------------U工具对象--------------------------*/
var  u = new  Object();
/*浏览器类型*/
u.getUserAgent  =  navigator.userAgent;
u.isGecko  =  u.getUserAgent.indexOf( " Gecko " )  !=   - 1 ;
u.isOpera  =  u.getUserAgent.indexOf( " Opera " )  !=   - 1 ;
u.isFireFox  =  u.getUserAgent.indexOf( "Firefox" )  !=   - 1 ;
u.isIE  =  u.getUserAgent.indexOf( "MSIE" )  !=   - 1 ;
/*绑定方法*/
u.bindFunction  =  function  (el, fucName) {
     return   function  () {
         return  el[fucName].apply(el, arguments);
    };
};
/*设置层居中*/
u.setC = function (el)
{
	el.style.top=u.setPx(document.documentElement.scrollTop+60);
	el.style.left=u.setPx(document.documentElement.clientWidth/2-el.offsetWidth/2);
}
/*设置层居右上*/
u.setL = function (el)
{
	el.style.top=u.setPx(document.documentElement.scrollTop+1);
	el.style.left=u.setPx(document.documentElement.clientWidth-el.offsetWidth-2);
}
/*----------------------------------------*/
/*获得HTML编码字符串*/
u.hE = function (em){return escape(em);}
/*获得HTML解码字符串*/
u.hU = function  (em){return unescape(em);}
/*格式成整数*/
u.pInt = function (em){return parseInt(em);}
/*格式成浮点数*/
u.pFloat = function (em) {return parseFloat(em);} 
/*字符长度*/
u.sL = function (em) {return em.length;}
/*是否是数字*/
u.isNum = function (em) {return isNaN(em)}
/*随机数*/
u.r = function (em) {return Math.floor(Math.random()*em);}

/*----------------------------------------*/
/*信息写入*/
u.m = function (el,em) {u.g(el).innerHTML=em;}
/*信息显示*/
u.a = function (em){alert(em)}
/*----------------------------------------*/

/*获取对象*/
u.g  =   function  (em) {return document.getElementById(em);};
/*锁定解锁对象*/
u.setLock = function (el,bl) {if(u.isIE){if(bl){el.setCapture();}else{el.releaseCapture();}}}
/*+px*/
u.setPx = function (em) {return em+"px";}
/*获取鼠标位置*/
u.mousePos;
u.mouseMove = function mouseMove(ev){ev  = ev || window.event;u.mousePos = u.mouseCoords(ev);}
u.mouseCoords = function mouseCoords(ev){
	if(ev.pageX || ev.pageY){
		return {x:ev.pageX, y:ev.pageY};
	}
	return {
		x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
		y:ev.clientY + document.body.scrollTop  - document.body.clientTop
	};
}
/*Cookie类*/
u.writeCookie = function (name, value, hours){
  var expire = "";
  if(hours != null){
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}
u.readCookie = function (name){
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue;
}

/*-------------------------U工具对象--------------------------*/

u.D  =   function  (name) {
    return document.createElement(name);
};

 /*屏幕最大*/
u.w  =   function  (){
 	//self.moveTo(0,0) 
	//self.resizeTo(screen.availWidth,screen.availHeight) 
}

u.cW = function (){
	document.write("<a href=javascript:close()>关闭窗口</a>") 
}