// JavaScript FONCTIONS POUR LES CAPRICES PARISIENS

//FONTION POP-UP
function open_popup(page) {
       window.open(page,"","menubar=no, status=no, scrollbars=yes, menubar=no, width=900, height=500");
   }

function preloader() 
{
     var i = 0;
     imageObj = new Image();
     images = new Array();
     
     images[0]="images/index_rock.png";
     images[1]="images/index_country.png";
     images[2]="images/index_revue.png";
     images[3]="images/index_musiciens.png";
     images[4]="images/index_disco.png";
     images[5]="images/index_cancan.png";
     images[6]="images/index_charleston.png";
     images[7]="images/index_baroque.png";
     
     for(i=0; i<8; i++)      
        {
        imageObj.src=images[i];
        }

} 

function stripAccent($chaine) { 
    return( strtr( $chaine, 
"ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ", 
"AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn" ) ); 
}

function show_border(choix){

var map = window.document.getElementById("index");

if (!map) {
			alert("Objet introuvable : ");    
		}
else 
  {
    if (choix == "1")
      { map.style.backgroundImage = "url(images/index_rock.png)"; }
    if (choix == "2")
      { map.style.backgroundImage = "url(images/index_country.png)"; }
    if (choix == "3")
      { map.style.backgroundImage = "url(images/index_revue.png)"; }
    if (choix == "4")
      { map.style.backgroundImage = "url(images/index_musiciens.png)"; }
    if (choix == "5")
      { map.style.backgroundImage = "url(images/index_disco.png)"; }
    if (choix == "6")
      { map.style.backgroundImage = "url(images/index_cancan.png)"; }
    if (choix == "7")
      { map.style.backgroundImage = "url(images/index_charleston.png)"; }
    if (choix == "8")
      { map.style.backgroundImage = "url(images/index_baroque.png)"; }    
  }

}

function hide_border(){

var map = window.document.getElementById("index");

if (!map) {
			alert("Objet introuvable : ");    
		}
else 
  {map.style.backgroundImage = "url(images/index.png)";}
}

//test formulaire demande de contact
function f_testFormuContact(){
	var valid = false;

	var nom = document.FormuContact.nom.value;
  var email = document.FormuContact.email.value;
  var tel = document.FormuContact.tel.value;
  var infos = document.FormuContact.infos.value;
  
		
		if( nom == "" ){ 
			alert("Vous n'avez pas rempli le champ \"Nom\" obligatoire.");
			valid = false;
		}else if( infos == "" ){ 
			alert("Vous n'avez pas rempli le champ \"Demande d'informations\" obligatoire.");
			valid = false;			
		}else if( tel.length != 10 ){ 
			alert("Le numero de telephone est incorrect.");
			valid = false;			
		}else if( email == "" ){ 
			alert("Vous n'avez pas rempli le champ \"Email\" obligatoire.");
			valid = false;
		} 
		  else if (email.length > 0){

	            var valide1 = false;
	
	            for(var j=1;j<(email.length);j++){
		              if(email.charAt(j)=='@'){
			                 if(j<(email.length-4)){
				                    for(var k=j;k<(email.length-2);k++){
					                       if(email.charAt(k)=='.') {valide1=true;}					     
				                    }
			                  }
		              }
	           }
	if(valide1==false) {alert("L'adresse email saisie n'est pas valide.");}
	//return valide1;
	     else { valid = true; }
		
		  }  
		
if(valid) document.FormuContact.submit();

}


