﻿<!--//

var namelength;
var newname = '';
var menulist = '';

function checkLinkList(name)
{	
	namelength = name.length;
	for(x=0; x<namelength; x++)     // Check every character to eliminate spaces
	{
		if(name.charAt(x)!=' ' && name.charAt(x)!='\'')
		{
			newname += name.charAt(x);
		}
	}
	newname = newname.toLowerCase();           // transform into lower case
	
	
	
	if(newname == 'athletics')
	{
		getAthlAct(athleticActivities);
		newname = 'athleticsside';		
	}									//conditions
	if(newname == 'transferstudents')
	{
		newname = 'futurestudents';
	}
	
	
	return getLeftnav(eval(newname));			// transfer found menu to getLeftnav function
}

function getLeftnav(menulist) // Get the left Navigation from the corresponding Menu List from file [menucontent.js]
{
	var listpieces = "";
	
	ii=0;
	
	if (menulist == athletics)
	{
		ii=4;
	}
	
if(menulist == null)
{
	document.getElementById('linkList').innerHTML=('<li class="unachoredLi" style="border:none"><a class="emptyachor">Error: failed to retrieve left navigation'+'\n'+ 'Sorry for the inconvenience</a></li>');
}
else {
	
	for(i=ii;i<menulist.items.length;i++)
	{
		if (menulist == news)
		{	
			if (menulist.items[i][1] == "#") // # in href will result in an unachord item
			{
				listpieces+='<li class="unachoredLi" style="border:none"><a class="emptyachor">' + menulist.items[i][0] + '</a></li>\n';
			}
			else if (menulist.items[i][1] == "nolink") // nolink in href will end with an unachored and an extra space above
			{
				listpieces+='<li class="unachoredLiHead" style="border:none">' + menulist.items[i][0] + '</li>\n';
			}
			else if (menulist.items[i][2] == null) 
			{
				listpieces+='<li><a href="' + menulist.items[i][1] + '" target="' + menulist.linktarget + '">' + menulist.items[i][0] + '</a></li>\n';
			}	
			else 
			{
				listpieces+='<li><a href="' + menulist.items[i][1] + '" target="' + menulist.linktarget + '">' + menulist.items[i][0] + '<span class="newsDate">' + menulist.items[i][2] + '</span></a></li>\n';
			}			
		}
		else 
		{	
			if (menulist.items[i][1] == "#") // # in href will result in an unachord item
			{
				listpieces+='<li class="unachoredLi" style="border:none"><a class="emptyachor">' + menulist.items[i][0] + '</a></li>\n';
			}
			else if (menulist.items[i][1] == "nolink") // nolink in href will end with an unachored and an extra space above
			{
				listpieces+='<li class="unachoredLiHead" style="border:none">' + menulist.items[i][0] + '</li>\n';
			}
			else 
			{
				listpieces+='<li><a href="' + menulist.items[i][1] + '" target="' + menulist.linktarget + '">' + menulist.items[i][0] + '</a></li>\n';
			}
		}
	}
	document.getElementById('linkList').innerHTML=(listpieces);
}
}

function getAthlAct(menulist)
{
	var listpieces = "";
	
	for(i=0;i<menulist.items.length;i++)
	{
		if (i==0)
		{
				if(menulist.items[i][1] == "nolink")
				{
					listpieces+='<li class="unachoredLiHead" style="border:none">' + menulist.items[i][0] + '</li>\n';
					listpieces+='<select onchange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">';
				}
				else 
				{
					listpieces+='<select onchange="if(options[selectedIndex].value) window.location.href=(options[selectedIndex].value)">';
					listpieces+='<option value="' + menulist.items[i][1] + '">' + menulist.items[i][0] + '</option>\n';
				}
		}
		else if(i>=1 && i < menulist.items.length - 1)
		{
			listpieces+='<option value="' + menulist.items[i][1] + '">' + menulist.items[i][0] + '</option>\n';
		}
		else if(i == menulist.items.length - 1)
		{
			listpieces+='<option value="' + menulist.items[i][1] + '">' + menulist.items[i][0] + '</option>\n';
			listpieces+='</select>';
		}
	}
	document.getElementById('athlActList').innerHTML=(listpieces);
}

function errorLeftnav()
{
	document.getElementById('linkList').innerHTML=('<li class="unachoredLi" style="border:none"><a class="emptyachor">Error: failed to retrieve left navigation'+'\n'+ 'Sorry for the inconvenience</a></li>');
}

//-->