/* Improved Suckerfish Dropdown function
   This function from http://simeons.net/suckerfish_ie5mac_fix.htm,
   which is based on the JavaScript from Son of Suckerfish Dropdowns
   http://htmldog.com/articles/suckerfish/dropdowns/                 */
function sfHover() {
	var sfEls = document.getElementById("nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onMouseDown=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onMouseUp=function() {
			this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
		}
	}
}

/* Loading method by Larry Israel,
   based on http://simeons.net/suckerfish_ie5mac_fix.htm and
   comment #49 at http://www.htmldog.com/ptg/archives/000050.php */
if (document.all) { // Load sfHover only in IE; other browsers don't need it
	if (window.attachEvent) window.attachEvent("onload", sfHover);
	else window.onload = sfHover; // Mac IE5 needs this
}


// Keep the dropdown menus hidden from Safari versions before 1.1 (build 86)
// http://www.alistapart.com/discuss/dropdowns/13/#c6369
var agent     = navigator.userAgent.toLowerCase();
var appVer    = navigator.appVersion.toLowerCase();
var is_safari = (agent.indexOf("safari") != -1);
var build     = appVer.substring(appVer.lastIndexOf("/")+1);
if (build < 86) {
	document.write('<style type="text/css">ul#nav li:hover ul {display: none}<\/style>');
}
function makeEmailRef(addr) {
	var mailProtocol = 'mailto';
	var ourDomain = 'audiblemagic.com';
	var full = addr + '@' + ourDomain;
	document.write('<a href="' + mailProtocol + ':' + full + '">' + full + '<\/a>'); 
	return 0;
}
