	/**
	* Functions for the information box on the undergraduate page.
	* April 30th, 2008
	*/

	function transStart(num){
		
		if(num != presentID){
		
			if($(div1).fx){$(div1).fx.stop();}
			if($(div2).fx){$(div2).fx.stop();}
			$(div1).fx = $(div1).effect('opacity', {duration: dur}).start(0)
			$(div2).fx = $(div2).effect('opacity', {
										duration: (dur),
										onComplete: function(){
											getNumber(num, 1);
										}}).start(0);
			
		}
		return false;
	}
	
	function transFin(){
		
		if($(div1).fx){$(div1).fx.stop();}
		if($(div2).fx){$(div2).fx.stop();}
		$(div1).fx = $(div1).effect('opacity', {duration: dur}).start(1)
		$(div2).fx = $(div2).effect('opacity', {duration: dur}).start(1)
	}
	
	/**
	* The function in charge of loading the new story information.
	*
	* @param num The number of the new story.
	*/
	function getNumber(num, fin){
	
		var params = "storyID=" + num;
		var ajaxRequest;
				
		try{
			// Opera 8.0+, Firefox, Safari
			ajaxRequest = new XMLHttpRequest();
		} catch (e){
			// Internet Explorer Browsers
			try{
				ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
				try{
					ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
				} catch (e){
					// Something went wrong
					alert("Your browser broke!");
					return false;
				}
			}
		}
		
		/**
		* The ajax request in charge of retrieving and setting
		* the correct story information from the PHP script.
		*/
		ajaxRequest.onreadystatechange = function(){
		
			if(ajaxRequest.readyState == 4){
				if (ajaxRequest.status == 200) {
					
					var ret = ajaxRequest.responseXML;					
					$(div1).innerHTML = ret.getElementsByTagName("title")[0].firstChild.data;
					
					var lol = ajaxRequest.responseText.split("mainlink>")[1];
					$(div2).innerHTML  = lol.substring(0, lol.length-2);
					
					if(fin == 1){transFin();}
				}
			}
		}
		
		//The actual ajax call.
		ajaxRequest.open("POST", '/ugrad_info/content/divGetter.php', true);
		ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		ajaxRequest.setRequestHeader("Content-length", params.length);
		ajaxRequest.setRequestHeader("Connection", "close");
		ajaxRequest.send(params);
		presentID = num;
		
	}