// JavaScript Document

function TuneHeight(fm_name,fm_id){  
    var frm=document.getElementById(fm_id);  
    var subWeb=document.frames?document.frames[fm_name].document:frm.contentDocument;  
    if(frm != null && subWeb != null){
        frm.style.height = subWeb.documentElement.scrollHeight+"px";
//如需自适应宽高，去除下行的“//”注释即可
     frm.style.width = subWeb.documentElement.scrollWidth+"px";
    }  
}  


function display_news(h_id,s_id,i_id) //newsTag切换
{
	document.getElementById(h_id).className="display_n";
	document.getElementById(i_id).className="display_n";
	document.getElementById(s_id).className="";
	
	ha=h_id+"_sp";
	ia=i_id+"_sp";
	sa=s_id+"_sp";
	document.getElementById(ha).className="news_a_ns2 fl";
	document.getElementById(ia).className="news_a_ns2 fl";
	document.getElementById(sa).className="news_a_ns1 fl";
}




function loca(loca_id,loca_name,loca_url)
{
	var a=document.getElementById(loca_id);
	a.innerHTML=loca_name;
	a.className="loca_next fl";
	if(loca_url!='')
	{a.href=loca_url;}
	
}




function AutoResizeImage(maxWidth,maxHeight,objImg){
var img = new Image();
img.src = objImg.src;
var hRatio;
var wRatio;
var Ratio = 1;
var w = img.width;
var h = img.height;
wRatio = maxWidth / w;
hRatio = maxHeight / h;
if (maxWidth ==0 && maxHeight==0){
Ratio = 1;
}else if (maxWidth==0){//
if (hRatio<1) Ratio = hRatio;
}else if (maxHeight==0){
if (wRatio<1) Ratio = wRatio;
}else if (wRatio<1 || hRatio<1){
Ratio = (wRatio<=hRatio?wRatio:hRatio);
}
if (Ratio<1){
w = w * Ratio;
h = h * Ratio;
}
objImg.height = h;
objImg.width = w;
}
//--> 

function changeTab(index)
        {
            for (var i=1;i<=2;i++)
            {
                document.getElementById ("Post"+i).className ="noline td_rm nt2";
                document.getElementById ("Post"+index).className ="noline td_rm nt1";
                document.getElementById ("DivP"+i).style.display  ="none";
            }
            
            //document.getElementById ("DivP1").innerText= "www.codefans.net"+index;
            document.getElementById ("DivP"+index).style.display  ="block";
       }
	   
function changeTabUnits(index)
        {
            for (var i=1;i<=2;i++)
            {
                document.getElementById ("Units"+i).className ="noline td_rm nt2";
                document.getElementById ("Units"+index).className ="noline td_rm nt1";
                document.getElementById ("DivU"+i).style.display  ="none";
            }
            
            //document.getElementById ("DivP1").innerText= "www.codefans.net"+index;
            document.getElementById ("DivU"+index).style.display  ="block";
       }

function changeTabNews(index)
        {
            for (var i=1;i<=2;i++)
            {
                document.getElementById ("News"+i).className ="news_a_ns2 fl";
                document.getElementById ("News"+index).className ="news_a_ns1 fl";
                document.getElementById ("DivN"+i).style.display  ="none";
            }
            
            //document.getElementById ("DivP1").innerText= "www.codefans.net"+index;
            document.getElementById ("DivN"+index).style.display  ="block";
       }
	   
	   function changeTabMat(index)
        {
            for (var i=1;i<=2;i++)
            {
                document.getElementById ("Mat"+i).className ="news_a_ns2 fl";
                document.getElementById ("Mat"+index).className ="news_a_ns1 fl";
                document.getElementById ("DivM"+i).style.display  ="none";
            }
            
            //document.getElementById ("DivP1").innerText= "www.codefans.net"+index;
            document.getElementById ("DivM"+index).style.display  ="block";
       }



