function showhidediv(whichDiv) {
if(document.getElementById(whichDiv).style.display == 'none')
{
document.getElementById(whichDiv).style.display = '';
}else{
document.getElementById(whichDiv).style.display = 'none';
}
}

function showdiv(whichDiv) {
document.getElementById(whichDiv).style.display = '';
}

function hidediv(whichDiv) {
document.getElementById(whichDiv).style.display = 'none';
}

function changeInput(toChange,valuetoGet) 
{
document.getElementById(toChange).value = document.getElementById(valuetoGet).value;
}

function replaceDivContent() 
{
this.child.innerHTML = ('TEST');
}

//BEGIN BASIC AJAX
function getHTTPObject()
{

    if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
    else if (window.XMLHttpRequest) return new XMLHttpRequest();
    else
    {
        alert("Your browser does not support AJAX.");
        return null;
    }

}

function setOutput(divID)
{
    return function ()
    {
        if(httpObject.readyState == 4)
        {
            document.getElementById(divID).innerHTML = httpObject.responseText;
        }
    }
}

function doWork(divID,phpLink,getVariables)
{

    httpObject = getHTTPObject();
    if (httpObject != null)
    {
        httpObject.abort();
        httpObject.open("GET", phpLink+'?timestamp='+Date()+getVariables, true);
        httpObject.onreadystatechange = setOutput(divID); 
        httpObject.send(null); 
    }

}

function chatDoWork(divID,phpLink,getVariables,clearField)
{

    httpObject = getHTTPObject();

    if (httpObject != null)
    {
        httpObject.abort();
        httpObject.open("GET", phpLink+'?timestamp='+Date()+divID+getVariables, true);
        httpObject.onreadystatechange = setOutput(divID); 
        httpObject.send(null);
        document.getElementById(clearField).value='';
        document.getElementById(divID).style.display = 'none';
        document.getElementById(divID).style.display = 'block';
    }

}
//END BASIC AJAX

function selectAll(selectBox,selectTorF) {
    
for (i = 0; i < document.getElementsByName(selectBox+'[]').length; i++)
{
	document.getElementsByName(selectBox+'[]')[i].checked = selectTorF;
}


}

