function checkbrowser()
{
  is_ns4 = false;
  is_ie4 = false;
  is_dom = false;
  if (document.layers) {
    is_ns4 = true;
  }
  if (document.all && !document.getElementById) {
    is_ie4 = true;
  }
  if (document.getElementById) {
    is_dom = true;
  }
}

function ini()
{
  if (is_ie4)
  {
    h_scr=document.all.hotsc.offsetHeight;
    h_vsc=s_swh;
    h_sbm=s_smh;
    h_sbr=h_sbm*h_vsc/h_scr;
    document.all.hoscb.style.height=Math.round(h_sbr);
  } else if (is_ns4) {
    h_scr=document.layers["hovsc"].document.layers["hotsc"].clip.height;
    h_vsc=s_swh;
    h_sbm=s_smh;
    h_sbr=h_sbm*h_vsc/h_scr;
    document.layers["hoscm"].layers["hoscb"].clip.height=Math.round(h_sbr);
  } else if (is_dom) {
    h_scr=document.getElementById("hotsc").offsetHeight;
    h_vsc=s_swh;
    h_sbm=s_smh;
    h_sbr=h_sbm*h_vsc/h_scr;
    document.getElementById("hoscb").style.height=Math.round(h_sbr);
  }
  if (h_scr>s_swh) {
    go=true;
  }
}

function scr(b_sc1,b_sc2)
{
  if (go) {
    if ((b_sc2>=0-h_scr+h_vsc) && (b_sc2<=0)) {
      b_sc3=b_sc1;
      b_sc4=b_sc2;
    } else if (b_sc2>0) {
      b_sc3=0;
      b_sc4=0;
    } else if (b_sc2<0-h_scr+h_vsc) {
      b_sc3=h_sbm-Math.round(h_sbr);
      b_sc4=0-h_scr+h_vsc;
    }
    if (is_ie4)
    {
      document.all.hoscb.style.top=b_sc3;
      document.all.hotsc.style.top=b_sc4;
    } else if (is_ns4) {
      document.layers["hoscm"].layers["hoscb"].top=b_sc3;
      document.layers["hovsc"].layers["hotsc"].top=b_sc4;
    } else if (is_dom) {
      document.getElementById("hoscb").style.top=b_sc3;
      document.getElementById("hotsc").style.top=b_sc4;
    }
  }
}

function scu()
{
  if (go) {
    if (is_ie4)
    {
      b_vl1=Math.floor(document.all.hotsc.style.top.replace(/px/,""))+b_val;
    } else if (is_ns4) {
      b_vl1=Math.floor(document.layers["hovsc"].layers["hotsc"].top)+b_val;
    } else if (is_dom) {
      b_vl1=Math.floor(document.getElementById("hotsc").style.top.replace(/(px|pt)/,""))+b_val;
    }
    scr(0-Math.ceil(h_sbr*b_vl1/h_vsc),b_vl1);
    b_tmo=setTimeout("scu(5)",15);
  }
}

function scd()
{
  if (go) {
    if (is_ie4)
    {
      b_vl1=Math.floor(document.all.hotsc.style.top.replace(/px/,""))-b_val;
    } else if (is_ns4) {
      b_vl1=Math.floor(document.layers["hovsc"].layers["hotsc"].top)-b_val;
    } else if (is_dom) {
      b_vl1=Math.floor(document.getElementById("hotsc").style.top.replace(/(px|pt)/,""))-b_val;
    }
    scr(0-Math.ceil(h_sbr*b_vl1/h_vsc),b_vl1);
    b_tmo=setTimeout("scd(5)",15);
  }
}

function cmu() {
  if (go) {
    if (b_tmo) {
      clearTimeout(b_tmo);
      b_tmo="";
    }
  }
}

function writeHTML1() {
  if (is_ns4) {
    document.write('<ILAYER name="hovsc" clip="'+s_sww+','+s_swh+'" visibility="show">');
    document.write('<LAYER name="hotsc" visibility="show" width="'+s_sww+'">');
  } else if ((is_ie4) || (is_dom)) {
    document.write('<DIV id="hovsc" style="position:relative; overflow:hidden; width:'+s_sww+'px; height:'+s_swh+'px; visibility:visible" >');
    document.write('<DIV id="hotsc" style="position:relative; width:'+s_sww+'px; visibility:visible" >');
  }
}

function writeHTML4() {
  if (is_ns4) {
    document.write('<ILAYER name="hoscm" bgcolor="'+s_smc+'" clip="'+s_smw+','+s_smh+'" visibility="show">');
    document.write('<LAYER name="hoscb" width="'+s_smw+'" bgcolor="'+s_sbc+'" visibility="show">');
    document.write('</LAYER></ILAYER><br>');
  } else if ((is_ie4) || (is_dom)) {
    document.write('<DIV id="hoscm" style="position:relative; overflow:hidden; background-color:'+s_smc+'; width:'+s_smw+'px; height:'+s_smh+'px; visibility:visible" >');
    document.write('<DIV id="hoscb" style="position:relative; width:'+s_smw+'px; visibility:visible; background-color:'+s_sbc+'">');
    document.write('</DIV></DIV>');
  }
}

checkbrowser();

b_tmo="";
c_sbp=0;

s_sww=299;        // scroll window width
s_swh=271;        // scroll window height
s_smh=150;        // scrollbar max height
s_smw=6;          // scrollbar max width
s_smc="#D7B2A1";  // scrollbar max color
s_sbc="#987F64";  // scrollbar color
b_val=1;          // scroll rate

go=false;

onload=ini;

