
//Hides or displays objects according to their ID
function display_object(pID,pStatus) {
  var trObj = (document.getElementById) ? document.getElementById(pID) : eval("document.all['" + pID + "']");
  if (trObj != null) {
    //alert("ID:"+pID+", Display:"+trObj.style.display);
    if (pStatus == 1) {
      trObj.style.display="";
    }
    else {
      trObj.style.display="none";
    }
  }
}

function focus_object(pID){
  getObj(pID).focus();
}

//Returns object of selected ID
function getObj(pObjName){
  return document.getElementById(pObjName);
}


//Interface to replace the InnerHTML of any html with an unique ID
function replace_text(pObj, pText){
  getObj(pObj).innerHTML = pText;
}

//
// End support functions
//

function set_class(pID, pClass){
  getObj(pID).className = pClass;
}

sLastDiv = "";

function showDiv(pID){
 if (sLastDiv != pID){
   display_object("div_" + pID,true)
   display_object("div_" + sLastDiv,false)
   sLastDiv = pID;
 }
}


//
// Ajax Interface
//

var xmlHttp = null;
// Mozilla, Opera, Safari sowie Internet Explorer (ab v7)
if (typeof XMLHttpRequest != 'undefined') {
    xmlHttp = new XMLHttpRequest();
}
if (!xmlHttp) {
    // Internet Explorer 6 und älter
    try {
        xmlHttp  = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
        try {
            xmlHttp  = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(e) {
            xmlHttp  = null;
        }
    }
}


gTargetID = "";

function getContent(pTargetID,pTargetURL) {
    //alert(pTargetURL);
    gTargetID = pTargetID;
    xmlHttp.open("GET", pTargetURL);
    xmlHttp.onreadystatechange = showContent;
    xmlHttp.send(null);
}

function showContent() {
  if (xmlHttp.readyState == 4) {
    var d = document.getElementById(gTargetID);
    d.innerHTML = xmlHttp.responseText;
    //alert(XMLHTTP.responseText);
  }
}

