﻿<!--
var request;
var info_tab_selected = null;
var start;
var end;
var steps = 101;

function getXmlHttpObject()
{
	var xmlHttp;
	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;
      		}
    	}
  	}
  	return xmlHttp;
}

function info_tab(id)
{
	if(id != info_tab_selected)
	{
		document.getElementById(id).className = "info_tab_select";
		document.getElementById(id).style.backgroundColor = "";
		if(info_tab_selected != null)
		{
			document.getElementById(info_tab_selected).className = "info_tab";
		}
		info_tab_selected = id;
		
		if (!request)
			request = getXmlHttpObject();
		else if (request.readyState != 0)
			request.abort(); 
		
		var date = new Date();
		var timestamp = date.getTime();
		
		request.onreadystatechange = function(){
			if(request.readyState == 1)
			{ 
				var element = document.getElementById("info_content");
				window.clearInterval(element.animation);
				steps = 0;
				if(!element.currentHeight){ element.currentHeight = 20; }
				element.animation = window.setInterval(
					function(){
						element.currentHeight = doAnimation(element.currentHeight, 110, steps, 100);
						element.style.height = element.currentHeight + "px";
						steps++;
						if(steps > 100){ window.clearInterval(element.animation); }
					}, 10);
				element.innerHTML = "<div style=\"text-align:center;\"><img src=\"images/loading.gif\" /></div>";
			}
			else if(request.readyState == 4)
			{ 
				var element = document.getElementById("info_content");
				window.clearInterval(element.waitingInterval);
				element.waitingInterval = window.setInterval(
				function(){
					if(steps > 100)
					{
						element.innerHTML = request.responseText;
						steps = 0;
						element.animation = window.setInterval(
						function(){
							element.currentHeight = doAnimation(element.currentHeight, element.scrollHeight, steps, 100);
							element.style.height = element.currentHeight + "px";
							steps++;
							if(steps > 100)
							{ 
								if(info_tab_selected == "info_dean_tab")
							  			element.style.height = "auto";
								window.clearInterval(element.animation); 
							}
						}, 10);
						window.clearInterval(element.waitingInterval);
					}
				}, 10);
			}
		};
		request.open("GET","sources/info/" + id +".php?update="+timestamp,true);
		request.send(null);
	}
}

function student_tab(id)
{
	if(id != info_tab_selected)
	{
		document.getElementById(id).className = "student_tab_select";
		document.getElementById(id).style.backgroundColor = "";
		if(info_tab_selected != null)
		{
			document.getElementById(info_tab_selected).className = "student_tab";
		}
		info_tab_selected = id;
		
		if (!request)
			request = getXmlHttpObject();
		else if (request.readyState != 0)
			request.abort(); 
		
		var date = new Date();
		var timestamp = date.getTime();
		
		request.onreadystatechange = function(){
			if(request.readyState == 1)
			{ 
				var element = document.getElementById("student_content");
				window.clearInterval(element.animation);
				steps = 0;
				if(!element.currentHeight){ element.currentHeight = 20; }
				element.animation = window.setInterval(
					function(){
						element.currentHeight = doAnimation(element.currentHeight, 110, steps, 100);
						element.style.height = element.currentHeight + "px";
						steps++;
						if(steps > 100){ window.clearInterval(element.animation); }
					}, 10);
				element.innerHTML = "<div style=\"text-align:center;\"><img src=\"images/loading.gif\" /></div>";
			}
			else if(request.readyState == 4)
			{ 
				var element = document.getElementById("student_content");
				window.clearInterval(element.waitingInterval);
				element.waitingInterval = window.setInterval(
				function(){
					if(steps > 100)
					{
						element.innerHTML = request.responseText;
						steps = 0;
						element.animation = window.setInterval(
						function(){
							element.currentHeight = doAnimation(element.currentHeight, element.scrollHeight, steps, 100);
							element.style.height = element.currentHeight + "px";
							steps++;
							if(steps > 100)
							{ 
								if(info_tab_selected == "student_activities")
							  			element.style.height = "auto";
								window.clearInterval(element.animation); 
							}
						}, 10);
						window.clearInterval(element.waitingInterval);
					}
				}, 10);
			}
		};
		request.open("GET","sources/students/" + id +".html?update="+timestamp,true);
		request.send(null);
	}
}

function openWindow(url)
{
	window.open(url);
}

function info_tabMouseover(id)
{
	if(id != info_tab_selected)
	{
		var tab = document.getElementById(id);
   		tab.style.backgroundColor = "#CCCCCC";
	}
}

function student_tabMouseoff(id)
{
  	if(id != info_tab_selected)
	{
		var tab = document.getElementById(id);
   		tab.style.backgroundColor = "#DDDDDD";
	}
}

function student_tabMouseover(id)
{
	if(id != info_tab_selected)
	{
		var tab = document.getElementById(id);
   		tab.style.backgroundColor = "#CCCCCC";
	}
}

function info_tabMouseoff(id)
{
  	if(id != info_tab_selected)
	{
		var tab = document.getElementById(id);
   		tab.style.backgroundColor = "#DDDDDD";
	}
}

function selectActivity(e)
{
	var index  = e.selectedIndex;
    var value = e.options[index].value;
	if(value != "")
	{
		if (!request)
			request = getXmlHttpObject();
		else if (request.readyState != 0)
			request.abort(); 
		
		var date = new Date();
		var timestamp = date.getTime();
		
		request.onreadystatechange = function(){
			if(request.readyState == 1)
			{ 
				var element = document.getElementById("activities_content");
				window.clearInterval(element.animation);
				steps = 0;
				if(!element.currentHeight){ element.currentHeight = 20; }
				element.animation = window.setInterval(
					function(){
						element.currentHeight = doAnimation(element.currentHeight, 110, steps, 100);
						element.style.height = element.currentHeight + "px";
						steps++;
						if(steps > 100){ window.clearInterval(element.animation); }
					}, 10);
				element.innerHTML = "<div style=\"text-align:center;\"><img src=\"images/loading.gif\" /></div>";
			}
			else if(request.readyState == 4)
			{ 
				var element = document.getElementById("activities_content");
				window.clearInterval(element.waitingInterval);
				element.waitingInterval = window.setInterval(
				function(){
					if(steps > 100)
					{
						element.innerHTML = request.responseText;
						steps = 0;
						element.animation = window.setInterval(
						function(){
							element.currentHeight = doAnimation(element.currentHeight, element.scrollHeight, steps, 100);
							element.style.height = element.currentHeight + "px";
							steps++;
							if(steps > 100)
							{ 
								window.clearInterval(element.animation); 
							}
						}, 10);
						window.clearInterval(element.waitingInterval);
					}
				}, 10);
			}
		};
		request.open("GET","sources/activities/" + value +".html?update="+timestamp,true);
		request.send(null);
	}
}

function sportImageSwitch(page)
{
	var e = document.getElementById('activity_selector');
	e.selectedIndex = page;
	selectSport(e);
}

function selectSport(e)
{
	var index  = e.selectedIndex;
    var value = e.options[index].value;
	if(value != "")
	{
		if (!request)
			request = getXmlHttpObject();
		else if (request.readyState != 0)
			request.abort(); 
		
		var date = new Date();
		var timestamp = date.getTime();
		
		request.onreadystatechange = function(){
			if(request.readyState == 1)
			{ 
				var element = document.getElementById("athletics_content");
				window.clearInterval(element.animation);
				steps = 0;
				if(!element.currentHeight){ element.currentHeight = 20; }
				element.animation = window.setInterval(
					function(){
						element.currentHeight = doAnimation(element.currentHeight, 110, steps, 100);
						element.style.height = element.currentHeight + "px";
						steps++;
						if(steps > 100){ window.clearInterval(element.animation); }
					}, 10);
				element.innerHTML = "<div style=\"text-align:center;\"><img src=\"images/loading.gif\" /></div>";
			}
			else if(request.readyState == 4)
			{ 
				var element = document.getElementById("athletics_content");
				window.clearInterval(element.waitingInterval);
				element.waitingInterval = window.setInterval(
				function(){
					if(steps > 100)
					{
						element.innerHTML = request.responseText;
						steps = 0;
						element.animation = window.setInterval(
						function(){
							element.currentHeight = doAnimation(element.currentHeight, element.scrollHeight, steps, 100);
							element.style.height = element.currentHeight + "px";
							steps++;
							if(steps > 100)
							{ 
								window.clearInterval(element.animation); 
							}
						}, 10);
						window.clearInterval(element.waitingInterval);
					}
				}, 10);
			}
		};
		request.open("GET","sources/athletics/" + value +".html?update="+timestamp,true);
		request.send(null);
	}
}


function selectTeacher(name)
{
	var e = document.getElementById(name);
	var index  = e.selectedIndex;
    var value = e.options[index].value;
	if(value != "")
	{
		if (!request)
			request = getXmlHttpObject();
		else if (request.readyState != 0)
			request.abort(); 
		
		var date = new Date();
		var timestamp = date.getTime();
		
		request.onreadystatechange = function(){
			if(request.readyState == 1)
			{ 
				var element = document.getElementById("teachers_content");
				window.clearInterval(element.animation);
				steps = 0;
				if(!element.currentHeight){ element.currentHeight = 0; }
				element.animation = window.setInterval(
					function(){
						element.currentHeight = doAnimation(element.currentHeight, 110, steps, 100);
						element.style.height = element.currentHeight + "px";
						steps++;
						if(steps > 100){ window.clearInterval(element.animation); }
					}, 10);
				element.innerHTML = "<div style=\"text-align:center;\"><img src=\"images/loading.gif\" /></div>";
			}
			else if(request.readyState == 4)
			{ 
				var element = document.getElementById("teachers_content");
				window.clearInterval(element.waitingInterval);
				element.waitingInterval = window.setInterval(
				function(){
					if(steps > 100)
					{
						element.innerHTML = request.responseText;
						steps = 0;
						element.animation = window.setInterval(
						function(){
							element.currentHeight = doAnimation(element.currentHeight, element.scrollHeight, steps, 100);
							element.style.height = element.currentHeight + "px";
							steps++;
							if(steps > 100)
							{ 
								window.clearInterval(element.animation); 
							}
						}, 10);
						window.clearInterval(element.waitingInterval);
					}
				}, 10);
			}
		};
		request.open("GET","sources/teachers/" + value +".html?update="+timestamp,true);
		request.send(null);
	}
}
-->