
doOnWindowLoad( targetReplacer );

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( element, url ) {

	var elem = document.getElementById( element );
	elem.onclick = function() { window.location = url; }
	
}

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 clearFieldOnFocus( field ) {
	
	var formField;

	if( typeof field == "string" ) {
	
		if( document.getElementById( field ) ) {
	
			formField = document.getElementById( field );
			
		} else { return }
	
	}
	
	if( formField.value ) { formField.onfocus = function() { formField.value = ""; } }

}

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

// Be able to 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();
		
		}
	
	}

}

function getWinWidth() {
	
	if( window.innerWidth ) return window.innerWidth;
	else if( document.documentElement ) return document.documentElement.offsetWidth;
	else if( document.body.clientWidth ) return document.body.clientWidth;
	
	else return 0;

}

function getWinHeight() {
	
	if( window.innerHeight ) return window.innerHeight;
	else if( document.documentElement ) return document.documentElement.offsetHeight;
	else if( document.body.clientHeight ) return document.body.clientHeight;
	
	else return 0;
	
}

function getWinPosLeft() { return (document.all)?window.screenLeft:window.screenX; }
function getWinPosTop() { return (document.all)?window.screenTop:window.screenY; }



