// JavaScript Document
function getXMLHTTPRequest() {
	try {
		req = new XMLHttpRequest();
	} catch(err1) {
		try {
			req = new ActiveXObject("Msxml1.XMLHTTP");
		} catch(err2) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(err3) {
				req = false;
			}
		}
	}
	return req;
}

var http = getXMLHTTPRequest();

function getServerText() {
	var myURL = 'checkAngel.php';
	myRand = parseInt(Math.random()*999999999999999);
	var modURL = myURL+"?rand="+myRand;
	http.open("GET", modURL, true);
	http.onreadystatechange = useHttpResponse;
	http.send(null);
}

function useHttpResponse() {
	/*alert(http.readyState);*/
	if(http.readyState == 4) {
		if(http.status == 200) {
			var mytext = http.responseText;
			if(mytext == "website up") {
				document.getElementById('status').innerHTML = '<img src="assets/images/live.gif" border="0" class="centerImage" alt="Angel is Live" />';
			} else {
				document.getElementById('status').innerHTML = '<img src="assets/images/down.gif" border="0" class="centerImage" alt="Angel is Down" />';
			}
		}
	} else {
		document.getElementById('status').innerHTML = '<img src="assets/images/loading.gif" border="0" class="centerImage" alt="Loading" />';
	}
}


function getXMLHTTPRequest() {
	try {
		req = new XMLHttpRequest();
	} catch(err1) {
		try {
			req = new ActiveXObject("Msxml1.XMLHTTP");
		} catch(err2) {
			try {
				req = new ActiveXObject("Microsoft.XMLHTTP");
			} catch(err3) {
				req = false;
			}
		}
	}
	return req;
}

var http = getXMLHTTPRequest();

function getServerText2(movie,theDiv) {
	var myURL = 'content/FacultyVids.cfm?movie='+movie;
	myRand = parseInt(Math.random()*999999999999999);
	var modURL = myURL+"?rand="+myRand;
	http.open("GET", modURL, true);
	http.onreadystatechange = function() {
		if(http.readyState == 4) {
			if(http.status == 200) {
				document.getElementById(theDiv).innerHTML = http.responseText;
			}
		}else{
			document.getElementById(theDiv).innerHTML = '<img src="assets/images/loading2.gif">';
		}
	}
	http.send(null);
}


var winWidth = 760;
var winHeight = 750; 
function popupWindow(location){
	newWindow = window.open(location,'newWin','toolbar=no,location=no,scrollbars=yes,resizable=no,width='+winWidth+',height='+winHeight+',left=100,top=120');
	newWindow.focus();
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true); 


/* Function to toggle Sessions depending on if user selects summer or other semester
	on the Courses page. */
function toggle(myObject) {
	var semester = document.myForm.semester.value;
	var semSplit = semester.split(" ");
	//alert(semSplit[1]);
	if (semSplit[1] == "SUMMER") {
		//alert("lets change");
		document.getElementById("session1").style.display='block';
		document.getElementById("session2").style.display='none';
	}else{
		//alert("do it again");
		document.getElementById("session2").style.display='block';
		document.getElementById("session1").style.display='none';
	}
}

