// ---------------------------------------------------------------------------
// JM - 2004/03/22
// designed to obscure the mail addresses from spam harvesters.
// adrMail.syntax ( 'domain','tld','address','linktext','subject' ) ;
// -> <a href="mailto:address@domain.tld?subject=subject">linktext</a>
//  - 'subject' is optional and can be left out.
//  - if 'linktext' is empty then the mail address will be used.
// nota: if the linktext really needs to use a different mail address then use '(at)'
// instead of '@' even though this is not a good idea defeating the object of the code...

function adrMail( theDomain,tld,address,linktext,subject ) {
	var to ='mailto:uce@ftc.gov' ; // could also use 'spam@cnil.fr' here
	var at =to.substring( 10,11 ) ;
	    dot=to.substring( 14,15 ) ;
	    to =to.substring( 0,7 ) ;

	    if( -1!=linktext.indexOf( '(at)' )) { linktext = linktext.replace( /\(at\)/, at ) ; }
	    if( ''==linktext ) { linktext = address+at+theDomain+dot+tld ; }
	    if( ''!=subject ) { tld +='?subject='+subject ; }
	var theAdr = linktext ;
	var URL    = to+address+at+theDomain+dot+tld ;
	    document.write( theAdr.link( URL )) ;
}

