/*******************************************************
Desc: Holds small javascript helper functions that only
		appear on the homepage. (ie www.millersville.edu)
*******************************************************/
	function swap(id) //# Swap to the selected tab.
	{		
		// What fields?
		var ids = ['cultural_content','academics_content','sports_content'];

		// hide all
		for (var i=0; i<ids.length; i++)
			document.getElementById(ids[i]).style.display = 'none';

		// show selected id and change the events_bg background image to show the appropriate color
		document.getElementById(id).style.display = 'block';
	}

	// remove default text from search box
	function removeSearchText(txtBox)
	{		
		if(txtBox.value == txtBox.defaultValue)
			txtBox.value = "";
		else if(txtBox.value == "")
			txtBox.value = txtBox.defaultValue;
	}


/*******************************************************
Desc: Holds small javascript helper functions that appear
		globally. (i.e. the top site index)
*******************************************************/
	


	function switchSearchAction(newAction)
	{
		document.search.action = newAction;
	}

	function switchSearchAction2(newAction)                                                                                             
        {                                                                                                                                   
        	document.gs.action = newAction;                                                                                                 
        }  

	var timerID;

	function show(id)  
	{ 
		obj = document.getElementById(id); 
		obj.style.display = 'block'; 
		clearTimeout(timerID);  
	}

	function hide(id)  
	{ 
		obj = document.getElementById(id); 
		timerID = setTimeout("obj.style.display = 'none'", 500); 
	}

	function swapImg(obj)
	{
		var newSrc = obj.src.split(".");		// Split the full path into pieces.
		var i = newSrc.length-2		// Grab the image's path without the extension.

		//	If the over is not present, concatinate -over to the end of the image path.
		//	Else, remove -over from the image path.
		if(newSrc[i].indexOf("-over") == -1)
			newSrc[i] = newSrc[i] +  "-over";
		else
			newSrc[i] = newSrc[i].replace("-over", "");

		newSrc = newSrc.join(".");							// Join the full path back together.
		obj.src = newSrc;	// Replace the current image with the newer one.
	}

	function swapObjImg(obj)
	{
		var newSrc = obj.getElementsByTagName("img")[0].src.split(".");		// Split the full path into pieces.
		var i = newSrc.length-2		// Grab the image's path without the extension.

		//	If the over is not present, concatinate -over to the end of the image path.
		//	Else, remove -over from the image path.
		if(newSrc[i].indexOf("-over") == -1)
			newSrc[i] = newSrc[i] +  "-over";
		else
			newSrc[i] = newSrc[i].replace("-over", "");

		newSrc = newSrc.join(".");							// Join the full path back together.
		obj.getElementsByTagName("img")[0].src = newSrc;	// Replace the current image with the newer one.
	}

	var hovered = 0;

	function swapBgImg(obj)
	{
		var link = obj.getElementsByTagName("a")[0];

		if(hovered == 0)
		{
			obj.style.background = "#2f2f2f url('http://www.millersville.edu/lib/img/buttons_tabs/mn_bg-over.gif') 0px 0px";

			link.style.background = "transparent url('http://www.millersville.edu/lib/img/buttons_tabs/mn_gloss-over.gif') no-repeat 0px 0px";
			hovered = 1;
		}
		else
		{
			obj.style.backgroundImage = "url('http://www.millersville.edu/lib/img/buttons_tabs/mn_bg.gif')";
			link.style.backgroundImage = "url('http://www.millersville.edu/lib/img/buttons_tabs/mn_gloss.gif')";

			if(obj.className == 'orange')
			{
				obj.style.backgroundColor = "#c47a09";
				obj.style.backgroundPosition = "0px 0px";
			}

			else if(obj.className == 'green')
			{
				obj.style.backgroundColor = "#344c29";
				obj.style.backgroundPosition = "0px	-136px";

				link.style.backgroundPosition = "0px -136px";
			}

			else if(obj.className == 'blue')
			{
				obj.style.backgroundColor = "#015e99";
				obj.style.backgroundPosition = "0px	-272px";

				link.style.backgroundPosition = "0px -272px";
			}

			else if(obj.className == 'tan')
			{
				obj.style.backgroundColor = "#c8a24c";
				obj.style.backgroundPosition = "0px	-408px";

				link.style.backgroundPosition = "0px -408px";
			}

			else if(obj.className == 'brown')
			{
				obj.style.backgroundColor = "#815b3e";
				obj.style.backgroundPosition = "0px	-544px";

				link.style.backgroundPosition = "0px -544px";
			}

			else if(obj.className == 'purple')
			{
				obj.style.backgroundColor = "#2d0e4a";
				obj.style.backgroundPosition = "0px	-680px";

				link.style.backgroundPosition = "0px -680px";
			}

			else
			{
				obj.style.backgroundColor = "#973523";
				obj.style.backgroundPosition = "0px	-816px";

				link.style.backgroundPosition = "0px -816px";
			}

			hovered = 0;
		}
	}

	function swapBgImgReverse(obj)
	{
		var link = obj.getElementsByTagName("a")[0];

		if(hovered == 0)
		{
			obj.style.backgroundImage = "url('http://www.millersville.edu/lib/img/buttons_tabs/mn_bg.gif')";
			link.style.backgroundImage = "url('http://www.millersville.edu/lib/img/buttons_tabs/mn_gloss.gif')";

			if(obj.className == 'orange')
			{
				obj.style.backgroundColor = "#c47a09";
				obj.style.backgroundPosition = "0px 0px";
			}

			else if(obj.className == 'green')
			{
				obj.style.backgroundColor = "#344c29";
				obj.style.backgroundPosition = "0px	-136px";

				link.style.backgroundPosition = "0px -136px";
			}

			else if(obj.className == 'blue')
			{
				obj.style.backgroundColor = "#015e99";
				obj.style.backgroundPosition = "0px	-272px";

				link.style.backgroundPosition = "0px -272px";
			}

			else if(obj.className == 'tan')
			{
				obj.style.backgroundColor = "#c8a24c";
				obj.style.backgroundPosition = "0px	-408px";

				link.style.backgroundPosition = "0px -408px";
			}

			else if(obj.className == 'brown')
			{
				obj.style.backgroundColor = "#815b3e";
				obj.style.backgroundPosition = "0px	-544px";

				link.style.backgroundPosition = "0px -544px";
			}

			else if(obj.className == 'purple')
			{
				obj.style.backgroundColor = "#2d0e4a";
				obj.style.backgroundPosition = "0px	-680px";

				link.style.backgroundPosition = "0px -680px";
			}

			else
			{
				obj.style.backgroundColor = "#973523";
				obj.style.backgroundPosition = "0px	-816px";

				link.style.backgroundPosition = "0px -816px";
			}
			hovered = 1;
		}
		else
		{
			obj.style.background = "#2f2f2f url('http://www.millersville.edu/lib/img/buttons_tabs/mn_bg-over.gif') 0px 0px";

			link.style.background = "transparent url('http://www.millersville.edu/lib/img/buttons_tabs/mn_gloss-over.gif') no-repeat 0px 0px";

			hovered = 0;
		}
	}
	




