Event.observe(window, 'load', function() {
	addTargetBlank('a.blank');
	
	// envoyer a un ami
	if($('btn_envoyer')){
		initEnvoyer();	
	}
	
	if($('s_email')){
		var val = $F('s_email');
		$('s_email').observe('focus', function(e){
			($F('s_email') == val) ? $('s_email').value = '' : null;								  
		});
		$('s_email').observe('blur', function(e){
			($F('s_email') == '') ? $('s_email').value = val : null;									  
		});
	}
		
});

/**
 * 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)
 *
 */
addTargetBlank = function(sCssSelector){
    $$(sCssSelector).invoke('observe', 'click', openBlankWindow).invoke('observe', 'keypress', openBlankWindow);
}
function openBlankWindow(e){
    // check if the element as the href attribute 
    if(this.href){
        window.open(this.href); 
        Event.stop(e);    
    }    
}

/**
 * Add print button if the navigator can handle javascript print
 *
 */
function addPrintButton(){
	if (typeof(window.print) != "undefined") {
		document.write('<a href="javascript:window.print();">Imprimer</a>');
	}
}


/**
 * Create a popup to send to a friend
 *
 */
function initEnvoyer(){
	
	var sParam ='scrollbars=yes,resizable=yes,width=447,height=530';
	$('btn_envoyer').observe('click', function(e){
		
		window.open(this.href, 'win', sParam); 
		Event.stop(e);
	});
}
