﻿// JScript 文件

$(function(){
          
    });
    

//调整DIV的高度
function adjustHeight(){
    var lDiv=document.getElementById("news-cnt");   //内容页左边外层DIV
    var rDiv=document.getElementById("grid3_new");    //内容页右边外层DIV
    lDiv.style.height="auto";
    rDiv.style.height=2900;
    if(lDiv.scrollHeight>2900){
        rDiv.style.height=lDiv.scrollHeight;
    }else{
        lDiv.style.height=2900;
    }
}

    
    
//截取字符串
function clipString(str,len){
    if(str.length>len){
        return str.substring(0,len)+"...";
    }else{
        return str;
    }
}


//每隔10毫秒秒检测一次页面是否加载完毕
    var _timer = setInterval(function() { 
       if (/loaded|complete/.test(document.readyState)) {
         clearInterval(_timer);
         adjustHeight();    //加载完毕后重新调整左右DIV的高度
       }
    }, 10);
    
    


//调整文章字体大小
    function adjustFontSize(type){ 
        var contentObj=document.getElementById("news-body").childNodes;
        var fontNum;
        switch(type){
            case "big":
                fontNum="16px";
                break;
            case "middle":
                fontNum="14px";
                break;
            case "little":
                fontNum="12px";
                break;
            default:
                fontNum="14px";
        }
        document.getElementById("news-body").style.fontSize=fontNum;
        for(var i=0;i<contentObj.length;i++){
            if(contentObj[i].hasChildNodes){
                var sunNodes=contentObj[i].childNodes;
                for(var j=0;j<sunNodes.length;j++){
                    if(sunNodes[j].nodeType==1){
                        sunNodes[j].style.fontSize=fontNum;
                    }
                }
            }else{
                contentObj[i].style.fontSize=fontNum;
            }
        }
    }
        
    

    
    
