function checkLogin(){
	if( $F("dntfnt").stripTags().strip() == '' ) {
		alert("Veuillez renseigner un compte utilisateur."); 
		return false;
	}
	if( $F("mdp").stripTags().strip() == ''  ) {
		alert("Veuillez renseigner un mot de passe."); 
		return false;
	}	
	return true;
}
function checkLoginError(){
	if( typeof (login_error) == 'string' ){
		window.open('../popup/popupErrorLogin.jsp?error='+encodeURIComponent( login_error ),
		'Erreur',
		'menubar=no, status=no, scrollbars=no, menubar=no, width=400, height=100');
	}
}
var ToolsBoxApplication = {
	showMessage : function(idZone, message) {
		var textHTML = '<span class="toolsboxMessageInformationPicto">&nbsp;</span>';
		textHTML += '<span class="toolsboxMessageInformation">' + message + '</span>';
		$(idZone).update(textHTML);
		$(idZone).show();
	},
	showError:function(idZone, message) {
		var textHTML = '<div class="toolsboxMessageErrorPicto">&nbsp;</div>';
		textHTML += '<div class="toolsboxMessageError">' + message + '</div>';
		$(idZone).update(textHTML);
		$(idZone).show();
	},
	hideMessage:function(idZone){
		$(idZone).update('&nbsp;');
		$(idZone).hide();
	}
};
function openContactAssmat( oLnk ){
	window.open(oLnk.href, "contact_assmat","menubar=no, status=no, scrollbars=no, menubar=no, width=550, height=500");
	return false;
}

function openContactAdmin( oLnk ){
	window.open(oLnk.href, "contact_admin","menubar=no, status=no, scrollbars=no, menubar=no, width=550, height=500");
	return false;
}
function getURLContext() {
	try {
		var context = location.pathname.substring(1);
		context = context.substring(0, context.indexOf('/'));
		return context;
	} catch (err) {
		return null;
	}
}

/** Renvoie l'URL compl?t?e du contexte applicatif */
function getURL(path) {
	if (path.length > 0 && path.charAt(0) == "/") {
		path = "/" + getURLContext() + path;
	}
	return path;
}

/** Renvoie la valeur du param?tre pr?sent dans l'URL */
function getURLParameter(name) {
	// utilisant de l'extension toQueryParams de prototye.js
	var params = document.location.search.toQueryParams();
	return params[name];
}
function isNull(element){
   return (element == null) || (element == undefined);
}
function isBlank(element){
   return (isNull(element) || element.length == 0);
}
testDate=function(fldName){
	
	var strValue = $F(fldName);
	if(/^\d{1,2}\/\d{1,2}\/\d{4}$/.test(strValue)){
		var arrayDate = strValue.split('/'); 
	    var arrayLookup = { '01' : 31,'03' : 31, 
	                        '04' : 30,'05' : 31,
	                        '06' : 30,'07' : 31,
	                        '08' : 31,'09' : 30,
	                        '10' : 31,'11' : 30,
	                        '12' : 31};
	    var intDay = parseInt(arrayDate[0],10); 
		if(arrayLookup[arrayDate[1]] != null) {
			if(intDay <= arrayLookup[arrayDate[1]] && intDay > 0){
	    		return true;
			}
		}
	 	var intMonth = parseInt(arrayDate[1],10);
	 	if (intMonth == 2) { 
			var intYear = parseInt(arrayDate[2],10);
			if (intDay > 0 && intDay < 29) {
	    		return true;
			} else if (intDay == 29) {
				if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
	      			(intYear % 400 == 0)) {
	      			return true;
	  			}   
			}
		}
	} 
	return false;
};
openPopupWindow=function(sUrl, sWindowName, sOptions){
	window.open(sUrl, sWindowName, sOptions);
	return false;
};
initDropDownMenu=function(){
	$$('li.headlink').each( function(li){
		li.onmouseover = function() { 
			$(this).select('ul')[0].style.display='block';
		};
		li.onmouseout = function() { 
			$(this).select('ul')[0].style.display='none';
		};		   
	});	
};
/**
 * Ouvrir et positionner une Popup au centre de l'�cran
 * 
 * @param url Adresse de la page � appeler
 * @param nom Nom de la popup
 * @param largeur D�finit la largeur de la popup
 * @param hauteur D�finit la hauteur de la popup
 * @param options Options supppl�mentaire
 * 
 * @author MHA
 * 
 */
function fenetreCent(url,nom,largeur,hauteur,options) {
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	fencent=window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}
