// global site javascript (basic.js)

	// init code for all pages (called once page is ready for active scripting)
	// can also add individual init calls on specific pages if needed
	$(document).ready(globalScriptInit);
	
	function globalScriptInit(){
	    // init function - can do any set up that requires jQuery and page to be loaded and ready
		
		// add rollover glow effect to contact button
		
		$('#topContact').hover(function () {
				// roll over							 
				var imgSrc = $(this).find("img").attr("src");
				var baseName = imgSrc.split("_")[0];
				$(this).find("img").attr( {src: "" + baseName + "_on.png"} );
			},
			
			function() {
				// roll out
				var imgSrc = $(this).find("img").attr("src");
				var baseName = imgSrc.split("_")[0];
				$(this).find("img").attr( {src: "" + baseName + "_off.png"} );
			}
		);
								
		
		
		// ** add rollover handlers to all nav button targets 
		
		$('.navImg').hover(function () {
				// roll over - blur all nav images EXCEPT this one
				
				// add temp class to this one image so it does NOT get blurred below
				$(this).toggleClass("nav-hold-on");  
			
				// for all other images, get source and swap with blurred version
				$('.navImg:not(.nav-hold-on)').each(function() {
					var imgSrc = $(this).attr("src");
					var baseName = imgSrc.split("_")[0];
					$(this).attr( {src: "" + baseName + "_on.png"} );
				});
			},
			
			function() {
				// roll out - return all to normal state
				$('.navImg:not(.nav-hold-on)').each(function() {
					var imgSrc = $(this).attr("src");
					var baseName = imgSrc.split("_")[0];
					$(this).attr( {src: "" + baseName + "_off.png"} );										 
				});
				
				// toggle temp class added on back off
		  		$(this).toggleClass("nav-hold-on");
			}
		);
		
		/*
		$('.navImg').mouseenter(function(e) {
			// when we enter a nav image, add temp class to it (so we know not to fade that one) and fade all other nav images							 
			$(this).toggleClass("nav-hold-on");  
			// stop() is the crucial component below - this interrupts a fade back on that may be playing and immediately begins the fade out
			// this prevents the flash on and off that otherwise occurs if you quickly roll between nav images
		  	$('.navImg:not(.nav-hold-on)').stop().fadeTo(450, 0.2);
			
		});
		
		
		$('.navImg').mouseleave(function(e) {
			// return any nav images that were faded out back to normal state							 
			$('.navImg:not(.nav-hold-on)').fadeTo(450, 1.0);
			// toggle temp class added on back off
		  	$(this).toggleClass("nav-hold-on");
		  	
			// $(this) is nicer than (e.target)
		});
		*/
		
	}





	function openMail(raddr) {
		// just a goofy way to avoid having email address actually spelled out in code or html, to make it harder for spambots to retrieve
		
		var wURL, wAttrs;
	
		wURL = 'ma' + 'il' + 'to:' + raddr + '@' + 'dm' + 'sint' + 'eracti' + 've' + '.' + 'co' + 'm';
		//wAttrs = "height=464,width=620,resizable=no,scrollbars=no,status=no,toolbar=no,location=no";
		window.open(wURL, "", "");
		window.focus;		
	}
	
	
