	hex = 1
	
	function fadetext(item_faded)
	{
		hex += 11; //Makes color lighter and lighter
		document.getElementById("sidebar").style.background = "rgb(" + hex + "," + hex + "," + hex + ")"; //Sets color
		setTimeout("fadetext()", 40); //Re-runs function every 40 milliseconds
	}
	
	
	/**********************************************************************/
	
	function opacity(id, opacStart, opacEnd, millisec) 
	{
  	  	//speed for each frame
    	var speed = Math.round(millisec / 100);
    	var timer = 0;

    	//determine the direction for the blending, if start and end are the same nothing happens
    	if(opacStart > opacEnd) 
		{
        	for(i = opacStart; i >= opacEnd; i--) 
			{
            	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            	timer++;
        	}
    	} 
		
		else if(opacStart < opacEnd) 
		{
        	for(i = opacStart; i <= opacEnd; i++)
            	{
            	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            	timer++;
        	}
    	}
	}
	
	/**********************************************************************/
	
	function fadeSidebar(params, id, cid, password)
	{
		params += '&cmdweblogin=true&fade=true';
		
		fadeSide('forms/login.php', id, 'POST', params, 'nothing');
		
		if (navigator.appName == 'Microsoft Internet Explorer') 
		{
			opacity('sidebar_menu', 100, 0, 300);
			opacity('mainbody', 100, 0, 300);
		}
		
		else 
		{
			opacity('sidebar_menu', 100, 0, 800);
			opacity('mainbody', 100, 0, 800);
		}

		setTimeout('newSidebar(' + cid + ')', 1000);
		
		//opacity('sidebar_menu', 0, 100, 500);
	}
	
	/**********************************************************************/
	
	function newSidebar(cid)
	{		
		sendInput('ajax/sideParser.php', 'sidebar_menu', 'POST', 'cid=' + cid + '&pass=' + window.pass, 'update');
		sendInput('controllers/pages/landing.php', 'mainbody', 'GET', 'update');
		
		if (navigator.appName == 'Microsoft Internet Explorer') 
		{
			setTimeout('opacity(\'sidebar_menu\', 0, 100, 300)', 400);
			setTimeout('opacity(\'mainbody\', 0, 100, 300)', 400);
		}
		
		else 
		{
			setTimeout('opacity(\'sidebar_menu\', 0, 100, 800)', 300);
			setTimeout('opacity(\'mainbody\', 0, 100, 800)', 300);
		}
	}
	
	/**********************************************************************/
	
	function shiftOpacity(id, millisec) 
	{
    	//if an element is invisible, make it visible, else make it ivisible
    	if(document.getElementById(id).style.opacity == 0) {
        	opacity(id, 0, 100, millisec);
    	} 
		
		else 
		{
        opacity(id, 100, 0, millisec);
    	}
	}
	
	/**********************************************************************/

	//change the opacity for different browsers
	function changeOpac(opacity, id) 
	{
    	var object = document.getElementById(id).style;
    	object.opacity = (opacity / 100);
    	object.MozOpacity = (opacity / 100);
    	object.KhtmlOpacity = (opacity / 100);
    	object.filter = "alpha(opacity=" + opacity + ")";
	} 
	
	/**********************************************************************/
	
	var x = 1;
	function loadingText()
	{
		if (x == 1)
		{
			return 'Loading.';
			x = 2;
		}
	
		else if (x == 2)
		{
			return 'Loading..';
			x = 3;
		}
	
		else if (x == 3)
		{
			return 'Loading...'
			x = 1;
		}
	
		setTimeout("loadingText()", 100);
	}

	window.keyreturn = '';
	
	/**********************************************************************/
	
	function change(xmlhttp, command)
	{
		if (xmlhttp.readyState == 4) 
		{				
			if (command == 'check') 
			{
				if (xmlhttp.responseText == 'LoginFail')
				{					
					window.location = 'http://www.minniecenter.org/?error=LoginFail';
				}
			}
			
			else if (command == 'nothing')
			{
				//Do nothing
			}
			
			else 
			{
				return xmlhttp.responseText;
			}
		}
	}
	
	/**********************************************************************/

	function easteregg(ev)
	{
		keystrokes = (window.event) ? event.keyCode : ev.keyCode;

		window.keyreturn += keystrokes;
	
		
		if (window.keyreturn == 907780)
		{
			alert("ZMP RULES!!!");
			window.keyreturn = '';
		}
	}
	
	/**********************************************************************/

	function sendInput(url, update, type, params, func)
	{
		var xmlhttp;
	
		if (window.XMLHttpRequest)
  		{
 			xmlhttp = new XMLHttpRequest();
  		}
		else if (window.ActiveXObject)
  		{
  			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  		}
		else
  		{
  			alert("Your browser does not support XMLHTTP!");
  		}
		
		if (type == 'POST') 
		{
			xmlhttp.open("POST", url, true);
			xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlhttp.send(params);
		}
		
		else 
		{
			xmlhttp.open("GET", url, true);
			xmlhttp.send(null);
		}
		
	
		//document.getElementById(update).innerHTML = loadingText();
	
	
		if (func == 'normal') 
		{
			document.getElementById(update).innerHTML = 'Loading...';
			document.title = 'Loading...';
		}
	
		xmlhttp.onreadystatechange = function()
		{		
			if (xmlhttp.readyState == 4) 
			{
				if (func == 'nothing') 
				{
					//Do nothing
				}
					
				else 
				{					
					document.getElementById(update).innerHTML = xmlhttp.responseText;
					document.title = 'VATSIM Minneapolis ARTCC';
				}
			}
		}
		
	}
	
	/**********************************************************************/
	
	function fadeSide(url, update, type, params, func)
	{
		var xmlhttp;
	
		if (window.XMLHttpRequest)
  		{
 			xmlhttp = new XMLHttpRequest();
  		}
		else if (window.ActiveXObject)
  		{
  			xmlhttp = alert("Your browser does not support AJAX!");
  		}
		else
  		{
  			alert("Your browser does not support AJAX!");
  		}
		
		if (type == 'POST') 
		{
			xmlhttp.open("POST", url, false);
			xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlhttp.send(params);
		}	
	
		xmlhttp.onreadystatechange = function()
		{
			change(xmlhttp, 'check');
		}
		window.pass = change(xmlhttp, 'return');
		
	}
	
	/**********************************************************************/

	function typing(unbroken, div)
	{		
		var letters = unbroken.split('');

		document.getElementById(div).innerHTML += letters[i];
		
		if (i != letters.length - 1) 
		{
			setTimeout("typing()", 100);
		}
		window.i++;
	}
	
	/**********************************************************************/

/*
function sendInput(input)
{
	var xmlhttp;
	
	xmlhttp = new XMLHttpRequest();
	
	xmlhttp.open("POST", "forms/login.php", true);
	xmlhttp.send(null);
	
	xmlhttp.onreadystatechange = function()
	{
		if(xmlhttp.readyState == 4)
		{
			document.getElementById("txt").innerHTML = xmlhttp.responseText;
		}
	}

}
*/