function display_layer ( lay ) {
  with ( document.getElementById(lay).style ) {
    display = display == "block" ? "none" : "block";
  }
}

function visibility_layer ( lay ) {
  with ( document.getElementById(lay).style ) {
    visibility = visibility == "visible" ? "hidden" : "visible";
  }
}

function show_layer ( lay ) {
  document.getElementById(lay).style.visibility = "visible";
}

function hide_layer ( lay ) {
  document.getElementById(lay).style.visibility = "hidden";
}

function block_layer ( lay ) {
  document.getElementById(lay).style.display = "block";
}

function none_layer ( lay ) {
  document.getElementById(lay).style.display = "none";
}

function get_root_path ( ) {
  with ( document.location ) {
    for ( i = 0, j = 0; i < href.length; i++ ) {
      if ( href.charAt(i) == "/" && ++j >= ((href.search("http://localhost/") == 0 || href.search("http://127.0.0.1/") == 0) ? 4 : 3) ) {
        break;
      }
    }
    
    return href.substr(0,i);
  }
}

var root_path = get_root_path();

function display_layer_img ( lay_img ) {
  display_layer(lay_img);
  
  zippy_plus = new Image;
  zippy_plus.src = root_path+"/images/zippy_plus.gif";
  zippy_minus = new Image;
  zippy_minus.src = root_path+"/images/zippy_minus.gif";

  with ( document.getElementById(lay_img+"_img") ) {
    src = document.getElementById(lay_img).style.display == "block" ? zippy_minus.src : zippy_plus.src;
  }
}
