
function jd_openPopup(urlx,namex,hx,wx) {
   return window.open(urlx,namex,'height=' + hx+ ',width=' + wx +',toolbar=0,menubar=yes,scrollbars=yes,Status=yes');
}


/**
 * animated menu function
 * make an half-dot follow the user mouse entered menu item
 * @required mootools 1.2
 */
function navArrowSlider(navWrap, navElementsArray, activeID, arrowY, size) {
	
	//effect function
	var youAreHere = new Fx.Tween($(navWrap), {duration: 600, transition: Fx.Transitions.Elastic.easeOut  });

	$$(navElementsArray).each(function(item){  
		item.addEvent('mouseenter', function() { 
			var thisPos = item.getPosition(navWrap).x  + item.getSize().x/2 - size/2; 
			youAreHere.cancel();
			youAreHere.start('background-position', thisPos + 'px ' + arrowY + 'px'); 
		});
	});
	
	var currentArrow = function() {
		youAreHere.cancel();
		var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x/2 - size/2; 
		youAreHere.start('background-position', activePos + 'px ' + arrowY + 'px');      
	};
	
	//correct IE rendering problem (without this, it wont go to the active nav onload)
	var activePos = $(activeID).getPosition(navWrap).x  + $(activeID).getSize().x/2 - size/2; 
	$(navWrap).setStyle('background-position', activePos + 'px ' + arrowY + 'px');       
	
	//works to set image to starting position in other browsers
	currentArrow(); 
	
	$(navWrap).addEvent('mouseleave', currentArrow);	
}; 
	
/**
 * initialise all javascript functions used by the page
 */
window.addEvent('domready', function() {
	navArrowSlider(
		'colRight', // ID of nav wrap
		'#colRight ul#menu li a', // Array selector of nav elements 
		'active_nav', // ID of current nav element
		'191px', //  Background position y of background image
		'19' //  INT ONLY - width of background image
	); 	
}); 


/**
 * check the mail form fields
 * 
 */
function checkMailForm(language) {
	if (language == 'fr') {
		nullSubject = 'Vous devez renseigner le champ Titre du mail.';
		nullContent = 'Vous devez renseigner le champ Texte du mail.';
	}
	
	var subject = document.getElementById('mailTitle');
	var content = document.getElementById('mailContent');
	
	if (subject.value == null || subject.value == '') {
		alert(nullSubject);
		if (e && e.preventDefault) {
			e.preventDefault();
		}
		return false;
	} else if (content.value == null || content.value == '') {
		alert(nullContent);
		if (e && e.preventDefault) {
			e.preventDefault();
		}
		return false;
	}
	
}
