// JavaScript Document

var loaded=false;
var images=new Array();
var legend=new Array();
var vitesse=2000;
var choix=0;
var attente = false;
var maxMini = 8;
var prems=1;
function rotation(){
	for (i=0;i<rotation.arguments.length;i++){
		images[i]=new Image();
		images[i].src=rotation.arguments[i];
	}
	maxMini = rotation.arguments.length;
	for (i=rotation.arguments.length+1;i<=maxMini;i++){
		var img = eval("document.getElementById('miniImage'+i)");
		img.style.display = "none";
	}
}

function rotationLegend(){
	for (i=0;i<rotationLegend.arguments.length;i++){
		legend[i]=rotationLegend.arguments[i];
	}
}

function tourne(choixutilisateur){
	if (choixutilisateur!=null){
		choix = choixutilisateur;	
		attente = true;
	}
	if (choixutilisateur==null && attente)
	{
		attente = false;
		setTimeout("tourne()",vitesse*5);
		return;
	}
	if (document.images)
	{
		document.images['foto'].src=images[choix].src;
		
		
		var choixMini = choix;
		var before;
		/*if (choixMini == 0){
			before = maxMini;
		}
		else{
			before = choixMini;
		}
		var after;
		if (choixMini == maxMini){
			after = 1;
		}
		else{
			after = choixMini+1;
		}*/
		
		for(var i=1;i<=maxMini;i++)
		{
			var borderBefore = eval("document.getElementById('miniImage"+i+"')");
			borderBefore.style.border = "1px solid #FFF";			
		}
		
		var borderAfter = eval("document.getElementById('miniImage"+(choix+1)+"')");
		borderAfter.style.border = "1px solid #999";

	}
	if (document.getElementById('modif_txt_deroulant') )
		document.getElementById('modif_txt_deroulant').innerHTML = legend[choix];
		
	if (choix<images.length-1)
		choix++
	else choix=0
	
	
	if (choixutilisateur==null)
	{
		setTimeout("tourne()",vitesse);
	}

}





function etat_active(){
	//63 id etats-unis
	if (document.getElementById("pays").value==63){
		document.getElementById("etat").disabled=false;
	}else{
		document.getElementById("etat").disabled=true;
	}
	
}

function is_valid_email (email) {
  return /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(email); 
 }
 
function valide_contact(lang){
	var err="";
	if (lang==2){
		
		
		if(document.form_contact.nom.value==""){
			err+="\n - name";		
		}
		
		if(document.form_contact.prenom.value==""){
			err+="\n - first name";
		}
		if(document.form_contact.ville.value==""){
			err+="\n - city";
		}
		if(document.form_contact.cp.value==""){
			err+="\n - zip code";
		}
		if(document.form_contact.pays.value==0){
			err+="\n - country";
		}
		if(document.form_contact.pays.value==63){
			if(document.form_contact.etat.value==0){
				err+="\n - state";
			}
		}
		if(document.form_contact.mail.value==0){
			err+="\n - email";
		}else{
			if(!is_valid_email (document.form_contact.mail.value)){
				err+="\n - the email is not correct";
			}
		}
		
		if(document.form_contact.tel.value==0){
			err+="\n - phone";
		}
		if(document.form_contact.commentaire.value==0){
			err+="\n - Fields below must be informed";
		}	
		
		if (err==""){
			document.form_contact.submit();
		}else{
			alert("Fields below must be informed : "+err);
		}
	
		
		
		
	}else{
		if(document.form_contact.nom.value==""){
			err+="\n - le nom";		
		}
		
		if(document.form_contact.prenom.value==""){
			err+="\n - le pr\351nom";
		}
		if(document.form_contact.ville.value==""){
			err+="\n - la ville";
		}
		if(document.form_contact.cp.value==""){
			err+="\n - le code postal";
		}
		if(document.form_contact.pays.value==0){
			err+="\n - le pays";
		}
		if(document.form_contact.pays.value==63){
			if(document.form_contact.etat.value==0){
				err+="\n - l'\352tat";
			}
		}
		if(document.form_contact.mail.value==0){
			err+="\n - l'email";
		}else{
			if(!is_valid_email (document.form_contact.mail.value)){
				err+="\n - l'email n'est pas correct";
			}
		}
		
		if(document.form_contact.tel.value==0){
			err+="\n - le t\351l\351phone";
		}
		if(document.form_contact.commentaire.value==0){
			err+="\n - le commentaire";
		}	
		
		if (err==""){
			document.form_contact.submit();
		}else{
			alert("Les champs ci-dessous doivent \353tre renseignés : "+err);
		}
	}
}



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function candidature(page)
{
	MM_openBrWindow(page,'candidature','scrollbars=yes,resizable=no,width=413,height=700');
}

function valide_candidature(lang){
	var err="";
	if (lang==2){
		
		if(document.form_contact.nom.value==""){
			err+="\n - name";		
		}
		
		if(document.form_contact.prenom.value==""){
			err+="\n -  first name";
		}
		if(document.form_contact.ville.value==""){
			err+="\n - city";
		}
		if(document.form_contact.cp.value==""){
			err+="\n - zip code";
		}
		if(document.form_contact.pays.value==""){
			err+="\n - country";
		}
		if(document.form_contact.tel.value==0){
			err+="\n - phone";
		}
		if(document.form_contact.mail.value==""){
			err+="\n - email";
		}else{
			if(!is_valid_email (document.form_contact.mail.value)){
				err+="\n - email is not correct";
			}
		}	
		//on doit avoir au moins 2 fichiers 
		var nbfichier=0;
		if(document.form_contact.fichier1.value!=""){	
			nbfichier++;
		}
		if(document.form_contact.fichier2.value!=""){	
			nbfichier++;
		}
		
		if(document.form_contact.fichier3.value!=""){	
			nbfichier++;
		}
		if(nbfichier<2){	
			err+="\n -  attached documents (2 minimum)";
		}
		
		
		if(document.form_contact.commentaire.value==0){
			err+="\n - comment";
		}	
		
		if (err==""){
			document.form_contact.submit();
		}else{
			alert("Fields below must be informed : "+err);
		}
			
		
	}else{
		if(document.form_contact.nom.value==""){
			err+="\n - le nom";		
		}
		
		if(document.form_contact.prenom.value==""){
			err+="\n - le pr\351nom";
		}
		if(document.form_contact.ville.value==""){
			err+="\n - la ville";
		}
		if(document.form_contact.cp.value==""){
			err+="\n - le code postal";
		}
		if(document.form_contact.pays.value==""){
			err+="\n - le pays";
		}
		if(document.form_contact.tel.value==0){
			err+="\n - le t\351l\351phone";
		}
		if(document.form_contact.mail.value==""){
			err+="\n - l'email";
		}else{
			if(!is_valid_email (document.form_contact.mail.value)){
				err+="\n - l'email n'est pas correct";
			}
		}	
		//on doit avoir au moins 2 fichiers 
		var nbfichier=0;
		if(document.form_contact.fichier1.value!=""){	
			nbfichier++;
		}
		if(document.form_contact.fichier2.value!=""){	
			nbfichier++;
		}
		
		if(document.form_contact.fichier3.value!=""){	
			nbfichier++;
		}
		if(nbfichier<2){	
			err+="\n - les pi\352ces jointes (2 minimum)";
		}
		
		
		if(document.form_contact.commentaire.value==0){
			err+="\n - le commentaire";
		}	
		
		if (err==""){
			document.form_contact.submit();
		}else{
			alert("Les champs ci-dessous doivent \353tre renseignés : "+err);
		}
	}
}




function msgsorti(lang){
	if (lang==2){
		alert('By clicking this hypertext link, you go to leave the quantel-medical.com site to return you on an outside site independent from the site Quantel Medical.');
	}else{
		alert('En cliquant sur ce lien hypertexte, vous vous appr\352tez \340 quitter le site quantel-medical.com pour vous rendre sur un site ext\351rieur indépendant du site Quantel Medical. ');
	}
}


function usa_form(){
	err="";
	if(document.form_usa.nom.value==""){
		err+="\n - name";		
	}		
	if(document.form_usa.prenom.value==""){
		err+="\n -  first name";
	}
	if(document.form_usa.ville.value==""){
		err+="\n - city";
	}
	if(document.form_usa.cp.value==""){
		err+="\n - zip code";
	}		
	if(document.form_usa.tel.value==""){
		err+="\n - phone";
	}
	if(document.form_usa.email.value==""){
		err+="\n - email";
	}else{
		if(!is_valid_email (document.form_usa.email.value)){
			err+="\n - email is not correct";
		}
	}	
			
	if(document.form_usa.commentaire.value==0){
		err+="\n - comment";
	}	
	if(document.form_usa.cd.value==0){
		err+="\n - anti spam code";
	}	
	if (err==""){
		document.form_usa.submit();
	}else{
		alert("Fields below must be informed : "+err);
	}		
	
}


function preloadLoginImages() 
{
	loginLoaderImage = new Image(); 
	loginLoaderImage.src = "images/loading_login.gif";
}

function valide_contactextranet (){
	var err="";
	
	
		if(document.form_contact.company.value==""){
			err+="\n - company";		
		}	
		if(document.form_contact.nom.value==""){
			err+="\n - name";		
		}		
		if(document.form_contact.prenom.value==""){
			err+="\n - first name";
		}				
		if(document.form_contact.pays.value==0){
			err+="\n - country";
		}
		if(document.form_contact.pays.value==63){
			if(document.form_contact.etat.value==0){
				err+="\n - state";
			}
		}
		if(document.form_contact.mail.value==0){
			err+="\n - email";
		}else{
			if(!is_valid_email (document.form_contact.mail.value)){
				err+="\n - the email is not correct";
			}
		}
		
		if(document.form_contact.tel.value==0){
			err+="\n - phone";
		}
		if(document.form_contact.commentaire.value==0){
			err+="\n - Fields below must be informed";
		}	
		
		if (err==""){
			document.form_contact.submit();
		}else{
			alert("Fields below must be informed : "+err);
		}
	
}
