/**
* Copyright 2006. The University of Mississippi. All rights reserved. 
*
* The University of Mississippi (UM) holds the copyright on these materials, whether in print or electronic form. Unauthorized use of these materials is prohibited. Without limiting the foregoing, written permission is required from UM to copy, distribute, edit, publish, republish, or disseminate these materials. To request permission, please contact UM at the e-mail address below. These materials are made available without warranty of any kind. 
*
* For additional information or clarification, contact it@olemiss.edu.
**/

function checkCookie() {
 var lf = "\n";
 var CookieName = "site";
 var CookieString = document.cookie;
 var CookieSet = CookieString.split (';');
 var SetSize = CookieSet.length;
 var CookiePieces
 var ReturnValue = "";
 var myind    = 0;
 var isdelete = false;
 var x = 0;
 for (x = 0; ((x < SetSize) && (ReturnValue == "")); x++) {
   CookiePieces = CookieSet[x].split ('=');
	if (CookiePieces[0].substring (0,1) == ' ') {
   CookiePieces[0] = CookiePieces[0].substring (1, CookiePieces[0].length);
  }

       var myvar = CookiePieces[0];
       var myval = CookiePieces[1];
       if (myvar.substring(0,4) == "site"){
          if (!isdelete) { deleteOptions(); isdelete = true; }
			 insertNewOption(CookiePieces[1], myind); 
			 myind = myind + 1;
		 }
}
}

function deleteOptions(){ 
	while (document.form1.menu1.options.length>0)
	{
	 deleteIndex=document.form1.menu1.options.length-1;
	 document.form1.menu1.options[deleteIndex]=null;
	}
   insertIndex=document.form1.menu1.options.length;
	myOption=new Option();
   myOption.text= "Pull Down...";
   myOption.value="";
	document.form1.menu1.options[insertIndex]=myOption;	
}

function insertNewOption(mycode, myind)
{
      var isOption = true;
		myOption=new Option();
		var mytext = "";
      if (mycode == "webmail") {
				 myOption.text= "WebMail";                  
				 myOption.value="https://webmail.olemiss.edu";
		 }
		else if (mycode == "myolemiss") {
				 myOption.text= "myOleMiss";                  
				 myOption.value="http://my.olemiss.edu";
								 }
		else if (mycode == "blackboard") {
				 myOption.text= "Blackboard";                  
				 myOption.value="https://blackboard.olemiss.edu";
								 }
		else if (mycode == "angel") {
				 myOption.text= "Angel";                  
				 myOption.value="http://angel.olemiss.edu";
								 }
		else if (mycode == "employment") {
				 myOption.text= "Employment";                  
				 myOption.value="http://jobs.olemiss.edu";
								 }
		else if (mycode == "org") {
				 myOption.text= "Organizations";                  
				 myOption.value="http://www.olemiss.edu/orgs";
								 }
		else if (mycode == "campusmap") {
				 myOption.text= "Campus Map";                  
				 myOption.value="http://www.olemiss.edu/cmap";
					 }
		else if (mycode == "thedm") {
				 myOption.text= "The Daily Mississippian";                  
				 myOption.value="http://www.thedmonline.com";
								 }
		else if (mycode == "livecam") {
				 myOption.text= "Live!Cam";                  
				 myOption.value="http://www.olemiss.edu/livecam/";
								 }
		else if (mycode == "site1") {
				 myOption.text= "Ole Miss Website 1";                  
				 myOption.value="http://www.olemiss.edu";
								 }
		else if (mycode == "site2") {
				 myOption.text= "Ole Miss Website 2";                  
				 myOption.value="http://www.olemiss.edu";
				 }
		else if (mycode == "site3") {
				 myOption.text= "Ole Miss Website 3";                  
				 myOption.value="http://www.olemiss.edu";
								 }
		else if (mycode == "site4")  {
				 myOption.text= "Ole Miss Website 4";                  
				 myOption.value="http://www.olemiss.edu";
		 }
		else if (mycode=="sallymcdonnel") { 
		  myOption.text= "Barksdale Honors College";
		  myOption.value="http://www.honors.olemiss.edu/";
		}
		else if (mycode=="libarts") { 
		  myOption.text= "Liberal Arts";
		  myOption.value="http://www.olemiss.edu/depts/liberal_arts";
		}
		else if (mycode=="gradsch") { 
		  myOption.text= "Graduate School";
		  myOption.value="http://www.olemiss.edu/depts/graduate_school";
		}
		else if (mycode=="accountancy") { 
		  myOption.text= "Accountancy";
		  myOption.value="http://www.olemiss.edu/depts/accountancy";
		}
		else if (mycode=="applsci") { 
		  myOption.text= "Applied Sciences";
		  myOption.value="http://www.olemiss.edu/depts/applied_sciences";
		}
		else if (mycode=="busadm") { 
		  myOption.text= "Business Administration";
		  myOption.value="http://www.olemissbusiness.com/";
		}
		else if (mycode=="educ") { 
		  myOption.text= "Education";
		  myOption.value="http://www.olemiss.edu/depts/educ_school2";
		}
		else if (mycode=="eng") { 
		  myOption.text= "Engineering";
		  myOption.value="http://www.olemiss.edu/depts/engineering_school";
		}
		else if (mycode=="law") { 
		  myOption.text= "Law";
		  myOption.value="http://www.olemiss.edu/depts/law_school";
		}
		else if (mycode=="pharm") { 
		  myOption.text= "Pharmacy";
		  myOption.value="http://www.pharmacy.olemiss.edu";
		}
		else if (mycode=="medical") { 
		  myOption.text= "University Medical Center";
		  myOption.value="http://www.umc.edu";
		}
		else if (mycode=="booneville") { 
		  myOption.text= "Booneville";
		  myOption.value="http://www.outreach.olemiss.edu/booneville";
		}
		else if (mycode=="oxford") { 
		  myOption.text= "Oxford";
		  myOption.value="http://www.olemiss.edu";
		}
		else if (mycode=="southhaven") { 
		  myOption.text= "Southaven";
		  myOption.value="http://www.outreach.olemiss.edu/southaven";
		}
		else if (mycode=="tupelo") { 
		  myOption.text= "Tupelo";
		  myOption.value="http://www.outreach.olemiss.edu/tupelo";
		}
		else if (mycode=="newsdesk") { 
		  myOption.text= "Newsdesk";
		  myOption.value="http://www.olemiss.edu/newsdesk";
		}
		else if (mycode=="calendar") { 
		  myOption.text= "Calendar";
		  myOption.value="http://events.olemiss.edu/";
		}
		else if (mycode=="sports") { 
		  myOption.text= "Sports";
		  myOption.value="http://www.olemisssports.com/";
		}
		else if (mycode=="faculty") { 
		  myOption.text= "Faculty";
		  myOption.value="http://www.olemiss.edu/faculty/index.html";
		}
		else if (mycode=="facultysenate") { 
		  myOption.text= "Faculty Senate";
		  myOption.value="http://www.olemiss.edu/orgs/faculty_senate/";
		}
		else if (mycode=="ithelpdesk") {
		  myOption.text= "IT Helpdesk";
		  myOption.value="http://www.olemiss.edu/helpdesk";
		}
		else if (mycode=="virus") { 
		  myOption.text= "Virus Info";
		  myOption.value="http://virus.olemiss.edu/";
		}
		else if (mycode=="hr") {
		  myOption.text= "Human Resources";
		  myOption.value="http://www.olemiss.edu/depts/HR/";
		}
		else if (mycode=="payroll") {
		  myOption.text= "Payroll";
		  myOption.value="http://www.olemiss.edu/depts/HR/";
		}
		else if (mycode=="umbooks") {
		  myOption.text= "Bookstore";
		  myOption.value="http://ole-miss.bkstore.com/";
		}
		else if (mycode=="phonedir") {
		  myOption.text= "Phone Directory";
		  myOption.value="http://www.olemiss.edu/people";
		}

		else{
		  isOption = false;
		  myOption.text=mycode;
		  myOption.value="http://www."+mycode+".com";
		}
		if (isOption){
      insertIndex=document.form1.menu1.options.length;
	   document.form1.menu1.options[insertIndex]=myOption;	
		}
}
