/* JavaScript Document VERSION fr */

function shMenu(id, state){
	document.getElementById(id).style.display=state;
}

function shZoom(id, state){
	document.getElementById(id).style.left=state;
}

function acDelay(state, path) {
	document.getElementById('img_04').src=path;
	if (state) {
		window.clearTimeout(myDelay);
		
	} else {
		myDelay = setTimeout("shMenu('submenu','none')",100);
	}
}
var isMR=false;
function showMR() {
	if (isMR) {
		isMR=false;
		state='none';
	} else {
		isMR=true;
		state='block';
	}
	document.getElementById('MR').style.display=state;
}

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 checkformu() {
	var emailRegEx = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/ ;
	var path=document.formulaire;
	if (path.nom.value=="") {
		path.nom.focus();
		alert('Veuillez saisir votre NOM');
		return false;
	} else if (path.prenom.value=="") {
		path.prenom.focus();
		alert('Veuillez saisir votre PRENOM');
		return false;
	} else if (path.adresse2.value!="" && path.adresse.value=="") {
		path.adresse.value=path.adresse2.value;
		path.adresse2.value="";
		alert('Vérifiez votre ADRESSE');
		return false;
	} else if (path.codepostal.value!="" && (!isNumeric(path.codepostal.value) || path.codepostal.value.length!=5)) {
		path.codepostal.focus();
		alert('Veuillez saisir un code postal VALIDE');
		return false;
	} else if (path.numtel.value=="") {
		path.numtel.focus();
		alert('Veuillez saisir votre NUMERO DE TELEPHONE');	
		return false;
	} else if (path.email.value=="") {
		path.email.focus();
		alert('Veuillez saisir votre adresse E-MAIL');
		return false;
	} else if (path.email.value.search(emailRegEx)==-1) {
		path.email.focus();
		alert('Veuillez saisir une adresse e-mail VALIDE');
		return false;
/*	} else if (path.commentaires.value=="") {
		path.commentaires.focus();
		alert('Veuillez saisir vos COMMENTAIRES');
		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 checkformu2() {
	var emailRegEx = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/ ;
	var path=document.formulaire;
	if (path.nom.value=="") {
		path.nom.focus();
		alert('Veuillez saisir votre NOM');
		return false;
	} else if (path.prenom.value=="") {
		path.prenom.focus();
		alert('Veuillez saisir votre PRENOM');
		return false;
	} else if (path.email.value=="") {
		path.email.focus();
		alert('Veuillez saisir votre adresse E-MAIL');
		return false;
	} else if (path.email.value.search(emailRegEx)==-1) {
		path.email.focus();
		alert('Veuillez saisir une adresse e-mail VALIDE');
		return false;
	} else if (path.destemail1.value=="") {
		path.destemail1.focus();
		alert('Veuillez saisir au moins UNE adresse e-mail de destinataire');
		return false;
	} else if (path.destemail1.value.search(emailRegEx)==-1) {
		path.destemail1.focus();
		alert('Veuillez saisir une adresse e-mail de destinataire VALIDE');
		return false;
	} else if ((path.destemail2.value!="" && path.destemail2.value.search(emailRegEx)==-1) || (path.destemail3.value!="" && path.destemail3.value.search(emailRegEx)==-1)) {
		alert('Veuillez saisir une adresse e-mail de destinataire VALIDE');
		return false;
/*	} else if (path.commentaires.value=="") {
		path.commentaires.focus();
		alert('Veuillez saisir vos COMMENTAIRES');
		return false;
*/	} else if (path.security_code.value=="") {
		path.security_code.focus();
		alert('Veuiller saisir le CODE DE SECURITE');
		return false;
	} else {
	return true;
}}


var movieName = "django";

function thisMovie(movieName) {
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  } else {
    return document[movieName]
  }
}
function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
    return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}
function swchecker(str) {
  if (movieIsLoaded(thisMovie(movieName))) {
    document.getElementById("django").getPicture(str);
	window.clearTimeout(myDelay2);
  } else {
  	js2sw(str);
  }
}

function js2sw(str) {
	shZoom('throbber','0px');
	//document.getElementById('django').getPicture('"+str+"')
	myDelay2 = setTimeout("swchecker('"+str+"')",1000);
}