//µ¼º½Ê÷º¯Êý
NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
ver4 = (NS4 || IE4) ? 1 : 0;

if (ver4) {
with (document) {
write("<STYLE TYPE='text/css'>");
if (NS4) {
write(".parent {position:absolute; visibility:visible}");
write(".child {position:absolute; visibility:visible}");
write(".regular {position:absolute; visibility:visible}")
}else {
write(".child {display:none}")
}
write("</STYLE>");
}}

function getIndex(el) {
ind = null;
for (i=0; i<document.layers.length; i++) {
whichEl = document.layers[i];
if (whichEl.id == el) {
ind = i;
break;
}}
return ind;
}

function arrange() {
nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;
for (i=firstInd+1; i<document.layers.length; i++) {
whichEl = document.layers[i];
if (whichEl.visibility != "hide") {
whichEl.pageY = nextY;
nextY += whichEl.document.height;
}}}

function initIt(){
if (!ver4) return;
if (NS4) {
for (i=0; i<document.layers.length; i++) {
whichEl = document.layers[i];
if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
}
arrange();
}else {
divColl = document.all.tags("DIV");
for (i=0; i<divColl.length; i++) {
whichEl = divColl(i);
if (whichEl.className == "child") whichEl.style.display = "none";
}}}

function expandIt(el) {
if (!ver4) return;
if (IE4) 
{
	whichEl = eval(el + "Child");
	if (whichEl.style.display == "none") 
	{
		whichEl.style.display = "block";
		writeCookie(el,1,500);
	}
	else 
	{
		whichEl.style.display = "none";
		writeCookie(el,0,500);
	}
}
else 
{
	whichEl = eval("document." + el + "Child");
	if (whichEl.visibility == "hide") 
	{
		whichEl.visibility = "show";
		writeCookie(el,1,500);
	}
	else 
	{
		whichEl.visibility = "hide";
		writeCookie(el,0,500);
	}
arrange();
}
}
onload = initIt;

//writeCookie("font",2,500);	
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null) {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value)+ ";path=/" + expire;
}

//if(readCookie("font")=="1"){
function readCookie(name){
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0) { 
    offset = document.cookie.indexOf(search);
    if (offset != -1){ 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end));
    }
  }
  return cookieValue;
}
