// JavaScript Document

//Common to all GRCC Pages

//From Dreamweaver

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

//Focused popup window
function popWin(url,height,width,toolbar,menubar,locationbar,scroll,resize,status,name) {
			var Browser;
			var spec;
			spec = "status="+status+",toolbar="+toolbar+",menubar="+menubar+",location="+locationbar+",scrollbars="+scroll+",resizable="+resize+",height="+height+",width="+width;
			remote = window.open(url, name, spec);
			remote.focus();
			remote.location.href = url;
			}
			
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
if (document.images) {
//rollover images  
  search_btn = new Image();
  search_btn.src = "http://www.instruction.greenriver.edu/markb/web_templates/distance/images/btn_search_off.gif";
  search_btn2 = new Image();
  search_btn2.src = "http://www.instruction.greenriver.edu/markb/web_templates/distance/images/btn_search_on.gif";
  az_index_tab = new Image();
  az_index_tab.src = "../images/tab_index_off.gif";
  az_index_tab2 = new Image();
  az_index_tab2.src = "../images/tab_index_on.gif";
  sitemap_tab = new Image();
  sitemap_tab.src = "../images/tab_sitemap_off.gif";
  sitemap_tab2 = new Image();
  sitemap_tab2.src = "../images/tab_sitemap_on.gif";
}
function OnImage(name) {
	if (document.images) {
		fullname = eval(name + "2");
		document[name].src = fullname.src;
	}
}
function OffImage(name) {
  if (document.images) {
    fullname = eval(name);
	if (fullname.complete) {
      document[name].src = fullname.src;
	}
  }
}

<!-- Begin
// Script by Trånn: http://come.to/tronds
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/

var initialsubj="Hi there. You may be interested in this."
var initialmsg="Hi:\n\n You may want to check out this page from Green River Community College site: "+window.location
var good;
function checkEmailAddress(field) {

var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.sex)|(\.biz)|(\.aero)|(\.coop)|(\.museum)|(\.name)|(\.pro)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
}
else {
alert('Please enter a valid address.');
field.focus();
field.select();
good = false;
   }
}
u = window.location;
function mailThisUrl() {
good = false
checkEmailAddress(document.eMailer.email);
if (good) {

//window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+document.title+" "+u;
window.location = "mailto:"+document.eMailer.email.value+"?subject="+initialsubj+"&body="+initialmsg
   }
}
//  End -->

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//JUMP MENU FROM PROJECT SEVEN

function P7_JumpMenu(selObj,restore){ //v1.4 by Project Seven
	var theFullString = selObj.options[selObj.selectedIndex].value;
	if (restore) selObj.selectedIndex=0;
	var theLength = theFullString.length;
	var endPos = theFullString.lastIndexOf("~");
	var theUrl, theTarget, theParent;
	if (endPos > 0) {theUrl = theFullString.substring(0,endPos);}
	else {theUrl = theFullString;}
	endPos++
	if (endPos < theLength) {theTarget = theFullString.substring(endPos,theLength)}
	else {theTarget = "window:Main";}
	if (theTarget == "window:New") {window.open(theUrl);}
	else if (theTarget == "window:Main") {eval("parent.location='"+theUrl+"'");}
	else {eval("parent.frames[\'"+theTarget+"\'].location='"+theUrl+"'");}
}

//HIDE SHOW

function showHide(id)
{
	var el = document.getElementById(id);
	if (el.className == "show")
		el.className = "hide";
	else
		el.className = "show";
}
