function include(filename, afterfunc) {

  include.seq = (include.seq)? include.seq + 1: 1;

  var id = new Date().getTime() + "-" + include.seq;
  var inc = document.createElement("iframe");

  inc.id = "inc-" + id;
  inc.src = filename;
  inc.style.display = "none";
  document.write("<span id=\"" + id + "\"></span>");

  var incfunc = function() {

    var s = (function() {
      var suffix = (n = filename.lastIndexOf(".")) >= 0 ? filename.substring(n): "default";
      if (suffix == ".html") return inc.contentWindow.document.body.innerHTML;
      if (suffix == ".txt") return inc.contentWindow.document.body.firstChild.innerHTML;
      if (suffix == "default") return inc.contentWindow.document.body.innerHTML;
    })();

    var span = document.getElementById(id);

    var insertBeforeHTML = function(htmlStr, refNode) {
      if (document.createRange) {
        var range = document.createRange();
        range.setStartBefore(refNode);
        refNode.parentNode.insertBefore(range.createContextualFragment(htmlStr), refNode);
      } else {
        refNode.insertAdjacentHTML('BeforeBegin', htmlStr);
      }
    };

    insertBeforeHTML(s.split("&gt;").join(">").split("&lt;").join("<"), span);
    document.body.removeChild(inc);
    span.parentNode.removeChild(span);
    if (afterfunc) afterfunc();
  };

  if (window.attachEvent) {
    window.attachEvent('onload', 
      function() {
        document.body.appendChild(inc); 
        inc.onreadystatechange = function() { if (this.readyState == "complete") incfunc(); };
      });
  }
  else {
    document.body.appendChild(inc);
    inc.onload = incfunc;
  }
}

//ƒƒjƒ…[
submitted = false;
function formSubmit(button) {
  document.search.stype.value = "fre";
  document.search.action ="/wo/opc/srh_do/";
  document.search.target = '_self';
  document.search.submit();
}

function run_menu(act,tg) {
  //--submit
  document.menu.target = tg;
  document.menu.action = act;
  document.menu.submit();
}

var open_obj;
function toggle(p_id) {
  obj = document.getElementById(p_id);
  if (obj){
    if (obj.style.display == "none") {
      obj.style.display = "";
      if (open_obj) {
        if (open_obj != obj) { open_obj.style.display = "none"; }
      }
      open_obj = obj;
    } else {
      obj.style.display = "none";
    };
  }
}

function swapImgRestore() { //v3.0
  var i,x,a=document.Img_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.Img_p) d.Img_p=new Array();
  var i,j=d.Img_p.length,a=Img_preloadImages.arguments; 
  for (i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0) {
      d.Img_p[j]=new Image; d.Img_p[j++].src=a[i];
    }
  }
}

function findObj(n, d) { 
  var p,i,x;  
  if(!d) d=document; 
  if ((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
  }
  if(!(x=d[n])&&d.all) x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { 
  var i,j=0,x,a=swapImage.arguments; 
  document.Img_sr=new Array; 
  for(i=0;i<(a.length-2);i+=3)
  if ((x=findObj(a[i]))!=null){
    document.Img_sr[j++]=x; 
    if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
  }
}


