function ajouterEvent(date_event, timestamp, text) {
	var nb_event = document.forms[0].nb_event.value;
	var mon_div = document.getElementById('div_events');
	var div_event = document.getElementById(timestamp);
	if (div_event == null) {
		mon_div.innerHTML += "<div id=\"" + timestamp + "\" style=\"display:block;\">&bull; " + date_event + "&nbsp;<input type=\"hidden\" name=\"event_" + nb_event + "\" value=\"" + date_event + "\" /><a href=\"#\" onclick=\"supprimerEvent('" + timestamp + "')\"><img id=\"poubelle_" + nb_event + "\" src=\"images/actualites/poubelle.gif\" width=\"22\" height=\"25\" alt=\"X\" border=\"0\" /></a><br />" + text.replace(/\\\'/, "g") + "<br /></div>";
		document.forms[0].nb_event.value = parseInt(nb_event) + 1;
	}
//	else {
//		div_event.innerHTML += "&bull; " + date_event + "&nbsp;<input type=\"hidden\" name=\"event_" + nb_event + "\" value=\"" + date_event + "\" /><a href=\"#\" onclick=\"supprimerEvent('" + timestamp + "')\"><img src=\"images/actualites/poubelle.gif\ id=\"poubelle_" + nb_event + "\" width=\"22\" height=\"25\" alt=\"X\" border=\"0\" /></a><br /><br />";
//	}
	document.forms[0].nb_event.value = parseInt(nb_event) + 1;
}

function supprimerEvent(timestamp) {
	var mon_div = document.getElementById(timestamp);
	mon_div.innerHTML = "";
	mon_div.id = mon_div.id + "_";
	var nb_event = document.forms[0].nb_event.value;
	document.forms[0].nb_event.value = parseInt(nb_event) - 1;
}

function valideFormActualite() {
	var text = "";
	var ok = 1;
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nom.\n";
	}
	if (document.forms[0].prenom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre prénom.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre email.\n";
	}
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

function toggle(_s,_h) {
	if (document.all) {
		eval("document.all."+_s+".style.visibility='visible';");
		eval("document.all."+_h+".style.visibility='hidden';"); 
	} else {
		if (navigator.userAgent.indexOf("Gecko")!=-1) {
			// is NS6 ?
			document.getElementById(_s).style.visibility='visible';
			document.getElementById(_h).style.visibility='hidden';
		} else {
			eval("document.layers['"+_s+"'].visibility='show';");
			eval("document.layers['"+_h+"'].visibility='hide';");
		}
	}
}

function validerFormFormulaire() {
	var text = "";
	var ok = 1;
	if (document.forms[0].designation.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre désignation.\n";
	}
	if (document.forms[0].departement.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre département.\n";
	}
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nom.\n";
	}
	if (document.forms[0].telephone.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre telephone.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre email.\n";
	}
/*	if (document.forms[0].pole.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre pôle.\n";
	}
	if (document.forms[0].intitule.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre intitule.\n";
	}
	if (document.forms[0].date.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre date.\n";
	}
	if (document.forms[0].type.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre type.\n";
	}
*/	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

function validerFormDemande() {
	var text = "";
	var ok = 1;
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nom.\n";
	}	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

//function validerFormDossierLigne() {
//	var text = "";
//	var ok = 1;
//	if (document.forms[0].nom.value == "") {
//		ok = 0;
//		text += "Vous n'avez pas mis votre nom.\n";
//	}	
//	
//	if (ok == 0) {
//		alert(text);
//	}
//	else {
//		document.forms[0].submit();
//	}
//}

function validerFormFormulaireJob() {
	var text = "";
	var ok = 1;
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nom.\n";
	}
	if (document.forms[0].prenom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre prénom.\n";
	}
	if (document.forms[0].date.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre date de naissance.\n";
	}
	/*if (document.forms[0].adresse.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre adresse.\n";
	}
	if (document.forms[0].code_postal.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre code postal.\n";
	}
	if (document.forms[0].ville.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre ville.\n";
	}
	*/if (document.forms[0].tel1.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre téléphone.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre email.\n";
	}
	if (document.forms[0].domaine.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre domaine de compétence.\n";
	}
//		if (document.forms[0].niveau.value == "") {
//		ok = 0;
//		text += "Vous n'avez pas mis votre niveau ou diplôme obtenus.\n";
//	}
//		if (document.forms[0].experience.value == "") {
//		ok = 0;
//		text += "Vous n'avez pas mis votre experience professionnelle.\n";
//	}
	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

function validerFormFormulaire_information_candidat() {
	var text = "";
	var ok = 1;
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nom.\n";
	}
	if (document.forms[0].prenom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre prénom.\n";
	}
	if (document.forms[0].telephone.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre téléphone.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre e-mail.\n";
	}
	if (document.forms[0].sujet.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis de sujet.\n";
	}
	
	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

function validerFormFormulaire_information_entre() {
	var text = "";
	var ok = 1;
	if (document.forms[0].designation.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la désignation de l'entreprise.\n";
	}
	if (document.forms[0].departement.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le département de l'entreprise.\n";
	}
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le nom de l'interlocuteur.\n";
	}
	if (document.forms[0].telephone.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le téléphone de l'interlocuteur.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis l'email de l'interlocuteur.\n";
	}
	if (document.forms[0].sujet.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le sujet de demande de contact.\n";
	}
	
	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

function validerFormFormulaire_entreprise() {
	var text = "";
	var ok = 1;
	if (document.forms[0].designation.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre désignation.\n";
	}
	if (document.forms[0].departement.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre département.\n";
	}
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nom.\n";
	}
	if (document.forms[0].telephone.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre telephone.\n";
	}
	if (document.forms[0].pole.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre pôle.\n";
	}
	if (document.forms[0].intitule.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre intitule.\n";
	}
	if (document.forms[0].date.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre date.\n";
	}
	if (document.forms[0].type.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre type.\n";
	}
	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

function validerFormDossierLigne() {
	var text = "";
	var ok = 1;
	if (document.forms[0].raison_sociale_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la raison sociale.\n";
	}
	if (document.forms[0].adresse_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis l'adresse.\n";
	}
	if (document.forms[0].code_postal_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le code postal.\n";
	}
	if (document.forms[0].telephone_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le télèphone de l'entreprise.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre email.\n";
	}
	if (document.forms[0].ville_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la ville.\n";
	}
	if (document.forms[0].fax_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le fax.\n";
	}
	if (document.forms[0].effectif_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis l'effectif salarial.\n";
	}
	if (document.forms[0].activite_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis l'activité principale.\n";
	}
	if (document.forms[0].convention_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la convention collective appliquée.\n";
	}
	if (document.forms[0].siret.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le n° siret.\n";
	}
	if (document.forms[0].code_naf_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le code naf.\n";
	}
	if (document.forms[0].forme_juridique_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la forme juridique.\n";
	}
	if (document.forms[0].caisse_retraite_entre.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la caisse de retraite complémentaire.\n";
	}
	if (document.forms[0].nom_dirigeant.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le nom du dirigeant.\n";
	}
	
	if (document.forms[0].date_contrat.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la date de démarrage contrat.\n";
	}
//	if (document.forms[0].date_formation.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis la date démarrage de la formation.\n";
//	}
//	if (document.forms[0].nom_salarie.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis le nom du salarié.\n";
//	}
	if (document.forms[0].emploi_occupe.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis l'emploi précis occupé.\n";
	}
//	if (document.forms[0].salaire_mensuel.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis le salaire mensuel d'embauche.\n";
//	}
//	if (document.forms[0].coefficient.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis le coefficient de départ.\n";
//	}
//	if (document.forms[0].adresse_activite.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis l'adresse exacte du lieu d'activité.\n";
//	}
	if (document.forms[0].nom_tuteur.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le nom du tuteur.\n";
	}
	if (document.forms[0].prenom_tuteur.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le prénom du tuteur.\n";
	}
	if (document.forms[0].fonction_tuteur.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la fonction du tuteur.\n";
	}
	if (document.forms[0].diplome_niveau.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le diplôme ou niveau d'études.\n";
	}
	if (document.forms[0].anciennete.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis l'ancienneté.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
	    text += "Vous n'avez pas mis une adresse mail valide.\n";
	}
	if (document.forms[0].telephone.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le téléphone.\n";
	}
//	if (document.forms[0].nombre_salaries.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis le nombre de salariés en contrat de professionnalisation.\n";
//	}
	if (document.forms[0].telephone_tuteur.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis le téléphone du tuteur.\n";
	}
//	if (document.forms[0].fax.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis le fax.\n";
//	}
//	if (document.forms[0].nom_prenom_signataire.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis le nom et prénom du signataire.\n";
//	}
	
	if (document.forms[0].opca.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis l'OPCA.\n";
	}
//	if (document.forms[0].adresse_opca.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis l'adresse de l'OPCA.\n";
//	}
//	if (document.forms[0].code_opca.value == "") {
//		ok = 0;
//		//text += "Vous n'avez pas mis le code postal de l'OPCA.\n";
//	}
	if (document.forms[0].ville_opca.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis la ville de l'OPCA.\n";
	}
	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

function validerFormDossierCandidature() {
	var text = "";
	var ok = 1;
	if (document.forms[0].nom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nom.\n";
	}
	if (document.forms[0].prenom.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre prenom.\n";
	}
	if (document.forms[0].adresse.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre adresse.\n";
	}
	if (document.forms[0].code_postal.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre code-postal.\n";
	}
	if (document.forms[0].ville.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre ville.\n";
	}
	if (document.forms[0].tel1.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre tel1.\n";
	}
	if (document.forms[0].tel2.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre tel2.\n";
	}
	if (document.forms[0].email.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre email.\n";
	}
	if (document.forms[0].date_naissance.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre date de naissance.\n";
	}
	if (document.forms[0].lieu_naissance.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre lieu de naissance.\n";
	}
	if (document.forms[0].departement.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre département.\n";
	}
	if (document.forms[0].nationalite.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis votre nationalite.\n";
	}
	
	if (document.forms[0].disponibilite.value == "") {
		ok = 0;
		text += "Vous n'avez pas mis vos dates de disponibilité.\n";
	}
	
	
	
	if (ok == 0) {
		alert(text);
	}
	else {
		document.forms[0].submit();
	}
}

var xmlhttps= new Array();
function loadXMLdoc(url, id, attente) {
 var i= xmlhttps.length;
 if(attente != null) {
  //document.getElementById(id).innerHTML= attente;
 }
 if(window.XMLHttpRequest) {/*Mozilla*/
  xmlhttps[i]= new XMLHttpRequest();
  xmlhttps[i].onreadystatechange= function() { xmlhttpChange(i, url, id); };
  xmlhttps[i].open("GET", url, true);
  xmlhttps[i].send(null);
 }
 else if(window.ActiveXObject) {/*IE*/
  xmlhttps[i]= new ActiveXObject("Microsoft.XMLHTTP");
  if(xmlhttps[i]) {
   xmlhttps[i].onreadystatechange= function() { xmlhttpChange(i, url, id); };
   xmlhttps[i].open("GET", url, true);
   xmlhttps[i].send();
  }
 }
}

function xmlhttpChange(i, url, id) {
 if(xmlhttps[i].readyState==4) {/*complete*/
  if(xmlhttps[i].status < 400) {
   document.getElementById(id).innerHTML= xmlhttps[i].responseText;
  }
  else {
   document.getElementById(id).innerHTML= "[<span title=\""+url+"\">Erreur "+xmlhttps[i].status+"</span>]";
  }
 }
}

function calendar(mois, annee, type) {
	loadXMLdoc("calendar.php?mois="+mois+"&an="+annee+"&type="+type, "calendrier", "Calendrier en cours de génération");
}