// general_fr.js

	function checkEmail(objEmail) { 

	if(objEmail == null) return false;
	if (objEmail.value=="") {
		alert('Vous devez fournir votre adresse courriel'); 
		objEmail.focus(); 
		return false;
	} 
	if ((objEmail.value.indexOf ('@') == -1)|| (objEmail.value.indexOf ('.') == -1)) {
		alert('L&#39se courriel est invalide'); 
		objEmail.focus(); 
		return false;
	} 
	return true;
}

function checkPostCode(objPostCode)
{
	if(objPostCode==null) return false;
		
	if(!objPostCode.value.match(/^[ABCEGHJKLMNPRSTVXY]\d[A-Z]\d[A-Z]\d$/g))
	{
		objPostCode.focus();
		alert("Le format du code postal est \"A1B2C3\"");
		return false;
	}
	
	return true;

}

/*
 *Check the telphone format in 555-545-5555 format
 */
function checkTelephone(objTelephone)
{
	
	if(objTelephone==null) return false;
	
	if(!objTelephone.value.match(/^\d\d\d-\d\d\d-\d\d\d\d$/g))
	{
		objTelephone.focus();
		alert("Le format du no de téléphone est \"555-555-1234\"");
		return false;
	}
	
	return true;
}



function openPlainXY(url, windowname, width, height) {
	
	NewWindow=window.open(url,windowname,'toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbar=no,scrollbars=yes,top=20,left=20,resizable=yes,width='+width+',height='+height);
	NewWindow.focus();
}


// compareDates function
// Parameters month1, day1, year1 : date1 in the format of MM, DD, CCYY
//            month2, day2, year2 : date2 in the format of MM, DD, CCYY
// month1 and month2 should be in the range 1 to 12 inclusive
// day1 and day2 should be within 1 to 31 (or 28, 29 or 30)
// year1 and year2 shoud be in CCYY format
// NOTE: DOES NOT CHECK FOR VALID DATES; As well, date format/range should
// not matter, so long as both dates are in the same format
// Returns -1 if date1 < date2 ; 0 if date1 == date2 ; +1 if date1 > date2
function compareDates(month1, day1, year1, month2, day2, year2) {
	if ( year1 < year2 ) {
		return -1;
	} else if ( year1 > year2 ) {
		return 1;
	} else { // year1 == year2
		if ( month1 < month2 ) {
			return -1;
		} else if ( month1 > month2 ) {
			return 1;
		} else { // month1 == month2
			if ( day1 < day2 ) {
				return -1;
			} else if ( day1 > day2 ) {
				return 1;
			} else { // day1 == day2 && month1 == month2 && year1 == year2
				return 0;
			}
		}
	}
}

// dateDiff function
// returns date1 - date2 in days
// NOTE: This calculates the DIFFERENCE between two dates in days
//       If you are looking to calculate the length of a trip, INCLUDING
//       the depart/return dates, you would add 1 to the result.
//       E.g. dateDiff (9,3,2005, 9,1,2005) would return 2, but it would
//            represent a *3* day trip
function dateDiff (month1, day1, year1, month2, day2, year2) {
	var ret = 0;
	var mon1 = month1 - 1;
	var mon2 = month2 - 1;
	var date1 = new Date (year1, mon1, day1);
	var date2 = new Date (year2, mon2, day2);
	date1.setHours(12);
	date2.setHours(12);
	ret = Math.round((date1.getTime() - date2.getTime())/(1000*60*60*24));
	return ret;
}



