// JavaScript Document
var couleur;

function afficheSSmenu(id, zone) {
	for (i=1; i<=3; i++) {
		
	
		// Choix de la couleur en fonction de la zone
		if (zone == 'ginger') {
			couleur = '#C3C537';
		} else if (zone == 'metier') {
			couleur = '#910B65';
		} else {
			couleur = '#C0385E';
		}
		

		document.getElementById('ssmenu'+i).style.display = 'none';
		
		// Ginger
		if (id != 1) { 
			document.getElementById('mnuGinger').style.background = 'none'; 
		} else {
			document.getElementById('mnuGinger').style.background = couleur; 
			document.getElementById('mnuGinger').style.color = '#fff'; 
		}
		// Nos metiers
		if (id != 2) { 
			document.getElementById('mnuMetier').style.background = 'none'; 
			document.getElementById('mnuMetier').style.color = '#fff'; 
		} else {
			document.getElementById('mnuMetier').style.background = couleur; 
			document.getElementById('mnuMetier').style.color = '#fff'; 
		}
		// Expertise
		if (id != 3) {
			document.getElementById('mnuExpertise').style.background = 'none'; 
			document.getElementById('mnuExpertise').style.color = '#fff'; 
		} else {
			document.getElementById('mnuExpertise').style.background = couleur; 
			document.getElementById('mnuExpertise').style.color = '#fff'; 
		}
	}
	
	// Affichage du sous menu avec la bonne couleur de fond
	document.getElementById('ssmenu'+id).style.background = couleur; 
	document.getElementById('ssmenu'+id).style.display = 'block';
}


/*
* Efface les sous menu
*/
function effaceSSmenu() {
	for (i=1; i<=3; i++) {
		document.getElementById('ssmenu'+i).style.display = 'none';
		document.getElementById('mnuGinger').style.background = 'none'; 
		document.getElementById('mnuMetier').style.background = 'none'; 
		document.getElementById('mnuExpertise').style.background = 'none'; 
	}
	
	if (lien_actif == 1) { // Ginger
		document.getElementById('ssmenu'+lien_actif).style.display = 'block';
		document.getElementById('mnuGinger').style.background = couleur; 
	}
	
	if (lien_actif == 2) { // Métier
		document.getElementById('ssmenu'+lien_actif).style.display = 'block';
		document.getElementById('mnuMetier').style.background = couleur; 
	}
	
	if (lien_actif == 3) { // Expertise
		document.getElementById('ssmenu'+lien_actif).style.display = 'block';
		document.getElementById('mnuExpertise').style.background = couleur; 
	}
	
}



var tabCV = new Array();
var tabCVen = new Array();

// Français
tabCV[1] = "Précédemment chargée d’études chez BVA puis au sein du Laboratoire Pierre Fabre.<br/>De formation marketing et gestion.";
tabCV[2] = "Précédemment chargée de communication à l’Assemblée Permanente des Chambres de Métiers puis chargée de lobbying pour Friends of the Earth, association de défense de l’environnement.<br/>De formation socio-économique et relations internationales.";
tabCV[3] = "Lina a rejoint Ginger après une première expérience chez GFK.<br />Sociologue de formation, elle prépare un 3ème cycle « Consultants et Chargés d’études socio-économiques » en parallèle de ses missions chez Ginger.";
tabCV[4] = "Thomas est présent depuis la création de Ginger : attentif et réactif, il permet à l’équipe de libérer son énergie pour nos clients.";
tabCV[5] = "Après une année en Angleterre, Louise travaille en alternance chez Ginger tout en préparant une formation en communication des entreprises.";
tabCV[6] = "Précédemment chef de publicité chez Canal+ puis consultante marketing chez INCOME. De formation marketing et vente.";
tabCV[7] = "Globe-trotteuse et polyglotte, Anne-Claire a posé ses valises chez Ginger tout en préparant le master 2 Communication-Marketing de Sciences-Po.";
tabCV[8] = "Précédemment planneur stratégique chez CLM/BBDO puis LEO BURNETT ; également chargée d'études chez Ifop.<br />De formation Sciences Po Paris.";
tabCV[11] = "Aurélie s'occupe principalement d’études qualitatives. Toutefois, comme l'organisation est l'un de ses talents, elle n'a pas sa pareille pour assurer la coordination de dispositifs mixtes quali-quanti. Auparavant, elle a travaillé pour deux instituts spécialistes des études qualitatives avant de rejoindre Ginger et détient un Master « sémiologie et stratégie ».";
tabCV[12] = "Christelle réalise des études quantitatives et qualitatives. Après avoir fourni ses premières armes de marketeuse en agence de design, Christelle pose ses valises pour 2 années chez Ginger afin de préparer un Master en alternance à l’ESC Lille.";
tabCV[13] = "Stéphanie réalise des études quantitatives et qualitatives. Elle a rejoint Ginger après avoir travaillé 3 ans au sein de l’organisation Esomar (association internationale des études de marché) à Amsterdam, où elle a développé sa passion pour l’univers des études et son intérêt pour les contextes multiculturels.";
tabCV[14] = "Salah rythme la vie administrative et comptable de Ginger. Elle apporte également son aide dans l’organisation et la logistique de certaines missions.";

// Anglais
tabCVen[1] = "Previously Research Officer at BVA and then at Pierre Fabre Laboratories. Isabelle trained in marketing and management.";
tabCVen[2] = "Previously Information Officer at the French Committee of Chambers of Craft, then Lobbying Officer for Friends of the Earth, an environmental protection association. Florence trained in socioeconomics and international relations.";
tabCVen[3] = "Lina joined Ginger after a first experience at GFK.<br />Trained in sociology, Lina is taking an MA in socio-economics in parallel to her mission at Ginger.";
tabCVen[4] = "Thomas has been with Ginger from the very beginning. He is attentive and responsive, and makes it possible for the team to focus its energy on our clients.";
tabCVen[5] = "After spending one year in England, Louise is currently working for Ginger while training in corporate communication";
tabCVen[6] = "Previously advertising manager at Canal + and then marketing consultant at INCOME. Catherine trained in marketing and sales.";
tabCVen[7] = "Well-travelled and polyglot, Anne-Claire joined Ginger’s team while preparing her Masters degree at Science-Po.";
tabCVen[8] = "Previously strategic planner at CLM/BBDO and then at LEO BURNETT. Also research officer at Ifop.<br />Marine trained at Sciences Po Paris.";
tabCVen[11] = "Aurelie mainly deals with qualitative research. However, as she has got excellent organization process skills, she deals with in coordinating mixed quali-quanti studies. Before joining Ginger, she worked for two institutes specialized in qualitative research. She has a Masters degree in “Semiotics and Strategy”.";
tabCVen[12] = "Christelle participates in both quantitative and qualitative studies. After having had her first experience in marketing in a design agency, Christelle joined Ginger for two years while preparing a Masters degree in Management at Lille High business School.";
tabCVen[13] = "Stephanie participates in conducting both quantitative and qualitative studies. She joined Ginger after having worked for 3 years with Esomar (world organisation for enabling better research into markets, consumers and societies) in Amsterdam, where she developed her interest for multicultural contexts and her passion for market research.";
tabCVen[14] = "Salah handles administrative and accounting tasks. She also assists in the organization and logistics of various missions.";

function afficheCV(id, lang) {
	
	
	if (lang == 'en') { // On prend le tableau de contenu anglais
		tabCV = tabCVen;
	} 
	/*if (id == 1)  {*/
		//document.getElementById('cv1').style.visibility =  'hidden';
		document.getElementById('cv').innerHTML = tabCV[id];
		document.getElementById('cv').style.visibility =  'visible';
	//}
	
	/*for (i=1; i<=5; i++) {
		document.getElementById(i).style.border = '1px solid #fff';
	}*/
	document.getElementById(id);
	document.getElementById(id).style.borderWidth = '1px solid #910B65';

	return true;
}

function effaceCV(id, lang) {
	document.getElementById('cv1').visibility = 'hidden';
	return true;
}


function afficheListe(lst) {
	document.getElementById(lst).style.visibility = 'visible';
	document.getElementById(lst).parentNode.style.border = '1px solid #910B65';	
}

function effaceListe(lst) {
	document.getElementById(lst).style.visibility = 'hidden';
	document.getElementById(lst).parentNode.style.border = '1px solid #fff !important';	
}


/*
*	Replace une sschaine A par une sschaine B
*/
function Remplace(expr,a,b) {
      var i=0
      while (i!=-1) {
         i=expr.indexOf(a,i);
         if (i>=0) {
            expr=expr.substring(0,i)+b+expr.substring(i+a.length);
            i+=b.length;
         }
      }
   return expr
}


/* Férifie le formulaire E/Se*/
function checkForm(formulaire, lang)
{
	
	if (lang == "en") {
		mess_etoile = 'The fields marked with an * are mandatory';
		mess_mail = 'Your e-mail address is invalid';
	} else {
		mess_etoile = 'Les champs marqués d\'une étoile sont obligatoires';
		mess_mail = 'Vous avez saisi une adresse email invalide'
	}
	
	//alert(formulaire.fonction.selectedIndex);
	//return false;
	
	if ( formulaire.secteur.selectedIndex==10 && formulaire.autre_secteur.value=='')  {
		alert(mess_etoile);
		return false;
	}
	
	if (formulaire.fonction.selectedIndex==6 && formulaire.autre.value=='') {
		alert(mess_etoile);
		return false;	
	}
	
	adresse = formulaire.email.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
	{
		return(true);
	}
	else
	{
		alert(mess_mail);
		return(false);
	}
	
	
}

function checkFormCandidat(formulaire, lang)
{
	
	if (lang == "en") {
		mess_etoile = 'The fields marked with an * are mandatory';
		mess_mail = 'Your e-mail address is invalid';
	} else {
		mess_etoile = 'Les champs marqués d\'une étoile sont obligatoires';
		mess_mail = 'Vous avez saisi une adresse email invalide'
	}

	if ( formulaire.poste.selectedIndex==7 && formulaire.autre.value=='')  {
		alert('Les champs marqués d\'une étoile sont obligatoires');
		return false;
	}
	

	
	adresse = formulaire.email.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
	{
		return true;
	}
	else
	{
		alert(mess_mail);
		return false;
	}
	
	
}




function afficheChamp(liste, champ) {
	
	champs = document.getElementById('champs');
	
	if (liste.name == 'Fonction') { // Liste des fonctions
		index = 6;
		var contenu = 'autre';
		
		
	} else if(liste.name=="Secteur") { // liste des secteurs
		index = 10;
		var contenu = 'autre2';
		
	} else if (liste.name=="Poste") {
		
		index = 7;	// liste des postes recherchés
		var contenu = 'autre';
	}
	
	obj = document.getElementById(champ);
	
	var conteneur = document.getElementById(contenu);
	
	if (liste.selectedIndex == index) {
		
		
		conteneur.style.visibility = 'visible';
		obj.value='';
		
	} else {
	
		conteneur.style.visibility = 'hidden';
		obj.value='';
	}
}

