var xmlhttp = false;
 ajaxFunction();

function ajaxFunction() {
try   {   // Firefox, Opera 8.0+, Safari
  xmlhttp=new XMLHttpRequest();
}
catch (e)   {   // Internet Explorer
  try     {
    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch (e)     {
    try       {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (e)       {
      alert("Your browser does not support AJAX!");
      return false;
    }
  }
}
}

function ajax_call() {
	xmlhttp.open("GET", 'ajaxWork.php?num1=' + 
					document.getElementById('num1').value + 
						'&num2=' + document.getElementById('num2').value , true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4) {
			document.getElementById('result').value = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null)
	return false;
}


function changePage(to) {
 xmlhttp.open("GET", 'navWork.php?to=' + to + '.php', true);
// transitionDiv('main'); //supposed to make the DIV FADE
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   document.getElementById('main').innerHTML = xmlhttp.responseText;
  } //endif readystate == 4
 } //endonreadystatechange function
 xmlhttp.send(null);
 return false; 
} // endfunc changePage

function pausecomp(millis)  {
/***************************************************
* Purpose: to pause for a number of milliseconds
* Receive: a number of milliseconds to pause
* Return: void()
***************************************************/
var date = new Date();
var curDate = null;

do { curDate = new Date(); } 
while(curDate-date < millis);
}  // endfunc pausecomp


function transitionDiv(divId) {
/********************************************
DOES NOT WORK AS INTENDED
*********************************************/

 var theColor = "99";  //hexadecimal starting point for transition to white (99 = #999999)
 var beginFontColor = document.getElementById(divId).style.color;
 var changeColor = null;
var iteration = 0;
 document.getElementById(divId).style.background = "#ffffff";
 document.getElementById(divId).style.color = "#ffffff";
 do {
  pausecomp(0);
  changeColor = '#' +theColor.toString()+theColor.toString()+theColor.toString()
  document.getElementById(divId).style.background = changeColor;
  document.getElementById(divId).style.color = changeColor;
  theColor = d2h(h2d(theColor)+1);
iteration++;
 } while (h2d(theColor) < 256);
  document.getElementById(divId).style.background = 'transparent';
  document.getElementById(divId).style.color = beginFontColor;
} //endfunc transitionDiv

function viewer(img) {
/**************************
* Purpose: to show the viewer, which will display a full size image
* Receive: img: path to the image to show
                * SPECIAL: "hide" will close the viewer
* Return: void()
*******************************/
 if(img == 0) {
  // behavior that will close the viewer
  document.getElementById('viewer').style.visibility = "hidden";
 } else {
  // behavior to show the full image
  document.getElementById('viewer').style.visibility = "visible";
  document.getElementById('viewerImage').src = img;
 }
//return;
} //endfunc viewer


function d2h(d) {return d.toString(16);}  // one line function converts decimal to hexadecimal
function h2d(h) {return parseInt(h,16);}  // one line function converts hexadecimal to decimal