
function loadHandler(req, pageName, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML="load error:\n"+req.statusText;
    }
  }
}



function loadContent(pageName,target) {
    var req;
    document.getElementById(target).innerHTML = 'waiting...';
    
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
    } else if (window.ActiveXObject) {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    if (req != undefined) {
        req.onreadystatechange = function() {loadHandler(req, pageName, target);}
        req.open("GET", pageName, true);
        req.send("");
    } else {
        document.getElementById(target).innerHTML = "<p>Your browser does not support javascript properly. Please consider using a recent browser like <a href=\"http://www.mozilla.com/en-US/firefox/\">FireFox</a>.</p>";
    }
}  



function loadPageIntoDiv(url) {
    if (url != undefined) {
        loadContent(currentDomain + "/" + url,'frame');
    }
}


function highlight(id,url) {
    if (id == lastid) return;
    
    document.getElementById(id).style.fontWeight = "bold";
    document.getElementById(id).style.color = "#424242";
    if (lastid != 'none') {
        document.getElementById(lastid).style.fontWeight = "normal";
        document.getElementById(lastid).style.color = "#706666";
    }
    lastid = id;
    
    loadPageIntoDiv(url);
}

function highlightParent(id) {
    if (id == parent.lastid) return;
    
    parent.document.getElementById(id).style.fontWeight = "bold";
    parent.document.getElementById(id).style.color = "#424242";
    if (parent.lastid != 'none') {
        parent.document.getElementById(parent.lastid).style.fontWeight = "normal";
        parent.document.getElementById(parent.lastid).style.color = "#706666";
    }
    parent.lastid = id;
}

function hoverIn(id) {
    if (id == lastid) return;
    
    document.getElementById(id).style.color = "#424242";
}

function hoverOut(id) {
    if (id == lastid) return;
    
    if (id != null) {
        document.getElementById(id).style.color = "#706666";
    }
}

function InitPage() {
    highlight('aboutButton','about.htm'); 
}

/// krystian: used in code.htm
function showWindow(menuChoice,size1) {
        //Sub-Menus
          window.open(menuChoice,"_blank",size1);
}

/// krystian: used in data.htm
function showWindow(menuChoice) {
        //Sub-Menus
         window.open(menuChoice,"_blank","width=620,height=426,scrollbars=yes");
         
         
}