function GetScrOfY() {
  scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    scrOfY = window.pageYOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfY = document.documentElement.scrollTop;
  }
  return scrOfY;
}
function GetScrOfX() {
  scrOfX = 0;
  if( typeof( window.pageXOffset ) == 'number' ) {
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfX = document.documentElement.scrollLeft;
  }
  return scrOfX;
}

function pageWidth() {
return window.innerWidth != null? window.innerWidth :
document.documentElement && document.documentElement.clientWidth ?
document.documentElement.clientWidth : document.body != null ?
document.body.clientWidth : null;
}

function ahah3(url, target, w) {
  var bar_func = document.getElementById("bar");
  bar_func.style.visibility="visible";
  bar_func.style.visibility="visible";
	
  bar_func.onclick=function() {
	  close_bar();
  }
  var bar_window = document.getElementById("bar_win");
  bar_window.style.visibility="visible";
  
  var scrOfY = GetScrOfY();
  var scrOfX = GetScrOfX();
  
  if (w!="") 
  {
    document.getElementById(target).innerHTML = '<div style="width: '+w+'; height: 100px; padding: 60px 0 0 0"><center>Loading...</center></div>';
    if (bar_window.style.width!=w) bar_window.style.width=w;
    bar_window.style.top = scrOfY+110+"px";
    bar_window.style.left = Math.round(pageWidth()/2)+270+"px";
  }
   else
  {
    document.getElementById(target).innerHTML = '<div style="height: 100px; padding: 60px 0 0 0"><center>Loading...</center></div>';
    bar_window.style.top = scrOfY+250+"px";
    bar_window.style.left = Math.round(pageWidth()/2)-130+"px";
  }
  
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) {
    if (req.status == 200) {
    
var newdiv = document.createElement("div");
newdiv.innerHTML = req.responseText;
var container = document.getElementById(target);
container.innerHTML = "";
container.appendChild(newdiv);    

    } else {
      document.getElementById(target).innerHTML="<div style='width: 550px; height: 100px; padding: 60px 0 0 0'><center>Error:\n"+ req.status + "\n" +req.statusText+"</center></div>";
    }
  }
}

function close_bar() {
  document.getElementById("bar").style.visibility="hidden";
  document.getElementById("bar").style.display="none";
  document.getElementById("bar_win").style.visibility="hidden";
}

function winload2(name) {
	ahah3(name,"bar_win","");
	return false;
}

function winload3(name) {
	ahah3(name,"bar_win","550px");
	return false;
}

function blockOpen(nnn)
{
	if (document.getElementById('sel'+nnn).style.display=="block") document.getElementById("sel"+nnn).style.display="none"; else document.getElementById("sel"+nnn).style.display="block";
	return false;
}