/*
		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 ));
	    document.write( theAdr.title( 'toto' ));
	    alert( 'toto' );
}

/*		invokeLang()
			JM
			r1 - 2005/08/03

			This is used by the formLangSwitcher widget
			and is used on nearly every page
------------------------------------------------------- */
function invokeLang( theValue,theURL ) {

	var str = theValue;
	var url = theURL;	
	if( -1 == url.indexOf( '?' )) {
		url = url+'?lang='+theValue;	
	} else {
		url = url+'&lang='+theValue;
	}
	window.location.href = url;
}


/*		function extTarget( )
			JM & AP
			r4 - 2006/05/31

			changes target on external links
			so that they open in a new window
------------------------------------------- */
function extTarget() {
    var a = document.links;
    var n = '';
    for( var i = 0; i < a.length; i++ ) {
        n = a[i].hostname;
        if(( '' != n ) && ( n != window.location.hostname )) { a[i].target = '_blank'; }
    }
}


/*		function popUpWnd( theURL,wndType )

			launches a popup window
			theURL  -> page to display in the window
			wndType -> the type of popup window to display

			from: http://www.accessify.com/tutorials/the-perfect-pop-up.asp
			r2 - 2005/10/13
------------------------------------------- */
function popUpWnd( theURL,width,height ) {

	var strOptions = '';
	var myWidth    = 1 *width;
	var myHeight   = 1 *height;

	if( 0 == myWidth  ) { myWidth  = 400; }
	if( 0 == myHeight ) { myHeight = 400; }

	strOptions = 'width='+myWidth+',height='+myHeight+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
	zoom = window.open( theURL,'popup',strOptions );
	if( zoom.window.focus ) { zoom.window.focus(); }
}

