var ns4 = (document.layers) ? 1 : 0;
var ie4 = (document.all) ? 1 : 0;
var std = (document.getElementById) ? 1 : 0;
var ns6 = std && !ie4;
var delayhide=0;

function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function hide_popup() {
  winobj = MM_findObj('popwin');
  winobj.thestyle = (winobj.style) ?  winobj.style : winobj;
  winobj.thestyle.visibility="hidden";
  return false;
}

function show_popup(link) {
  winobj = MM_findObj('popwin');
  theframe = MM_findObj('dest');

  if (!winobj || !theframe) return true;			// process link normally
  if (link.target) {
    d = link.target;
  } else {
    d = link.srcElement;
  }
  theframe.target = "_self";
  if (d.href.indexOf("?") > -1) {
	  theframe.src = d.href + "&pop=1";
  } else {
	  theframe.src = d.href + "?pop=1";
  }
 
  winobj.thestyle = (winobj.style) ?  winobj.style : winobj;
  winobj.contentwidth=(ie4||ns6) ? winobj.offsetWidth : winobj.document.gui.document.width;
  winobj.contentheight=(ie4||ns6) ? winobj.offsetHeight : winobj.document.gui.document.height;


  var d;  
  if (ns4) {
      x = d.x; 
      y = d.y + d.height + top.pageYOffset;
  } else if (std) {
      x=d.offsetLeft; 
      y=d.offsetTop + d.offsetHeight;
      while (d.offsetParent) {
        d = d.offsetParent;
        x += parseInt(d.offsetLeft);
        y += parseInt(d.offsetTop);
      }
  } else {
      d = window.event.srcElement;
      x=d.offsetLeft; 
      y=d.offsetTop + d.offsetHeight;
      while (d.offsetParent) {
        d = d.offsetParent;
        x += parseInt(d.offsetLeft);
        y += parseInt(d.offsetTop);
      }
  }

  x -= 2;
  if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4) {
    x += "px"; y += "px";
  }
  if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1) {
    x += parseInt(document.body.leftMargin); x += "px";
    y += parseInt(document.body.topMargin); y += "px";
  }

  winobj.thestyle.left = x;
  winobj.thestyle.top = y;
  winobj.thestyle.visibility="visible";
  return false;
}

function generate_window(ht, title) {
 
  if (!ns4 && !ns4 && !std) return;
  document.write('<div id="popwin" class="menuskin"><table border="0" width="430" cellpadding="2" cellspacing="0">');
  document.write('<tr><td width="16" bgcolor="#429208"><img src="/img/favicon.gif" width="16" height="16"></td><td width="392" height="18" class="menutext" background="/img/bar_window.gif">' + title + '</td><td width="18" bgcolor="#b5e384"><a href="#" onclick="return hide_popup();"><img src="/img/btn_close.gif" width="16" height="14" border="0"></a></td></tr>');
  document.write('<tr><td colspan="3"><iframe src="about:blank" width="425" height="' + ht + '" frameborder="0" id="dest"></iframe></td></tr></table></div>');

}