/*This code is used to fix the problem we had in our nav bar of things opening when they shouldn't(For instance, the 
navbar would open when we navigated to a page without using the nav bar. This code uses a Parsed Query string to
read in the loc (location) of the page, which is (?loc=0#) which we assigned to the page from the navbar. This means 
that the navbar will only open when navigating to a page that has this special location aka a page in the navbar.*/

window.onload = function () 
{
	var url = location.href;
	var collapseImg = new Image();
	var expandImg = new Image();	
	collapseImg.src = "http://www.uni.edu/careerservices/images/header/rightArrow.gif";
	expandImg.src = "http://www.uni.edu/careerservices/images/header/downArrow.gif";
	//var num = -1;
	var pqs = new ParsedQueryString();
	var loc = pqs.param("loc");
	
	
//The window.alerts are only for testing and confirm that the QueryString is reading in the correct location. 
if ((loc==01)==true)

	{
		document.getElementById( "collapsibleArea01" ).style.display = "block";
		//document.getElementById( "button01" ).src = expandImg;
		//window.alert("The number is " + loc + "!")	
	}

	else
	{
		document.getElementById( "collapsibleArea01" ).style.display = "none";
		//document.getElementById( "button01" ).src = collapseImg;		
	}
if ((loc==02)==true)

	{
		document.getElementById( "collapsibleArea02" ).style.display = "block";
		//document.getElementById( "button02" ).src = expandImg;
		//window.alert("The number is " + loc + "!")	
	}

	else
	{
		document.getElementById( "collapsibleArea02" ).style.display = "none";
		//document.getElementById( "button02" ).src = collapseImg;		
	}

if ((loc==03)==true)

	{
		document.getElementById( "collapsibleArea03" ).style.display = "block";
		//document.getElementById( "button03" ).src = expandImg;
		//window.alert("The number is " + loc + "!")	
	}

	else
	{
	document.getElementById( "collapsibleArea03" ).style.display = "none";
	//document.getElementById( "button03" ).src = collapseImg;		
	}
	
if ((loc==07)==true)

	{
		document.getElementById( "collapsibleArea07" ).style.display = "block";
		//document.getElementById( "button07" ).src = expandImg;
		//window.alert("The number is " + loc + "!")	
	}

	else
	{
	document.getElementById( "collapsibleArea07" ).style.display = "none";
	//document.getElementById( "button07" ).src = collapseImg;		
	}
if ((loc==08)==true)

	{
		document.getElementById( "collapsibleArea08" ).style.display = "block";
		//document.getElementById( "button08" ).src = expandImg;
		//window.alert("The number is " + loc + "!")	
	}

	else
	{
		document.getElementById( "collapsibleArea08" ).style.display = "none";
		//document.getElementById( "button08" ).src = collapseImg;		
	}


function decisionMaker01()
{
/*
	var url = location.href;
	var area = document.getElementById( "collapsibleArea01" );
	var button = document.getElementById( "button01" );

	if( url.search("http://www.uni.edu/acs/tmp/students/explore*") != -1)
	{
		area.style.display = "";
		area.style.display = "block";
		button.src = "http://www.uni.edu/careerservices/images/header/downArrow.gif";	
		//document.write( url );
		PeekABoo(01);
	}
	else
	{
		area.style.display = "none";
		button.src = "http://www.uni.edu/careerservices/images/header/rightArrow.gif";
	}
	*/
}
function decisionMaker02()
{

/*	var url = location.href;
	var area = document.getElementById( "collapsibleArea02" );
	var button = document.getElementById( "button02" );

	if( url.search("http://www.uni.edu/acs/tmp/students/*") != -1)
	{
		//area.style.display = "";
		area.style.display = "block";
		button.src = "http://www.uni.edu/acs/tmp/images/header/downArrow.gif";	
		//document.write( url );
		PeekABoo(02);
	}
	else
	{
		area.style.display = "none";
		button.src = "http://www.uni.edu/acs/tmp/images/header/rightArrow.gif";
	}
	*/
}
function decisionMaker03()
{
/*
	var url = location.href;
	var area = document.getElementById( "collapsibleArea03" );
	var button = document.getElementById( "button03" );

	if( url.search("http://www.uni.edu/acs/tmp/students/jobsearch*") != -1)
	{
		//area.style.display = "";
		area.style.display = "block";
		button.src = "http://www.uni.edu/acs/tmp/images/header/downArrow.gif";	
		//document.write( url );
		PeekABoo(03);
	}
	else
	{
		area.style.display = "none";
		button.src = "http://www.uni.edu/acs/tmp/images/header/rightArrow.gif";
	}
	*/
}
function decisionMaker06()
{

/*	var url = location.href;
	var area = document.getElementById( "collapsibleArea06" );
	var button = document.getElementById( "button06" );

	if( url.search("http://www.uni.edu/acs/tmp/students/*") != -1)
	{
		//area.style.display = "";
		area.style.display = "block";
		button.src = "http://www.uni.edu/acs/tmp/images/header/downArrow.gif";	
		//document.write( url );
		PeekABoo(06);
	}
	else
	{
		area.style.display = "none";
		button.src = "http://www.uni.edu/acs/tmp/images/header/rightArrow.gif";
	}
	*/
}

function decisionMaker08()
{
/*
	var url = location.href;
	var area = document.getElementById( "collapsibleArea01" );
	var button = document.getElementById( "button01" );

	if( url.search("http://www.uni.edu/acs/tmp/students/explore*") != -1)
	{
		area.style.display = "";
		area.style.display = "block";
		button.src = "http://www.uni.edu/careerservices/images/header/downArrow.gif";	
		//document.write( url );
		PeekABoo(01);
	}
	else
	{
		area.style.display = "none";
		button.src = "http://www.uni.edu/careerservices/images/header/rightArrow.gif";
	}
	*/
}
	
}
//----------------------------------------------------------------------------------------------------------------
/*******************************************************************************
 * 
 * ParsedQueryString v1.0
 * (C) 2007, Jeff Mott <mott.jeff@gmail.com>. All rights reserved.
 * 
 * Redistribution and use in source and binary forms with or without
 * modification are permitted provided that the above copyright notice,
 * this condition, and the following disclaimer are retained.
 *
 * THIS SOFTWARE IS PROVIDED AS IS, AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING BUT NOT
 * LIMITED TO PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * 
 ******************************************************************************/

String.prototype.urlDecode = function()
{
	
	return decodeURIComponent(this.replace(/\+/g, " "));
}

function ParsedQueryString()
{
	this.parameters = {};

	if ( ! location.search.length > 1 )
		return;

	var pairs = location.search.substr(1).split(/[&;]/);
	for (var i = 0; i < pairs.length; i++)
	{
		var pair = pairs[i].split(/=/);
		var name = pair[0].urlDecode();
		if (Boolean(pair[1]))
		{
			var value = pair[1].urlDecode();
			if (Boolean(this.parameters[name]))
				this.parameters[name].push(value);
			else
				this.parameters[name] = [value];
		}
	}
}

ParsedQueryString.prototype.param = function(name)
{
	if (Boolean(this.parameters[name]))
		return this.parameters[name][0];
	else
		return "";
}

ParsedQueryString.prototype.params = function(name)
{
	if (arguments.length >= 1)
	{
		if (Boolean(this.parameters[name]))
		{
			var values = [];
			for (var i = 0; i < this.parameters[name].length; i++)
				values.push(this.parameters[name][i]);
			return values;
		}
		else
			return [];
	}
	else
	{
		var names = [];
		for (var name in this.parameters)
			names.push(name);
		return names;
		
	}
}
//--------------------------------------------------------------------------------------------------------------------------
{
	function PeekABoo(num)
	{
		var collapseImg = new Image();
		var expandImg = new Image();
		collapseImg.src = "http://www.uni.edu/careerservices/images/header/rightArrow.gif";
		expandImg.src = "http://www.uni.edu/careerservices/images/header/downArrow.gif";
		
			var areaNumber = document.getElementById( "collapsibleArea0"+num );
			var areaButton = document.getElementById( "button0"+num );
			
			/* If the selected Navbar Area is currently hidden, unhide it.  */
			if ( 	areaNumber.style.display == "none" || areaNumber.style.display == "" )
			{
				areaNumber.style.display = "block";
				areaButton.src = expandImg.src;//"http://www.uni.edu/careerservices/images/header/downArrow.gif";
			}
			else
			{
				areaNumber.style.display = "none";
				areaButton.src = collapseImg.src; //"http://www.uni.edu/careerservices/images/header/rightArrow.gif"; 
			}
	}
}