

function validNewsletter(nform) {
	var nom = nform.nom.value;
	var email = nform.courriel.value;
	var langue = nform.langue.value;
	if ((nom == "") || (email == "")){
		if(langue=="FR"){
			window.alert("Les champs Nom et Courriel sont obligatoires !");
			return false;
		}else {
			window.alert("Please enter your name and email!");
			return false;
		}
	
	}else if (checkEmail(email,langue) != true){
		return false;
	}else {
		centerwindow("../interface/include/confirmation.php","popup",400,180,"scrollbars=no,menubar=no,resizable=no,status=no,toolbar=no, location=no");
	}
}
  
function checkEmail(emailAddr,langue) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(emailAddr)){
	return (true)
	}
		if(langue=="FR"){
			alert("Veuillez entrer un courriel valide svp !");
			return false;
		}else {
			alert("Please enter a valid email!");
			return false;
		}
}


function centerwindow(theurl,wname,width,height,options) {
    x = (640 - width)/2, y = (480 - height)/2;

    if (screen) {
        y = (screen.availHeight - height)/2;
        x = (screen.availWidth - width)/2;
    }
        if (screen.availWidth > 1800) { 
        x = ((screen.availWidth/2) - width)/2; 
    } 

	theurl = theurl + location.search ;

	if (options != ""){
		options = "," + options ;
	}
	openWin = window.open(theurl, wname, 'width='+width+',height='+height+',screenX='+x+',screenY='+y+',top='+y+',left='+x + options); 
	if(openWin.window.focus){openWin.window.focus();}

}
function validPaiement(nform) {
	var nom = nform.nom.value;
	var arrivee = nform.arrivee.value;
	var dep = nform.dep.value;
	var amount = nform.amount.value;

	
	if ((nom == "") || (amount == "")){
		window.alert("Les champs Nom et Montant sont obligatoires!");
		return false;
	
	}else {
		nform.item_name.value = nom + " - Dépôt location pour dates :"+arrivee+ dep;
		nform.submit();
	}

}

//fancybox

$(document).ready(function() {

			
	$("a.zoom").fancybox({
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade',
		'overlayShow'	: false,
		'autoScale'     : false,
		overlayShow     : true,
		overlayOpacity	: 0.7,
		overlayColor	: '#000000'
	});
	
	$("a.zoomimage").fancybox({
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'autoScale'     : false,
		'overlayShow'     : true,
		'overlayOpacity'	: 0.7,
		'overlayColor'	: '#000000'
	});

	
});