function UC_Search(object){ // bdaley
	// Determine Radio Value
	for (i=0, n=object.sitesearch.length; i<n; i++) {
	  if (object.sitesearch[i].checked) {
	    RV = object.sitesearch[i].value;
	    break;
	  }
	}
	
	// Quick Validation 
	if((object.q.value == '') || (object.q.value == 'Type Search Here')){
		alert('You must enter your search criteria.');
		object.q.focus();
		return false;
	}

	// Set Variables for People Search (Phonebook)
	if(RV == 'People'){
		object.method = "POST";
		object.action = "http://phonebk.uconn.edu/results.php";
		object.q.name = "basictext";
	}
}

/*
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
*/

/*
 * generic function to get a handle on an object
 */
function getObj(id) {
	if (document.getElementById && document.getElementById(id)) {
		return document.getElementById(id);  // W3C DOM
	} else if (document.all && document.all(id)) {
		return document.all(id);  // MSIE4
	} else if (document.layers && document.layers[id]) {
		return document.layers[id]; // NN4
	} else {
		return false;
	}
}

function getStyle(id) {	
	if (document.getElementById && document.getElementById(id)) {
		return document.getElementById(id).style;  // W3C DOM		
	} else if (document.all && document.all(id)) {
		return document.all(id).style;  // MSIE4
	} else if (document.layers && document.layers[id]) {
		return document.layers[id]; // NN4
	} else {
		return false;
	}
}

var mos = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');

/** GENERIC COOKIE FUNCTIONS **/
/*
 * setCookie places a cookie on the user's machine with the name and
 * value passed as arguments.
 */
function setCookie(name, value, exp, path, domain, sec) {
	argv=arguments;
	argc=arguments.length;
	expires=(argc>2) ? argv[2] : null;
	path=(argc>3) ? argv[3] : null;
	domain=(argc>4) ? argv[4] : null;
	secure=(argc>5) ? argv[5] : false;
	document.cookie=name+"="+escape(value) +
	((expires === null) ? "" : ("; expires="+expires.toUTCString())) +
	((path === null) ? "" : ("; path="+path)) +
	((domain === null) ? "" : ("; domain="+domain)) +
	((secure === true) ? "; secure" : "");
}

/*
 * read the value from the named cookie
 */
function readCookie(name) {
	arg = name + "=";
	alen = arg.length;
	clen = document.cookie.length;
	i = 0;
	while (i < clen) {
		j = i + alen;
		if (document.cookie.substring(i,j) == arg) {
			return readCookieVal(j);
		}
		i = document.cookie.indexOf(" ",i) + 1;
		if (i === 0) {
			break;
		}
	}
}

/*
 * discard the cookie
 */
function delCookie(name) {
	timeAgo = 3*24*60*60*1000; //in millisecounds
    expDate=new Date();
	expDate.setTime(expDate.getTime() - timeAgo);
	document.cookie=name+'=0; expires='+expDate.toGMTString();
}

function delChildren(name) {
	var cookies = document.cookies.split(";");
	var re = /^\s+/;
	for(i = 0; i < cookies.length; i++) {
		cookies[i] = cookies[i].replace(re, "");
		var junk = cookies[i].split("=");
		var idre = new RegExp(["^" + junk[0]]);
		if (idre.test(junk[0])) {
			delCookie(junk[0]);
		}
	}
}


/*
 * 'private' function called by readCookie()
 */
function readCookieVal(offset) {
	endstr=document.cookie.indexOf(";",offset);
	if (endstr == -1) {
		endstr=document.cookie.length;
	}
    return unescape(document.cookie.substring(offset,endstr));
}

/** END GENERIC COOKIE FUNCTIONS **/

/** EMAIL login function **/
//Login Function
 function the_loginator() { 
 	theRadioValue = 0;
 	var f = document.getElementById('Login');
 	for (i=0, n=document.Login.elements.length; i<n; i++) {
 	    if (document.Login.elements[i].checked) {
 		   theRadioValue = document.Login.elements[i].value;
 		   break;
 	    }
 	}

 	switch (theRadioValue){
 	   case "PeopleSoft" :
 		  //document.Login.action = "https://student.studentadmin.uconn.edu/servlets/iclientservlet/SAPR/?cmd=login&languageCd=ENG";
 		  f.action = "https://www.studentadmin.uconn.edu/psp/CSPR/?cmd=login&languageCd=ENG";
 		  f.user.name = 'userid';
 		  f.pass.name = 'pwd';
 		  f.one.name = 'Submit';
 		  f.one.value = 'Sign In';
 		  f.two.name = 'timezoneOffset';
 		  f.two.value = '0';
 		  pop('popups/peoplesoft.php',500,500,'PeopleSoft');
 		  return true;
 		 break;
 	   case "HuskyMail" :
 		  f.action = "https://huskymail.uconn.edu/login.msc";
 		  f.pass.name = 'password';
 		  return true;
 		  break;
 	   case "LawMail" :
 		  f.action = 'https://java.law.uconn.edu/names.nsf?Login';   	
 		  f.user.name = 'username';
 		  f.pass.name = 'password';
 		  f.redirectto.value = '/testredi.nsf?Open';
 		  return true;
 	   case "FacLawMail" :
 		  f.action = 'https://rehnquist.law.uconn.edu/names.nsf?Login';   	
 		  f.user.name = 'username';
 		  f.pass.name = 'password';
 		  f.redirectto.value = '/dwaredir.nsf?Open';
 		  return true;
 	   case "TWEN" :
 		  f.action = 'https://lawschool.westlaw.com/shared/signon02.asp?path=%2FDesktopDefault%2Easpx';   	
 		  f.user.name = 'mupusername';
 		  f.pass.name = 'muppassword';
 		  f.gosignon.value = '2';
 		  return true;
 	   default : 
 			alert('You must select one of the radio buttons');
 			return false;
 		    break;
 	} 
} 


// PeopleSoft Hack
document.cookie = "SignOnDefault=;path=/;domain=.uconn.edu";

// LAW MAIL
function lawmail() {
	location.replace("https://rehnquist.law.uconn.edu/");
}



