function coordFocus(){
	var entryF = document.getElementById('coordEntry');
	entryF.focus();
	}

function getLandingImgs(tType,totalImgs,linkTo){
	
	var randNo1 = Math.round((totalImgs-1) * Math.random() + 1);
	if(linkTo != ""){
		document.write("<a href=\"" + linkTo + "\"><img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo1 + ".gif\" alt=\"" + tType + "\" class=\"landing1\" style=\"display: none;\" /></a>");
		}
	else{
		document.write("<img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo1 + ".gif\" alt=\"" + tType + "\" class=\"landing1\" style=\"display: none;\" />");
		}
	
	var randNo2 = Math.round((totalImgs-1) * Math.random() + 1);
	
	while(randNo2 == randNo1){
		var randNo2 = Math.round((totalImgs-1) * Math.random() + 1);
		if(randNo2 != randNo1){
			break;
			}
		}
	if(linkTo != ""){
		document.write("<a href=\"" + linkTo + "\"><img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo2 + ".gif\" alt=\"" + tType + "\" class=\"landing2\" style=\"display: none;\" /></a>");
		}
	else{
		document.write("<img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo2 + ".gif\" alt=\"" + tType + "\" class=\"landing2\" style=\"display: none;\" />");
		}

	
	var randNo3 = Math.round((totalImgs-1) * Math.random() + 1);
	while ((randNo3 == randNo1) || (randNo3 == randNo2)){
		var randNo3 = Math.round((totalImgs-1) * Math.random() + 1);
		if((randNo3 != randNo1) && (randNo3 != randNo2)){
			break;
			}
		}

	if(linkTo != ""){
		document.write("<a href=\"" + linkTo + "\"><img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo3 + ".gif\" alt=\"" + tType + "\" class=\"landing3\" style=\"display: none;\" /></a>");
		}
	else{
		document.write("<img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo3 + ".gif\" alt=\"" + tType + "\" class=\"landing3\" style=\"display: none;\" />");
		}
	
	
	var landImg1 = setTimeout("setLanding1()",1);
	var landImg2 = setTimeout("setLanding2()",1500);
	var landImg3 = setTimeout("setLanding3()",3000);
	
	}


function getServiceListImg(tType,totalImgs,linkTo){
	
	var randNo1 = Math.round((totalImgs-1) * Math.random() + 1);
	if(linkTo != ""){
		document.write("<a href=\"" + linkTo + "\"><img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo1 + ".gif\" alt=\"" + tType + "\" class=\"landing1\" style=\"display: none;\" /></a>");
		}
	else{
		document.write("<img src=\"/fm/c2/sites/default/files/landing/" + tType + "/" + tType + randNo1 + ".gif\" alt=\"" + tType + "\" class=\"landing1\" style=\"display: none;\" />");
		}
	
	var landImg1 = setTimeout("setLanding1()",1);
	
	}

function setLanding1(){
	$("img.landing1").fadeIn("slow");
	}
function setLanding2(){
	$("img.landing2").fadeIn("slow");
	}
function setLanding3(){
	$("img.landing3").fadeIn("slow");
	}


function openAuth(){
	var authWin = window.open("http://f2.washington.edu/fm/c2/wait.html","Authenticating via UW Net ID","directories=no,height=150,width=250,scrollbars=no,status=no,titlebar=no,toolbar=no,top=400,left=400");
	}

$(document).ready(function(){
   
	// THESE FORMAT RIGHT-SIDEBAR STUFF
	$("#sidebar-right .rave ul").addClass("nolist");
	$("#sidebar-right .rave ul li").css("display","none");
	var totalRaveLi = $("#sidebar-right .rave li").size();
	var randRave = Math.round((totalRaveLi-1) * Math.random() + 1);
	$("#sidebar-right .rave ul li:nth-child("+ randRave +")").show();
	
	$("#sidebar-right .didyouknow ul").addClass("nolist");
	$("#sidebar-right .didyouknow ul li").css("display","none");
	var totalDYKLi = $("#sidebar-right .didyouknow li").size();
	var randDYK = Math.round((totalDYKLi-1) * Math.random() + 1);
	$("#sidebar-right .didyouknow ul li:nth-child("+ randDYK +")").show();
	
	$("#sidebar-right .rave ul.nolist li").prepend("<span class='lquote'>&ldquo;</span>").append("<span class='rquote'>&rdquo;</span>");
	
	// ADJUSTS PAGE HEIGHT FOR LISTS ABOVE
	var rightHeight = $("#sidebar-right").height();
	var contHeight = $("#content").height();
	if(rightHeight > contHeight){
		$("#content").height(rightHeight);
		}
	
	
	
	
	////////// HIGHLIGHT MAIN MENU LINKS
	var curPage = document.location;
	var re1 = new RegExp("\/fm\/c2\/services\/");
	var re2 = new RegExp("\/fm\/c2\/tools\/");
	var re3 = new RegExp("\/fm\/c2\/online");
	
	if(re1.exec(curPage)){
		$(".block-nice_menus > .blockcontent > ul.nice-menu > li a:contains('Services')").css({"background-color" : "#a13623", "color" : "#ffffff"});
		}
	else if(re2.exec(curPage)){
		$(".block-nice_menus > .blockcontent > ul.nice-menu > li a:contains('Tools')").css({"background-color" : "#a13623", "color" : "#ffffff"});
		}
	else if(re3.exec(curPage)){
		$(".block-nice_menus > .blockcontent > ul.nice-menu > li a:contains('Online Ordering')").css({"background-color" : "#a13623", "color" : "#ffffff"});
		}
	
	
	
	// HOMEPAGE ALERT
	
	$("p.ccAlerts").slideDown("slow");
	


	// THESE ARE OPEN/CLOSE LISTS WITH STLE "deflist"
	$("ul.deflist > li:nth-child(2)").addClass("noneLi"); // THESE ARE THE DEFINITIONS
		$("ul.deflist > li:first-child").mouseover(function () { 
		$(this).css("cursor","pointer");
		});
	$("ul.deflist > li:first-child").click(function () { 
		$(this).toggleClass("activeLi");
		$(this).next().toggle("slow");
		});
	
	
	// WHICH LINKS POPPING TO NEW WINDOW:
 	$("a[href='https://weborder2.pubserv.washington.edu/']").attr({target: "_blank"});
 	//$("a[href='https://weborder2.pubserv.washington.edu/']").attr("href","https://weborder2.pubserv.washington.edu/?KeepThis=true&TB_iframe=true&height=700&width=700").addClass("thickbox");
	$("a[href*='http://depts.washington.edu/psworks/c2portfolio']").attr({target: "_blank"});
	//$("a[href*='http://www.washington.edu/maps/']").attr({target: "_blank"});
	$("a[href*='/fm/c2/sites/default/files/campusMap_C2.gif']").addClass("thickbox");
	$("a[href='http://f2.washington.edu/fm/c2/sites/default/files/campusMap_C2.gif']").addClass("thickbox");
	$("a[href*='https://dsf.creatcom.washington.edu/DSF/C2/redirect.asp']").mousedown(function(){
		$(this).append("<br /><span class='auth'>Authenticating...</span>&nbsp;");
		});

	// OLD LIGHTBOX 2 STUFF
	//Lightbox.initList();

 });



