/*******************************************************************
 * This is the core JS library for the Jobs.NET application.
 * It assumes the presense of ASP.NET AJAX ScriptManager.
 *
 * $Id$
 ********************************************************************/

function init() {
    emailCloak();
}

function emailCloak() {
	if (document.getElementById) {
		var alltags = document.all? document.all : document.getElementsByTagName("*");
		for (i=0; i < alltags.length; i++) {		    
		    if (alltags[i].className == "eCloak") {
			    var oldText = alltags[i].firstChild;
			    var emailAddress = alltags[i].firstChild.nodeValue;
			    var user = emailAddress.substring(0, emailAddress.indexOf("("));
			    var website = emailAddress.substring(emailAddress.indexOf(")")+1, emailAddress.length);
			    var newText = user+"@"+website;
			    var a = document.createElement("a");
			    a.href = "mailto:"+newText;
			    var address = document.createTextNode(newText);
			    a.appendChild(address);
			    alltags[i].replaceChild(a,oldText);
		    }
		}
	}
}

window.onload = init;

//END
