function createReqObj(){
    var browser = navigator.appName;
    var reqObj;

    if(browser == "Microsoft Internet Explorer"){
        reqObj = new ActiveXObject("Microsoft.XMLHTTP");
    } else {
        reqObj = new XMLHttpRequest();
    }
    return reqObj;
}

var http = createReqObj(); // Set http to the proper object by calling the function we just created

function loadCourses(semesterid ) {
	//alert(semesterid);
	http.open('get', 'loadCourses.php?semesterid='+semesterid);
    http.onreadystatechange = handleResponseLoadCourses;
    http.send(null);
}

function handleResponseLoadCourses(){
    if(http.readyState == 4) { 
	 // alert(http.responseText);
	  var response = http.responseText; 
	  document.getElementById("coursesSelect").innerHTML = response;
     // alert("It worked");
    }
}

function showDescription(area, id ) {
  whichLayer=area+id;
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  
   elem = document.getElementById( area+'Link'+id );
	elem.innerHTML=(vis.display==''||vis.display=='block')?'Hide description':'View description';
}

function showInfo(area, id )
{
  whichLayer=area+id;
  var elem, vis;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'inline':'none';
  vis.display = (vis.display==''||vis.display=='inline')?'none':'inline';
  
   elem = document.getElementById( area+'Link'+id );
	elem.innerHTML=(vis.display==''||vis.display=='inline')?'':'&nbsp;&raquo;more';
}
