function switchTab(tabpage,tabid){
        var oItem = document.getElementById(tabpage); 
		var children=oItem.getElementsByTagName("li");
	for(var i=0;i<children.length;i++){
		var x = children[i];	
		
		x.className = "";
		var y = x.getElementsByTagName('a');
	}	
	document.getElementById(tabid).className = "Selected";
	//var dvs=document.getElementById("cnt").getElementsByTagName("div");
	var dvs=$(".HackBox");
	for (var i=0;i<dvs.length;i++){
	  if (dvs[i].id==('d'+tabid))
	    dvs[i].style.display='block';
	  else
  	  dvs[i].style.display='none';
	}
}

//排行榜JS
 function fodn(obj)
				  {
					var pn = obj.parentNode.parentNode.parentNode.parentNode;
					var pn1 = obj.parentNode.getElementsByTagName("div");
					var tn = pn.getElementsByTagName("tr")[1].getElementsByTagName("ul");
					var nn = pn1.length;
					for(i=0;i<nn;i++)
					{
						if(pn1[i] == obj)
						{
							pn1[i].className = "sn";
							tn[i].className = "dis";
						}
						else
						{
							pn1[i].className = "cardn";
							tn[i].className = "undis";				
						}
					}
				  }

//图片适应大小不变形JS
var flag=false; 
function DrawImage(ImgD,widths,heights){ 
 var image=new Image(); 
 var iwidth = widths;  //定义允许图片宽度 
 var iheight = heights;  //定义允许图片高度 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
 flag=true; 
 if(image.width/image.height>= iwidth/iheight){ 
  if(image.width>iwidth){   
  ImgD.width=iwidth; 
  ImgD.height=(image.height*iwidth)/image.width; 
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  ImgD.alt=image.width+"×"+image.height; 
  } 
 else{ 
  if(image.height>iheight){   
  ImgD.height=iheight; 
  ImgD.width=(image.width*iheight)/image.height;   
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
  ImgD.alt=image.width+"×"+image.height; 
  } 
 } 
} 