function jsOpenWindow(url,w,h) {

	var nx = (screen.width / 2) - (w / 2);
	var ny = (screen.height / 2) - (h / 2);

	var w = window.open(url,'win','width=' + w + ',height=' + h + ',left=' + nx + ',top=' + ny + ',resizable=yes');
}

function jsCloseWindow() {

	window.close();
}

function jsValidateEmailRegExp(email) {

	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!(filter.test(email))) {
		return (false);
		}
	else {
		return (true);
	}
}

function jsValidateCanadianPostalCode(code) {

	var filter  = /^\s*[a-ceghj-npr-tvxy]\d[a-z](\s)?\d[a-z]\d\s*$/i;
	
	if (!(filter.test(code))) {
		return (false);
	}	 
	else {
		return (true);
	 }
}

function jsASPGridSearch(field, val) {

	eval('document.frmASPGridSearch.' + field + '.value = val');
	document.frmASPGridSearch.submit();
}

/****************************************/

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function winpwd() {
	window.open("/fr/send_password.asp","pwd","width=450,height=250,left=50,top=50,resize=yes");
}

function winaddcours() {
	window.open("/fr/dossier/newcours.asp","pwd","width=450,height=250,left=50,top=50,resize=yes");
}

function popwin(url,w,h){	
	window.open(url,'win','width=' + w + ',height=' + h + ',scrollbars=yes,status=no,resizable=yes');
}


function jsValidateData2(theForm) {
	
		if (theForm.email2.value == '') {
			alert('Vous devez entrer votre adresse courriel.');
			theForm.email2.focus();
			return (false);
		}
		
		if (theForm.pwd.value == '') {
			alert('Vous devez entrer votre mot de passe.');
			theForm.pwd.focus();
			return (false);
		}
		
		return (true);
}

function submitData() {
		if(CheckSS()) {
			document.frmSS.submit();
		}
	}

function CheckSS() {

		hasDot = document.frmSS.Email.value.indexOf(".");
		hasAt = document.frmSS.Email.value.indexOf("@");
		
		if (hasDot == -1 || hasAt == -1) {
			alert("Vous devez entrer une adresse courriel valide.");
			document.frmSS.Email.focus();
			return false;
		}
		
	return true;
}

function jsSubmitForm(val) {

	if (val != -1) {
		document.frmTri.submit();
	}
}

	
function fVerifyData() {	
	for(var i = 1; i < document.frmCours.length; i++) {
		if(document.frmCours[i].type == "checkbox") {
			if(document.frmCours[i].checked == true) {
				document.frmCours.submit();
				return;
			}
		}
	}

	alert("Vous devez cocher au moins une date.");
	return;
}





