function putHelpBox(n,t)
{
  var newtext = document.createTextNode(t);
  var para = document.getElementById(n);
  para.style.background="#ffffcc";
  para.style.border="1px #009 solid";
  para.style.color="#000099";
  para.style.marginLeft="10px"
  para.style.fontWeight="bold"
  para.style.width="211px"
  //para.appendChild(newtext);
  //para.appendChild(document.createTextNode("<BR><a href=Javascript:void(1); onClick=Javascript:hideHelpBox(n);>[Hide]</a>"));
  document.getElementById(n).innerHTML = t+'<BR><a href="Javascript:void(1);" onClick="Javascript:hideHelpBox(\''+n+'\');">[Hide]</a>';
}
function hideHelpBox(n)
{
  document.getElementById(n).style.background="#ffffff";
  document.getElementById(n).innerHTML = '';
}
//------------------------------------------------------------------------
// use by making the text up and putting into a php var WITH NO line breaks, and placing at the bottom the hide link:
// <a href=\"Javascript:void(1);\" onClick=\"Javascript:hideEasyNote('enot','$txt');\">[Hide]</a>. Must go into a <DIV id=enot>
function putEasyNote(n,t)
{
  var newtext = document.createTextNode(t);
  var para = document.getElementById(n);
  para.style.background="#ffffff";
  para.style.border="none";
  para.style.color="#000000";
  para.style.marginLeft="10px"
  para.style.fontWeight="normal"
  para.style.width="411px"
  //para.appendChild(newtext);
  //para.appendChild(document.createTextNode("<BR><a href=Javascript:void(1); onClick=Javascript:hideHelpBox(n);>[Hide]</a>"));
  document.getElementById(n).innerHTML = t+'<BR><a href="Javascript:void(1);" onClick="Javascript:hideEasyNote(\''+n+'\',\''+t+'\');">[Hide notes]</a>';
}
function hideEasyNote(n,t)
{
  document.getElementById(n).style.background="#ffffff";
  document.getElementById(n).innerHTML = '';
  document.getElementById(n).innerHTML = '<BR><a href="Javascript:void(1);" onClick="Javascript:putEasyNote(\''+n+'\',\''+t+'\');">[Show notes]</a>';
}



//------------------------------------------------------------------------

var IB_Blab; 
function IB_processReqChange() 
{
 if(req.readyState == 4) 
 {
   if(req.status == 200)
   {
     document.getElementById(IB_Blab).innerHTML = req.responseText;
   }
   else
     document.getElementById(IB_Blab).innerHTML = '<font color=red>11 Failed to retrieve data from server. Try again.</font>';
 }
}
//------------------------------------------------------------------------
// Ba is location in the page, swi is the switch, arg is the argument, val is the value. duh
function general_data_get(url,Ba,swi,arg,val)
{
  // Gets and puts in an editor for targeting information
  IB_Blab = Ba;
  furl = url+"?loc="+Ba+"&swi="+swi+"&arg="+arg+"&val="+val;

  document.getElementById(IB_Blab).innerHTML = '<i>Working...</i>';
  if(window.XMLHttpRequest) 
  {
    req = new XMLHttpRequest();
    req.onreadystatechange = IB_processReqChange;
    req.open("GET", furl, true);
    req.send(null);
  } 
  else if(window.ActiveXObject) 
  {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if(req) 
    {
      req.onreadystatechange = IB_processReqChange;
      req.open("GET", furl, true);
      req.send();
    }
  }
}


//------------------------------------------------------------------------
// Ba is location in the page, swi is the switch, arg is the argument, vid is the id of the field value
function general_data_get_ById(url,Ba,swi,arg,vid)
{
  // Gets and puts in an editor for targeting information
  IB_Blab = Ba;
  var val = document.getElementById(vid).value;
  //alert("d:"+vid+" V:"+val);
  furl = url+"?loc="+Ba+"&swi="+swi+"&arg="+arg+"&val="+val;

  document.getElementById(IB_Blab).innerHTML = '<i>Working...</i>';
  if(window.XMLHttpRequest) 
  {
    req = new XMLHttpRequest();
    req.onreadystatechange = IB_processReqChange;
    req.open("GET", furl, true);
    req.send(null);
  } 
  else if(window.ActiveXObject) 
  {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    if(req) 
    {
      req.onreadystatechange = IB_processReqChange;
      req.open("GET", furl, true);
      req.send();
    }
  }
}
