startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("navDD");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}



function addy(user, display){
	server = 'onereel.org'
	open1 = '<a href="ma'
	open2 = 'ilto:'
	open3 = '">'
	close1 = '</a>'
	
	if(!display){
		var showme = user + '\x40' + server;
	}else{
		var showme = display;
	}
	var theAddy = open1 + open2 + user + '\x40' + server + open3 + showme + close1;
	//document.write(theAddy);
	return theAddy;	
	}
	
/*
function popNew(a,n,h,w)	{
if((typeof(popWin) != "undefined")){
	popWin.close();
	}
popWin = window.open(a,n,'directories=0,height=' + h + ',width=' + w + ',location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0');
return false;
}
*/

var popWin = false;

function popNew(a,n,h,w)    {
	popWin = window.open(a,n,'directories=0,height=' + h + ',width=' + w + ',location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0');
   if (window.focus) {popWin.focus()}
   return false;
}

function getElementsByClass(node,searchClass,tag) {
	 var classElements = new Array();
	 var els = node.getElementsByTagName(tag); // use "*" for all elements
	 var elsLen = els.length;
	 var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	 for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
	 		classElements[j] = els[i];
	 		j++;
 		}
 	}
 return classElements;
 }

function writeEmail() {
	var emlArray = new Array();
	emlArray = getElementsByClass(document.getElementById("main"),"eml","span");
	for (i = 0; i < emlArray.length; i++) {
		email = emlArray[i];
		email.innerHTML = addy((email.getAttribute('id')),(email.getAttribute('title')));
	}
}


// this function is a wrapper for anything that needs to run on page load.
function loader() {
	writeEmail();
	
	if (document.getElementById('navDD')){
		startList();
		}
}

window.onload=loader;
