// preloading the navigation images. 
 if (document.images){
  pic1= new Image(); 
  pic1.src="/images/common/nav-home-on.gif"; 
  pic2= new Image(); 
  pic2.src="/images/common/nav-courses-on.gif";
  pic3= new Image(); 
  pic3.src="/images/common/nav-faculty-on.gif";
  pic4= new Image(); 
  pic4.src="/images/common/nav-calendar-on.gif";
  pic5= new Image(); 
  pic5.src="/images/common/nav-about-medworx-on.gif";
	pic6= new Image(); 
  pic6.src="/images/common/nav-about-registration-on.gif";
	pic7= new Image(); 
  pic7.src="/images/common/nav-about-references-on.gif";
	pic8= new Image(); 
  pic8.src="/images/common/home-course-desc-bg-on.jpg";
 }
 
//Generic image swap function, make sure to name your images -off and -on. Works with any extension. usage = swap(this, 1); to turn an image on 0 to turn it off. 
function swap(lmnt, state) { 
	currentImg = lmnt.src;
	ext = currentImg.substring(currentImg.lastIndexOf("."));
	currentSub = currentImg.substring(0,currentImg.lastIndexOf("-"));
	if(state == 1){
		lmnt.src = currentSub + "-on" + ext;
		//alert (lmnt.src);
	} else { 
		lmnt.src = currentSub + "-off" + ext;
	}
}

//Swap subnav class
function subnav(daID, state) { 
	if (state == 1) { 	
		$(daID).style.backgroundImage = "url(/images/common/home-course-desc-bg-on.jpg)";
	} else { 
		$(daID).style.backgroundImage = "url(/images/common/home-course-desc-bg.gif)";
	}
}




function popLayer(faculty) { 
	if($('popbg').style.display != "block") { 
		$('popbg').style.display = "block";
		Effect.Grow($('poplayer'), {duration:.4});
		new Ajax.Updater('popcontent', '/za/MW?PAGE=POPLAYER&STAFF=' + faculty, { method: 'get' });
	} else { 
		Effect.Shrink($('poplayer'), {duration:.4});
		setTimeout(function () { $('popbg').style.display = "none"; }, 401);
	}
}

//Swap out the email address. 
function view_address() {
	address_to_replace=$("emailus").alt;
	real_address=address_to_replace.replace("[at]", "@");
	address_to_replace.nodeValue=real_address; 
	$('e').setAttribute("href", "mailto:"+real_address); 
}
window.onload = function() { view_address(); }
