
doOnWindowLoad( targetReplacer );
doOnWindowLoad( makeClickable );

function targetReplacer() {
 if (!document.getElementsByTagName) return;
 var anchorTags = document.getElementsByTagName("a");
  for (var i=0; i<anchorTags.length; i++) {
   var anchor = anchorTags[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "blank")
     anchor.target = "_blank";
 }
}

function makeClickable() {

	if( homepage==0) {
		var header = document.getElementById( "header" );
		header.onclick = function() { window.location = "../index.php"; }
	}
}

function show_em_addr( nm, dm, ex, ky ) {

	var keyId = document.getElementById( nm+ky );
	keyId.setAttribute("href", "m"+"ai"+"l"+"t"+"o"+":"+nm+"@"+dm+"."+ex);
	keyId.appendChild( document.createTextNode( nm+"@"+dm+"."+ex ) );
	
	var imgId = document.getElementById( ky );
	imgId.style.visibility = "hidden";

}

function stripeTables() {

	if( !document.getElementsByTagName ) return false;
	var tableElems = document.getElementsByTagName( "table" )
	for( var i = 0; i < tableElems.length; i++ ) {
	
		var odd = false;
		var rows = tableElems[ i ].getElementsByTagName( "tr" );
		for( var j = 0; j < rows.length; j++ ) {
			
			if( rows[ j ].className != "highlight" ) {
				
				if( odd == true ) {
					addClass( rows[ j ], "odd" );
					odd = false;	
				} else {
					odd = true;	
				}
				
			}
			
		}
		
	}
	
}

function addClass( element, value ) {
	
	if( !element.className ) {
		
		element.className = value;
		
	} else {
		
		newClassName = element.className;
		newClassName += " ";
		newClassName += value;
		element.className = newClassName;
		
	}
	
}

// Do multiple window.onload calls...

function doOnWindowLoad( thisProcedure ) {

	var thisOnload = window.onload;
	
	if( typeof window.onload != 'function' ) {
	
		window.onload = thisProcedure;
	
	} else {
	
		window.onload = function() {
		
			thisOnload();
			thisProcedure();
		
		}
	
	}

}
