// William & Mary Template
// Common utility scripts

// USER NAV
// Dropdown Script - adapted from Suckerfish
// http://www.htmldog.com/articles/suckerfish/dropdowns/ 
		
	set_user_nav_dropdown = function() {
	       		var target_element = document.getElementById("user-nav-dropdown-wrapper");
		
		// set mouseover events
		
		target_element.onmouseover=function() {  
			this.className+=" sfhover";
			}
			
		target_element.onmouseout=function() { 

			this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); 
			}
			
	}
		
	// attach dropdown event to window onload (only works in IE)
	
	if (window.attachEvent) window.attachEvent("onload", set_user_nav_dropdown);
        window.onload = set_user_nav_dropdown;
	
// PRIMARY NAV, ADMISSION NAV, ETC.
// Image Rollover Script

	function set_rollover(img_element, normal_filename, rollover_filename) {
	
		// preload image ?				
		
		// set mouseover event
		
     	img_element.onmouseover = function() { this.src=rollover_filename; }
        img_element.onmouseout = function() { this.src=normal_filename; }		
		
	}
	
// HOMEPAGE IMPACT WIDGET

	function show_hide_module(module_id) {
		var target_element = document.getElementById(module_id);

		if (target_element.style.display=="block") {
			target_element.style.display = "none";
		}
		else {
			target_element.style.display = "block";		
		}
	
		return false;
	
	}	

