/**
 * This function will add a target _blank effect with the onclick attribute
 * on any css selector (i.e a.blank => all the a with the class blank)
 * 
 * @author Francois Lavertu
 */

addTargetBlank = function(sCssSelector){
    $$(sCssSelector).invoke('observe', 'click', function(e){
    
        Event.stop(e);
        // check if the element as the href attribute 
        var sLink = e.element().readAttribute('href') || e.element().up('a[href]').readAttribute('href');

        if(sLink){
            window.open(sLink); 
            Event.stop(e);    
        }    
    });
}

Event.observe(window, 'load', function() {
	
	if($('courriel')){
		var val = $F('courriel');
		$('courriel').observe('focus', function(e){
			($F('courriel') == val) ? $('courriel').value = '' : null;								  
		});
		$('courriel').observe('blur', function(e){
			($F('courriel') == '') ? $('courriel').value = val : null;									  
		});
	}
		
});
	
	
document.observe('dom:loaded', function(){
    addTargetBlank('a.blank');
});
