//以ID返回一个对象
function $(o){ return (typeof o == "object") ? o: document.getElementById(o);}
//以Name返回所有对象
function $N(o){ return (typeof o == "object") ? o: document.getElementsByName(o);}
//以标签返回所有对象
function $T(o){ return (typeof o == "object") ? o: document.getElementsByTagName(o);}
function get_Body_Size(){
	var getBodySize = [];
	if(window.parent.window.innerHeight){//FF
		getBodySize[0] = window.parent.window.innerWidth;
		getBodySize[1] = window.parent.window.innerHeight;
	}else{
		with(window.parent.document.documentElement){
			getBodySize[0] = clientWidth;
			getBodySize[1] = clientHeight;
		}
	}
	return getBodySize;
}

function OnLoad(type,fun){
	if(typeof window.addEventListener!='undefined'){
		window.addEventListener(type,fun,false)
	}else if(typeof document.addEventListener!='undefined'){
		document.addEventListener(type,fun,false)
	}else if(typeof window.attachEvent!='undefined'){
		window.attachEvent("on"+type,fun)
	}
}
function isIE(){
	return (document.all && window.ActiveXObject && !window.opera) ? true : false;
}

function Rnd_Num(n){
	var rnd="";
	for(var i=0;i<n;i++)
		rnd+=Math.floor(Math.random()*10);
	return rnd;
}
//<a onclick="addBookmark()" href="javascript:void(0)">加入收藏</a>
function addBookmark(){
	var url=parent.location.href;
	var title=document.title
	if (window.sidebar){
		window.sidebar.addPanel(title,url,"")
	}else if( document.all ){
		window.external.AddFavorite(url,title)
	}else if( window.opera && window.print ){
		alert("未知错误！");
	}
}
//<A onclick=SetHome(this) href="javascript:void(0)" target=_top>设为首页</A>
function SetHome(obj){
	var vrl=window.location;
	try{
		obj.style.behavior='url(#default#homepage)';
		obj.setHomePage(vrl);
	}catch(e){
		if(window.netscape){
			try {
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			}catch(e){ 
				alert("抱歉！您的浏览器不支持直接设为首页。请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为“true”，点击“加入收藏”后忽略安全提示，即可设置成功。");  
			}
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			prefs.setCharPref('browser.startup.homepage',vrl);
		}
	}
}
function correctPNG()
   {
   for(var i=0; i<document.images.length; i++)
      {
     var img = document.images[i]
     var imgName = img.src.toUpperCase()
     if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
        {
       var imgID = (img.id) ? "id='" + img.id + "' " : ""
       var imgClass = (img.className) ? "class='" + img.className + "' " : ""
       var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
       var imgStyle = "display:inline-block;" + img.style.cssText
       if (img.align == "left") imgStyle = "float:left;" + imgStyle
       if (img.align == "right") imgStyle = "float:right;" + imgStyle
       if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle     
       var strNewHTML = "<span " + imgID + imgClass + imgTitle
       + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
        + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
       + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
       img.outerHTML = strNewHTML
       i = i-1
        }
      }
   }
function correctPNG()
{
  for(var i=0; i<document.images.length; i++)
  {
   var img = document.images[i]
   var imgName = img.src.toUpperCase()
   if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
   {
   var imgID = (img.id) ? "id='" + img.id + "' " : ""
   var imgClass = (img.className) ? "class='" + img.className + "' " : ""
   var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
   var imgStyle = "display:inline-block;" + img.style.cssText
   if (img.align == "left") imgStyle = "float:left;" + imgStyle
   if (img.align == "right") imgStyle = "float:right;" + imgStyle
   if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
   var strNewHTML = "<span " + imgID + imgClass + imgTitle
   + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
   + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
   + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
   img.outerHTML = strNewHTML
   i = i-1
   };
  };
};
if(navigator.userAgent.indexOf("MSIE")>-1)
{
window.attachEvent("onload", correctPNG);
};

