﻿function dshow(dname)
{
	document.getElementById("Chot").style.display='none';
	document.getElementById("Csutra").style.display='none';
	document.getElementById("Cnews").style.display='none';
	document.getElementById("Ccolor").style.display='none';
	document.getElementById("Shot").style.borderBottom='solid 1px gray';
	document.getElementById("Ssutra").style.borderBottom='solid 1px gray';
	document.getElementById("Snews").style.borderBottom='solid 1px gray';
	document.getElementById("Scolor").style.borderBottom='solid 1px gray';
	document.getElementById("C"+dname).style.display='';
	document.getElementById("S"+dname).style.borderBottom='';
}
function chapterUrl(sign)
{
    var tid=parseInt(document.getElementById("h_tid").value);
    var cid=parseInt(document.getElementById("h_cid").value);
    var pid=parseInt(document.getElementById("s1").value);
    var num=parseInt(document.getElementById("h_num").value);
    if(sign==0)
    {
        if(--pid<1)
            alert('当前是第一页');
        else
            location=cid+"_"+pid+".html";
    }
    else
    {
        if(++pid>num)
        {
            alert('当前已经书是最后一页');
            location="../"+tid;
        }
        else
            location=cid+"_"+pid+".html";
    }
}
function selectUrl(obj)
{
    var tid=parseInt(document.getElementById("h_tid").value);
    var cid=parseInt(document.getElementById("h_cid").value);
    var pid=parseInt(obj.options[obj.selectedIndex].value);
    location=cid+"_"+pid+".html";
}
function selectValue()
{
    var pid=GetUrlParam();
    if(pid==null) pid=1;
    document.getElementById("s1").value=pid;
    document.getElementById("s2").value=pid;
}
//提取链接串后面的参数
function GetUrlParam()
{
    var sValue = unescape(location).match(/_(\d+)\./i);
    return sValue ? sValue[1] : sValue;
}
