var myDelay=0;
function FocusChamp(BoxName)
{
    if (BoxName.value == BoxName.defaultValue) { BoxName.value = ''; }
}

function BlurChamp(BoxName)
{
    if (BoxName.value == '') { BoxName.value = BoxName.defaultValue; }
}
function showMenu(id){
	document.getElementById('ssm1').style.visibility="hidden";
	document.getElementById('ssm2').style.visibility="hidden";
	document.getElementById('ssm3').style.visibility="hidden";
	document.getElementById('ssm4').style.visibility="hidden";
	document.getElementById('ssm5').style.visibility="hidden";
	if (id!="") {
		document.getElementById(id).style.visibility="visible";
	}
}
function acDelay(boolean,id) {
	if (boolean) {
		window.clearTimeout(myDelay);
		if (id=="r1") {
			document.getElementById('i002').src='img/playarts_002o.jpg';
		} else if (id=="r2") {
			document.getElementById('i003').src='img/playarts_003o.jpg';
		} else if (id=="r3") {
			document.getElementById('i004').src='img/playarts_004o.jpg';
		} else if (id=="r4") {
			document.getElementById('i006').src='img/playarts_006o.jpg';
		} else if (id=="r5") {
			document.getElementById('i009').src='img/playarts_009o.jpg';
		}
	} else {
		myDelay = setTimeout("showMenu('')",100);	
		if (id=="r1") {
			document.getElementById('i002').src='img/playarts_002a.jpg';
		} else if (id=="r2") {
			document.getElementById('i003').src='img/playarts_003a.jpg';
		} else if (id=="r3") {
			document.getElementById('i004').src='img/playarts_004a.jpg';
		} else if (id=="r4") {
			document.getElementById('i006').src='img/playarts_006a.jpg';
		} else if (id=="r5") {
			document.getElementById('i009').src='img/playarts_009a.jpg';
		}

	}
}
function isNumeric(sText){
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++){
	Char = sText.charAt(i);
		if (ValidChars.indexOf(Char) == -1){
			IsNumber = false;
		}
	}
	return IsNumber;
}

var digitsOnly = /[1234567890]/g;
var integerOnly = /[0-9\.+_\-()]/g;

function restrictCharacters(myfield, e, restrictionType) {
	if (!e) var e = window.event
	if (e.keyCode) code = e.keyCode;
	else if (e.which) code = e.which;
	var character = String.fromCharCode(code);

	// if they pressed esc... remove focus from field...
	if (code==27) { this.blur(); return false; }
	
	// ignore if they are press other keys
	// strange because code: 39 is the down key AND ' key...
	// and DEL also equals .
	if (!e.ctrlKey && code!=9 && code!=8 && code!=36 && code!=37 && code!=38 && (code!=39 || (code==39 && character=="'")) && code!=40) {
		if (character.match(restrictionType)) {
			return true;
		} else {
			return false;
		}
		
	}
}

function checkident() {
	var path=document.formulaire;
	if (path.lg.value=="" || path.lg.value==path.lg.defaultValue) {
		path.lg.focus();
		alert('Veuillez saisir votre IDENTIFIANT');
		return false;
	} else if (path.pw.value=="" || path.pw.value==path.pw.defaultValue) {
		path.pw.focus();
		alert('Veuillez saisir votre MOT DE PASSE');
		return false;
	} else {
	return true;
}}

function checkformu() {
	var emailRegEx = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/ ;
	var path=document.formulaire;
	if (path.pers.value=="") {
		path.pers.focus();
		alert('Veuillez saisir la PERSONNE A CONTACTER');
		return false;
	}  else if (path.tel.value=="") {
		path.tel.focus();
		alert('Veuillez saisir votre TELEPHONE');
		return false;
	}   else if (path.mel.value=="") {
		path.mel.focus();
		alert('Veuillez saisir votre adresse E-MAIL');
		return false;
	} else if (path.mel.value.search(emailRegEx)==-1) {
		path.mel.focus();
		alert('Veuillez saisir une adresse e-mail VALIDE');
		return false;
	} else if (path.msg.value=="") {
		path.msg.focus();
		alert('Veuillez saisir votre MESSAGE');
		return false;
	} else if (path.security_code.value=="") {
		path.security_code.focus();
		alert('Veuiller saisir le CODE DE SECURITE');
		return false;
	} else {
	return true;
}}

function checkenews() {
	var emailRegEx = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/ ;
	var path=document.enews;
	if (path.mel.value=="" || path.mel.value==path.mel.defaultValue) {
		path.mel.focus();
		alert('Veuillez saisir votre adresse E-MAIL');
		return false;
	} else if (path.mel.value.search(emailRegEx)==-1) {
		path.mel.focus();
		alert('Veuillez saisir une adresse e-mail VALIDE');
		return false;
	} else {
	path.mel.value = path.mel.value.toLowerCase();
	return true;
}}

function actupopup(url,largeur,hauteur) {
	var haut=(screen.height-largeur)/2;
	var gauche=(screen.width-hauteur)/2;
	fencent=window.open(url,'ACTU','top='+haut+',left='+gauche+',width='+largeur+',height='+hauteur+',scrollbars=yes,resizable=no,status=yes');
	fencent.focus();	
}

function reloaded() {
	window.focus();
}

var opnArt1=false;
var opnArt2=false;
var opnArt3=false;

function show(numArt,maxArt) {
	var i=1;
	for (i=1; i<=maxArt;i++) {
		document.getElementById('art'+i).src='../img/mcv_015.gif';
		document.getElementById('lin'+i).src='../img/mcv_018.gif';
		document.getElementById('txt'+i).style.display='none';
		document.getElementById('tr'+i).style.backgroundColor='';
		var opn = window['opnArt'+i];
		if (i==numArt) {
			if (!opn) {
				document.getElementById('art'+i).src='../img/mcv_016.gif';
				document.getElementById('lin'+i).src='../img/mcv_000.gif';
				document.getElementById('txt'+i).style.display='block';
				document.getElementById('tr'+i).style.backgroundColor='#260901';
				window['opnArt'+i]=true;
			} else {
				window['opnArt'+i]=false;
			}
		} else {
				window['opnArt'+i]=false;	
		}
	}
}
