
function changeFont(typeSize){
    document.getElementById("fontLayer").style.fontSize =  typeSize + "px";
}
    
function OpenOrClose(id,type)
{
    $('#span_content' + id).slideToggle('fast');
    
    if(type== 0)
        document.getElementById("span_img" + id).innerHTML = "<a href='javascript:OpenOrClose(" + id + ",1)'><img src='images/icon2.jpg' style='border: 0px solid #ffffff;' /></a>";
    else
        document.getElementById("span_img" + id).innerHTML = "<a href='javascript:OpenOrClose(" + id + ",0)'><img src='images/icon1.jpg' style='border: 0px solid #ffffff;' /></a>";
}


//显示Topic分页
function movePreviewPages(obj,page, pages, url)
{
    showBottomPage(obj, page, page - 7, pages, url);
}

function moveNextPages(obj,page, pages, url)
{
    showBottomPage(obj, page, page + 7, pages, url);
}

function showBottomPage(obj,curPage,page,pages,url)
{
    if (pages == 0) pages = 1
    page = (page < 1) ? 1 : page
    page = (page > pages) ? pages : page
    returnValue = ""
    begin = (page < 4) ? 1 : page - 3
    if (pages - begin < 6) begin = pages - 6
    if (begin < 1) begin = 1

    if (begin != 1 && curPage != 1) returnValue += "<a href='" + url + "1'>[1]</a> ... "
    if (begin > 1) returnValue += "<a href='JavaScript:movePreviewPages(\"" + obj + "\"," + page + "," + pages + ",\"" + url + "\")'>[&lt;&lt;]</a>"
    for (i = begin; i < begin + 7 && i <= pages; i++)
    {
        returnValue += (i == curPage) ? "&nbsp;&nbsp;<font style='font-weight:bold'>[" + i + "]</font>" : "&nbsp;&nbsp;<a href='" + url + i + "'>[" + i + "]</a>"
    }
    if (pages > begin + 6) returnValue += "&nbsp;&nbsp;<a href='JavaScript:moveNextPages(\"" + obj + "\"," + page + "," + pages + ",\"" + url + "\")'>[&gt;&gt;]</a>"
    if (i <= pages && curPage != pages) returnValue += " ... <a href='" + url + pages + "'>[" + pages + "]</a>"
    document.getElementById(obj).innerHTML = returnValue
}

function showBottomPage2(obj,curPage,page,pages,url)
{
    if (pages == 0) pages = 1
    page = (page < 1) ? 1 : page
    page = (page > pages) ? pages : page
    returnValue = ""

    begin = (page < 4) ? 1 : page - 3
    if (pages - begin < 6) begin = pages - 6
    if (begin < 1) begin = 1

    if(page==1) 
        returnValue += "首页&nbsp;&nbsp;上一页";
    else
        returnValue += "<a href='" + url + "1'>首页</a>&nbsp;&nbsp;<a href='" + url + (page - 1) + "'>上一页</a>";
        
    for (i = begin; i < begin + 7 && i <= pages; i++)
    {
        returnValue += (i == curPage) ? "&nbsp;&nbsp;<font style='font-weight:bold'>[" + i + "]</font>" : "&nbsp;&nbsp;<a href='" + url + i + "'>[" + i + "]</a>"
    }
    
    if(page==pages) 
        returnValue += "&nbsp;&nbsp;下一页&nbsp;&nbsp;尾页";
    else
        returnValue += "&nbsp;&nbsp;<a href='" + url + (page + 1) + "'>下一页</a>&nbsp;&nbsp;<a href='" + url + pages + "'>尾页</a>";
    
    document.getElementById(obj).innerHTML = returnValue
}


function suitPic()
{
try
    {
    for (i = 0; i < document.images.length; i++)
        {
        if (document.images[i].width > 530)
            {
            width = document.images[i].width
            height = document.images[i].height
            n = document.images[i].width / 530
            document.images[i].width = 530
            document.images[i].height = height / n
            document.images[i].insertAdjacentHTML("AfterEnd", "<table border=0 width=100% cellspacing=0 cellpadding=0><tr><td style='padding-top: 4px;text-align:left'><a href='http://www.ChinaDragonFunds.com/photo.htm?url=" + document.images[i].src + "' target=_blank>" + document.images[i].src + "</a>|" + width + " × " + height + "</td></tr></table>")
            }
            
        }
    window.setTimeout("suitPic()", 1000)
    }
catch(e)
    {
    window.setTimeout("suitPic()", 1000)
    }
}
