// JavaScript Document

function getImage(x,y) {
var imgArray=29, imgIndex=(Math.floor(Math.random()*imgArray));
while(a==imgIndex+1 || y==imgIndex+1){
	imgIndex=(Math.floor(Math.random()*imgArray));
}
++imgIndex;
if(x==0){
	x=imgIndex;
	}
else if(y==0) {
	y=imgIndex;
	}
document.write('<img src="mini/mini_'+(imgIndex)+'.jpg">');
a=x;
b=y;
}

function PopWindow(theURL,h) { //v2.0
var w=(screen.availWidth/2)-200;
  window.open(theURL,'','left='+w+',top=0,scrollbars=0,menubar=no,locationbar=no,toolbar=no,width=400, height=' + h);
}

function requis(form){
// Donne à un champs caché "action"
// la valeur de la commande actionnée
// par l'utilisateur et vérifie que les champs
// requis soient bien remplis
	var n,args=requis.arguments, l=args.length - 1;
	if(l > 0) {
		for(var i=1; i<args.length; i++){
			n=args[i];
			if(n.value == '' || n.value == 0) {
					alert("Vous devez remplir tous les champs requis !"); 
					n.focus();
					return false;
			}//if
		}//for
	}//if
	//form.submit();
	return true;
}

function checkCourriel(f){
// Vérifie si le champ contient bien une adresse courriel contenant "@"
	with (f){
	var s = value.split(/@/);
		if((value)&&(value.search(/ /)!=-1||s.length!=2||!(s[0])||!(s[1])||s[1].search(/\.\w/)==-1)){	
			focus();
			value = '';
			alert("Ce courriel est invalide!");					
			return false;
		}//if
		else {
			if (value == '') return false; else return true;
		}
	}//with
}//funct


function redirect(page,ctrl) {
	if(ctrl.value != 0)
		document.location.href=page + ctrl.value;
}
