jQuery(document).ready(

	/*
	This function gets loaded when all the HTML, not including the portlets, is
	loaded.
	*/

	function() 
	{
		/* set search content to empty */
		var searchSpan = document.getElementById("searchSpan");
		var searchForm = searchSpan.lastChild;
		var searchInputs = searchForm.getElementsByTagName("input");

		/* changes the field value to empty string */
		searchInputs[0].value = "";

		/*
		spanList = document.getElementByTagName("span");
		for (i = 0; i < spanList.size; i++)
		{
			if (spanList[i].getAttribute("id") == "searchTextField")
			{
				image = spanList[i].getNode().getElementsByTagName("img").getNode();
				image.getAttribute("src").value = "/images/";
			}
		}
		*/
	}
);

Liferay.Portlet.ready(

	/*
	This function gets loaded after each and every portlet on the page.

	portletId: the current portlet's id
	jQueryObj: the jQuery wrapped object of the current portlet
	*/

	function(portletId, jQueryObj) {
	}
);

jQuery(document).last(

	/*
	This function gets loaded when everything, including the portlets, is on
	the page.
	*/

	function() {
	}
);

// Have Global Navigation MouseOver Swapped Static Ver.

function swaponBg(target) 
{
	if(window.opera)
	{
 		return true;
 	}
 	else
 	{
 		target.style.backgroundColor = '#006699';
 		if (target.getElementsByTagName("span")[0].innerHTML == "Home")
 		{
 			document.getElementById("risingEdgeImg").src = "/alliance-brochure-theme/html/themes/alliance-brochure-theme/images/alliance/medLeftEdgeTabDrop-float.jpg";
 			document.getElementById("risingEdge").style.backgroundColor = '#006699';
 		}
	}
}

function swapoffBg(target) 
{
	if(window.opera)
	{
		return true;
	}
	else
	{
		target.style.backgroundColor = '#44AADD';
		if (target.getElementsByTagName("span")[0].innerHTML == "Home")
		{
			document.getElementById("risingEdgeImg").src = "/alliance-brochure-theme/html/themes/alliance-brochure-theme/images/alliance/medLeftEdgeTabDrop.jpg";
			document.getElementById("risingEdge").style.backgroundColor = '#44AADD';
		}
	}
}

// Appends classes for input items if using IE6

function changeClasses(currentdoc)
{ 
	var inputElements = currentdoc.getElementsByTagName('input'); 
	for (var i=0; i<inputElements.length; i++)
	{ 
		if(inputElements[i].type == "submit")
		{ 
			inputElements[i].className = inputElements[i].className + " submitbutton"; 
		} 
		else 
		if (inputElements[i].type == "checkbox")
		{ 
			inputElements[i].className = inputElements[i].className + " checkbox"; 
		} 
		else 
		if (inputElements[i].type == "radio")
		{ 
			inputElements[i].className = inputElements[i].className + " radio"; 
		} 
		else 
		if (inputElements[i].type == "text")
		{ 
			inputElements[i].className = inputElements[i].className + " textbox"; 
		} 
		else
		if (inputElements[i].type == "image")
		{
			inputElements[i].className = inputElements[i].className + " image";
		}
	}
}

// remove automated behavior of filling in search text field with "Search..."

function changeSearch(currentdoc)
{
	var searchSpan = currentdoc.getElementById('searchSpan');
	var inputElements = searchSpan.getElementsByTagName('input');
	for (var i = 0; i < inputElements.length; i++)
	{
		if (inputElements[i].type == "text")
		{
			inputElements[i].onblur = "";
			inputElements[i].onfocus = "";
		}
	}
}

//initializes the document for browser compatibility

function initDocument(currentdoc)
{
	changeClasses(currentdoc);
	changeSearch(currentdoc);
}