//Verifie si numerique positif
function checknumber(champ,nom_form)
{
	//alert(document.forms[nom_form].elements[8].value)
	var x=document.forms[''+nom_form+''].elements[0].value;
	
	
	var anum=/(^\d+$)|(^\d+.\d+$)/
	if (anum.test(x)){
		testresult=true;
	}else{
		alert("Entrez un nombre valide \n---\nEnter a valid number")
		testresult=false;
	}
	return (testresult);
}
function Verif_num_pos(champ,nom_form)
{
	if (document.layers||document.all||document.getElementById){
		return checknumber(champ,nom_form)
	}else{
		return true;
	}
}

function verifFormOffre()
{
	var ecart=document.form_offre.ecart;
	
	if(ecart==null){
		return true;
	}else{
		if(Verif_num_pos('ecart','form_offre')==false){
			return false;
		}else{
			return true;
		}
	}
	
}

function trim(a){
	var tmp=new Array();
	for(j=0;j<a.length;j++)
		if(a[j]!='')
			tmp[tmp.length]=a[j];
	a.length=tmp.length;
	for(j=0;j<tmp.length;j++)
		a[j]=tmp[j];
	return a;
}

function affiche_offre(id_offre)
{
	//window.open('modules/offre/afficheDetailOffre.php?langue='+langue+'&idOffre='+id,'popup'+id,'height=400,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
	//window.location.href="index.php?"+url_offre+"module=offre&action=detail_offre&langue="+langue+"&idOffre="+id;
	window.document.frm_detail.idOffre.value=id_offre;
	window.document.frm_detail.submit();
}

function statistique_offre(id_offre)
{
	window.document.frm_statistique.idOffre.value=id_offre;
	window.document.frm_statistique.submit();
}

function candidature_offre(id_offre)
{
	window.document.frm_candidature.idOffre.value=id_offre;
	window.document.frm_candidature.submit();
}

function candidature_all_offre(id_candidat,langue)
{
window.open('modules/offre/affiche_liste_all_offre.php?langue='+langue+'&id_candidat='+id_candidat,'popup'+id_candidat,'height=600,toolbar=no,location=no,directories=no,status=no,width=800,resizable=yes,scrollbars=yes');
}

function affiche_about(langue)
{
window.open('modules/public/apropos.php?langue='+langue,'popup','height=400,toolbar=no,location=no,directories=no,status=no,width=600,resizable=yes,scrollbars=no');
}

function transfert_candidat(langue,id_candidat)
{
window.open('modules/entreprise/transfert_candidat.php?langue='+langue+'&id_candidat='+id_candidat,'popup'+id_candidat,'height=400,toolbar=no,location=no,directories=no,status=no,width=500,resizable=yes,scrollbars=yes');
}

function declinaison(id_list,langue)
{
	window.open('modules/entreprise/affiche_declinaison.php?langue='+langue+'&id_list='+id_list,'popup'+id_list,'height=500,toolbar=no,location=no,directories=no,status=no,width=600,resizable=yes,scrollbars=yes');
}

function liste_valeur(id_liste,langue)
{
	window.open('modules/admin/affiche_liste_valeur.php?langue='+langue+'&id_liste='+id_liste,'popup'+id_liste,'height=500,toolbar=no,location=no,directories=no,status=no,width=600,resizable=yes,scrollbars=yes');
}

function enreg_short_list(nom_list)
{
	if(nom_list!=""){
	window.opener.document.form_consultcv.action="modules/entreprise/enreg_short_list2.php";
	window.opener.document.form_consultcv.nom_list.value=nom_list;
	window.opener.document.form_consultcv.submit();
	
	window.close();
	}else{
		alert("Donnez un nom a votre short list!");
	}
}

function nom_short_list(langue)
{
	window.open('modules/entreprise/nom_short_list.php?langue='+langue,'popup','height=150,toolbar=no,location=no,directories=no,status=yes,width=450,resizable=no,scrollbars=no')
}

function active_offre(id_offre)
{
	window.document.frm_active.idOffre.value=id_offre;
	window.document.frm_active.submit();
}
function active_cv(id_candidat)
{
	window.document.frm_actif_cand.id_candidat.value=id_candidat;
	window.document.frm_actif_cand.submit();
}

function voir_piece_jointe(nom_cv)
{
	window.open('cv/'+nom_cv,'popup','height=600,toolbar=yes,location=no,directories=no,status=yes,width=800,resizable=yes,scrollbars=yes');
	//window.location.href="cv/"+nom_cv;
}

function retour_media_offre(idOffre){
	window.location.href="../../modules/offre/affiche_media_offre.php?idOffre="+idOffre;
}

function filtre_liste(parent_id_ref,id_liste,langue){
	window.location.href="index.php?module=admin&action=liste_valeur&parent_id_ref="+parent_id_ref+'&id_liste='+id_liste+'&langue='+langue;
}


function diffusion_offre(id_media_offre,id_media,idOffre,email_media_offre){
	window.location.href="../../modules/offre/diffusion_offre.php?idOffre="+idOffre+"&id_media_offre="+id_media_offre+"&id_media="+id_media+"&email_media_offre="+email_media_offre;
}

function ouvrir_pj(id_pj){
	window.location.href="../cv/"+id_pj;
}


function voir_pj(nom_cv)
{
	window.open(nom_cv,'popup','height=600,toolbar=yes,location=no,directories=no,status=yes,width=800,resizable=yes,scrollbars=yes')
	//window.location.href="cv/"+nom_cv;
}

function voir_piece_jointe2(nom_cv)
{
	window.open('../cv/'+nom_cv,'popup','height=600,toolbar=yes,location=no,directories=no,status=yes,width=800,resizable=yes,scrollbars=yes')
	//window.location.href="cv/"+nom_cv;
}

function imprime_offre(id_offre,langue)
{
	window.open('modules/offre/afficheDetailOffre.php?langue='+langue+'&idOffre='+id_offre,'popup'+id_offre,'height=500,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}

function postuler_offre(id_offre,langue)
{
	window.open('modules/offre/postuler_offre.php?langue='+langue+'&idOffre='+id_offre,'popup'+id_offre,'height=400,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
}

function postuler_all_offre(mode_envoi,langue)
{
	window.open('modules/candidat/postuler_all_offre.php?langue='+langue+'&mode_envoi='+mode_envoi,'popup1','height=400,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}

function selectionner_offre(id,langue,action_cadd)
{
	window.open('modules/candidat/enreg_selection_offre.php?langue='+langue+'&action='+action_cadd+'&idOffre='+id,'popup'+id,'height=150,toolbar=no,location=no,directories=no,status=yes,width=400,resizable=no,scrollbars=no')
}

function selectionner_cv(id,langue,action_cadd)
{
	window.open('modules/entreprise/enreg_selection_cv.php?langue='+langue+'&action='+action_cadd+'&id_cv='+id,'popup'+id,'height=200,toolbar=no,location=no,directories=no,status=yes,width=400,resizable=no,scrollbars=no')
}

function classer_cv(id,langue,id_list,id_declinaison,page)
{
	window.open('modules/entreprise/enreg_classer_cv.php?langue='+langue+'&id_cv='+id+'&id_list='+id_list+'&id_declinaison='+id_declinaison+'&page_retour='+page,'popup'+id,'height=350,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=yes,scrollbars=no')
}

function modifier_statut(id,langue,page)
{
	window.open('modules/entreprise/modifier_statut.php?langue='+langue+'&id_cv='+id+'&page_retour='+page,'popup'+id,'height=350,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=yes,scrollbars=no')
}

function modifier_dispo(id,langue,page)
{
	window.open('modules/entreprise/modifier_dispo.php?langue='+langue+'&id_cv='+id+'&page_retour='+page,'popup'+id,'height=350,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=yes,scrollbars=no')
}

function note_cv(langue,id,id_candidat)
{
	window.open('modules/entreprise/modif_note_cv.php?id_candidat='+id_candidat+'&langue='+langue+'&id_selection='+id+'&idOffre='+id+'','popup'+id,'height=600,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
}

function note_cv_client(langue,id,id_candidat)
{
	window.open('modules/client/modif_note_cv.php?id_candidat='+id_candidat+'&langue='+langue+'&id_selection='+id+'&idOffre='+id+'','popup'+id,'height=600,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
}

function affiche_media_offre(langue,id,id_contact)
{
	window.open('modules/offre/affiche_media_offre.php?id_contact='+id_contact+'&langue='+langue+'&idOffre='+id+'','popup'+id,'height=300,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
}

function affiche_template_mail(langue,id_mail)
{
	if(id_mail!=""){
		window.open('modules/entreprise/affiche_template_mail.php?id_mail='+id_mail+'&langue='+langue,'popup'+id_mail,'height=300,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
	}else{
		alert("Choisissez un template")
	}
}

function affiche_stat_offre(langue,id)
{
	window.open('modules/offre/affiche_stat_offre.php?langue='+langue+'&idOffre='+id+'','popup'+id,'height=600,toolbar=no,location=no,directories=no,status=yes,width=700,resizable=yes,scrollbars=yes')
}

function selectionner_cv_admin(id,langue,action_cadd)
{
	window.open('modules/admin/enreg_selection_cv.php?langue='+langue+'&action='+action_cadd+'&id_cv='+id,'popup'+id,'height=150,toolbar=no,location=no,directories=no,status=yes,width=400,resizable=no,scrollbars=no')
}

function supprimer_selection(id,langue,action_cadd)
{
	window.location.href="index.php?module=candidat&action=affiche_selection_offre&langue="+langue+"&action_cadd="+action_cadd+"&idOffre="+id;
}

function supprimer_selection_cv(id,langue,action_cadd)
{
	window.location.href="index.php?module=entreprise&action=affiche_selection_cv&langue="+langue+"&action_cadd="+action_cadd+"&id_cv="+id;
}

function supprimer_selection_cv_admin(id,langue,action_cadd)
{
	window.location.href="index.php?module=admin&action=affiche_selection_cv&langue="+langue+"&action_cadd="+action_cadd+"&id_cv="+id;
}

function imprime_cv(id_cv,langue)
{
	window.open('modules/candidat/imprimer_cv.php?langue='+langue+'&id_cv='+id_cv,'popup'+id_cv,'height=600,toolbar=yes,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}	

function imprime_cv_lettre(id_cv,langue)
{
	window.open('modules/candidat/imprimer_cv_lettre.php?langue='+langue+'&id_cv='+id_cv,'popup'+id_cv,'height=600,toolbar=yes,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}	


function affiche_contact(id,langue)
{
	window.open('modules/admin/afficheDetailContact.php?langue='+langue+'&idContact='+id+'','popup'+id+'','height=400,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
}

function affiche_client(id,langue)
{
	window.open('modules/entreprise/affiche_detail_client.php?langue='+langue+'&id_client='+id+'','popup'+id+'','height=400,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=no,scrollbars=yes')
}

function affiche_recruteur(id,langue)
{
	window.open('modules/entreprise/affiche_detail_recruteur.php?langue='+langue+'&id_contact='+id+'','popup'+id+'','height=400,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=no,scrollbars=yes')
}

function affiche_contact_client(id,langue)
{
	window.open('modules/client/affiche_detail_recruteur.php?langue='+langue+'&id_contact='+id+'','popup'+id+'','height=400,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=no,scrollbars=yes')
}


function affiche_liste(nom_categ,langue,ref,tabRef)
{
	window.location.href="index.php?langue="+langue+"&module=admin&action=modifierTabRef&ref="+ref+"&tabRef="+tabRef+"&categ_titre="+nom_categ;
	
}

function filtre_client(id_client,langue)
{
	window.location.href="index.php?langue="+langue+"&module=entreprise&action=liste_offre&id_client="+id_client;
	
}

function filtre_client2(id_client)
{
	//window.location.href="../../modules/offre/affiche_liste_all_offre.php?langue="+langue+"&id_client="+id_client+"&id_candidat="+id_candidat;
	
	window.document.frm_client.id_client.value=id_client;
	window.document.frm_client.submit();	
	
}

function acces_categ(langue,ref,tabRef, page,categ)
{
	window.location.href="index.php?langue="+langue+"&module=admin&action="+page+"&ref="+ref+"&tabRef="+tabRef+"&categ_titre="+categ;
	
}

function contact_mail_admin(email,langue,id_cv,id_contact)
{
	if(id_cv!=""){
		window.open('modules/admin/affiche_mail.php?langue='+langue+'&id_cv='+id_cv+'&email='+email+'','popup'+id_cv+'','height=600,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
	}else{
		window.open('modules/admin/affiche_mail.php?langue='+langue+'&id_contact='+id_contact+'&email='+email+'','popup'+id_contact+'','height=600,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
	}
	
}

function mail_client(email,langue,id_client)
{
	window.open('modules/entreprise/affiche_mail_client.php?langue='+langue+'&id_client='+id_client+'&email='+email+'','popup'+id_client+'','height=600,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
}

function mail_recruteur(email,langue,id_contact)
{
	window.open('modules/entreprise/affiche_mail_recruteur.php?langue='+langue+'&id_contact='+id_contact+'&email='+email+'','popup'+id_contact+'','height=600,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
}

function mail_contact_client(email,langue,id_contact)
{
	window.open('modules/client/affiche_mail_recruteur.php?langue='+langue+'&id_contact='+id_contact+'&email='+email+'','popup'+id_contact+'','height=600,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
}

function contact_mail_ent(langue,id_cv,id_candidature)
{
	//window.location.href="index.php?langue="+langue+"&module=admin&action=mail&email="+email;
	window.open('modules/entreprise/affiche_mail.php?langue='+langue+'&id_cv='+id_cv+'&id_candidature='+id_candidature+'&id_candidat='+id_cv+'','popup'+id_cv+'','height=600,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
	
}

function chk_vers_txt(nom_form,nom_txt,val_txt,nom_chk)
{
	if(document.forms[nom_form].elements[nom_chk].checked == true){
		document.forms[nom_form].elements[nom_txt].value = val_txt;
	}else{
		document.forms[nom_form].elements[nom_txt].value="";
	}
}


function set_valeur_liste(nom_form,nom_element,obj_select,sep_value){
	var long_chaine_total = obj_select.length;
	var long_sep = sep_value.length;
	var result_chaine = obj_select.substring(long_sep,long_chaine_total);

	if(String(obj_select.substring(0,sep_value.length))==String(sep_value)){
		
		document.forms[nom_form].elements[nom_element].value = result_chaine;
	}else{
		document.forms[nom_form].elements[nom_element].value = "";
	}
}



function affiche_logo(logo)
{
	window.open('modules/entreprise/affiche_logo.php?logo='+logo,'popup1','height=400,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}	

function affiche_photo(photo)
{
	window.open('modules/candidat/affiche_photo.php?photo='+photo,'popup1','height=400,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}

function affiche_cv(id_cv,langue)
{
	//window.location.href="index.php?module=entreprise&action=affiche_cv&id_cv="+id+"&langue="+langue
	window.open('modules/entreprise/affiche_cv.php?langue='+langue+'&id_cv='+id_cv,'popup'+id_cv,'height=600,toolbar=yes,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}	

function affiche_cv_client(id_cv,langue)
{
	//window.location.href="index.php?module=entreprise&action=affiche_cv&id_cv="+id+"&langue="+langue
	window.open('modules/client/affiche_cv.php?langue='+langue+'&id_cv='+id_cv,'popup'+id_cv,'height=600,toolbar=yes,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}	

function edition_courrier(id_req,langue){
	if(id_req==""){
		alert("Aucune requête choisi !");
	}else{
		window.open('modules/admin/affiche_edition.php?langue='+langue+'&id_req='+id_req,'popup'+id_req,'height=600,toolbar=yes,location=no,directories=no,status=yes,width=300,resizable=no,scrollbars=yes')
	}
}

function voir_cv(id_cv,langue)
{
	window.open('../../modules/candidat/imprimer_cv_bis.php?langue='+langue+'&id_cv='+id_cv,'popup'+id_cv,'height=600,toolbar=yes,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}

function voir_lettre(id_cv,langue)
{
	window.open('../../modules/candidat/imprimer_lettre.php?langue='+langue+'&id_cv='+id_cv,'popup'+id_cv,'height=400,toolbar=yes,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
}	

function affiche_cv_admin(id_cv,langue,email)
{
	//window.location.href="index.php?module=admin&action=affiche_cv&id_cv="+id+"&langue="+langue;
	window.open('modules/admin/affiche_cv_admin.php?langue='+langue+'&id_cv='+id_cv,'popup'+id_cv,'height=600,toolbar=yes,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes')
	/*
	document.frm_detail_cv.id_cv.value=id_cv;
	document.frm_detail_cv.EMAIL_CANDIDAT2.value=email;
	document.frm_detail_cv.submit();
	*/
}	

function modif_cv_admin(id_cv,langue,email)
{
	//window.location.href="index.php?langue="+langue+"&module=candidat&action=creerCv&id_cv="+id_cv;
	
	document.frm_modif_cv.id_cv.value=id_cv;
	document.frm_modif_cv.EMAIL_CANDIDAT2.value=email;
	document.frm_modif_cv.submit();	
	
}

function valider_cv(id_cv_gen,langue,email,profil)
{
	
	window.open('modules/entreprise/valide_candidat.php?langue='+langue+'&id_cv='+id_cv_gen+'&EMAIL_CANDIDAT2='+email+'&profil='+profil,'popup'+id_cv_gen,'height=600,toolbar=no,location=no,directories=no,status=no,width=800,resizable=yes,scrollbars=yes,fullscreen=no');

}

function tri_cv_candidat(value_select)
{
	document.frm_tri.tri_cv.value=value_select;
	document.frm_tri.tri_cv2.value=value_select;
	document.frm_tri.submit();	
}

function short_list_ent(value_select)
{
		document.frm_short_list_ent.flag_id_list2.value=value_select;
		document.frm_short_list_ent.submit();
}

function profil_ent(value_select)
{
		document.frm_profil.id_list.value=value_select;
		document.frm_profil.submit();
}

function modifier_statut_id_ref(value_select)
{
		document.frm_profil.id_ref.value=value_select;
		document.frm_profil.submit();
}

function tri_cv_offre_candidat(value_select)
{
	document.frm_tri_offre.tri_cv_offre.value=value_select;
	document.frm_tri_offre.submit();	
}

function tri_perPage(value_select)
{
	document.frm_perPage.perPage.value=value_select;
	document.frm_perPage.submit();	
}

function afficher_cv_offre_candidat(value_select)
{
	document.frm_aff_offre.suivi.value=value_select;
	document.frm_aff_offre.submit();	
}

function afficher_cv_actif_candidat(value_select)
{
	document.frm_aff_cv.actif.value=value_select;
	document.frm_aff_cv.actif2.value=value_select;
	document.frm_aff_cv.submit();	
}

function afficher_msg_mail(id_mail)
{
	document.frmMail.id_mail.value=id_mail;
	document.frmMail.submit();	
}

function afficher_req(id_req)
{
	document.frm_req.id_req.value=id_req;
	document.frm_req.submit();	
}

function afficher_msg_mail_multiple(id_mail)
{
	document.frmMail.id_mail.value=id_mail;
	document.frmMail.submit();	
}


function tri_offre_entreprise(value_select)
{
	document.frm_offre.tri_offre.value=value_select;
	document.frm_offre.submit();	
}

function tri_entreprise(value_select)
{
	document.frm_ent.tri_ent.value=value_select;
	document.frm_ent.submit();	
}

function tri_recruteur(value_select)
{
	document.frm_ent.tri_contact.value=value_select;
	document.frm_ent.submit();	
}


function modif_contact_admin(id_contact,langue,acces_page,id_offre)
{
	//window.location.href="index.php?langue="+langue+"&module=entreprise&action=gererProfilEntreprise&id_contact="+id_contact;
	window.location.href="modules/admin/acces_contact.php?langue="+langue+"&acces_page="+acces_page+"&id_contact="+id_contact+"&idOffre="+id_offre;
}

function modif_client(id_client,langue)
{
	//window.location.href="index.php?langue="+langue+"&module=entreprise&action=gererProfilEntreprise&id_contact="+id_contact;
	window.location.href="index.php?module=entreprise&action=modif_client&langue="+langue+"&id_client="+id_client;
}

/*
function modif_contact_admin(id_contact,langue)
{
	window.location.href="index.php?langue="+langue+"&module=entreprise&action=gererProfilEntreprise&id_contact="+id_contact;
}	
*/

function affiche_offre_direct(CATEGORIE_TITRE_OFFRE,INTITULE_OFFRE,langue)
{
	window.location.href="index.php?langue="+langue+"&module=offre&action=consulterOffre&CATEGORIE_TITRE_OFFRE="+CATEGORIE_TITRE_OFFRE+"&INTITULE_OFFRE="+INTITULE_OFFRE+"&auto_exec=1";

}	

function affiche_cv_direct(CATEGORIE_TITRE_CANDIDAT,TITRE_CANDIDAT ,langue)
{
	
	window.location.href="modules/entreprise/session_recherche.php?langue="+langue+"&sess_ent_categorie_titre_candidat[]="+CATEGORIE_TITRE_CANDIDAT+"&sess_ent_titre_candidat="+TITRE_CANDIDAT+"&id_list=-";
}	

function affiche_profil_direct(id_candidat ,langue)
{
	
	window.location.href="modules/entreprise/session_recherche.php?langue="+langue+"&sess_ent_id_candidat="+id_candidat;
}	


function charge_sous_categ(nom_form,nom_element,langue,page)
{
	
	for(var i=0; i<document.forms[nom_form].elements[nom_element].length; i++)
	{
		if(document.forms[nom_form].elements[nom_element].options[i].selected){
			nom_categ = document.forms[nom_form].elements[nom_element].options[i].value;
			break;
		}
	}
	if(page=="infosGeneralesCandidatVide"){
		var annee_naissance					= "&annee_naissance="+document.forms[nom_form].elements['annee_naissance'].value;
		var mois_naissance					= "&mois_naissance="+document.forms[nom_form].elements['mois_naissance'].value;
		var jour_naissance					= "&jour_naissance="+document.forms[nom_form].elements['jour_naissance'].value;
		var nom_candidat					= "&nom_candidat="+document.forms[nom_form].elements['nom_candidat'].value;
		var prenom_candidat					= "&prenom_candidat="+document.forms[nom_form].elements['prenom_candidat'].value;
		var ville_candidat					= "&ville_candidat="+document.forms[nom_form].elements['ville_candidat'].value;
		var adresse_candidat				= "&adresse_candidat="+document.forms[nom_form].elements['adresse_candidat'].value;
		var civilite_candidat				= "&civilite_candidat="+document.forms[nom_form].elements['civilite_candidat'].value;
		var email_candidat					= "&email_candidat="+document.forms[nom_form].elements['email_candidat'].value;
		var code_postal_candidat			= "&code_postal_candidat="+document.forms[nom_form].elements['code_postal_candidat'].value;
		var telephone_candidat				= "&telephone_candidat="+document.forms[nom_form].elements['telephone_candidat'].value;
		var mobile_candidat					= "&mobile_candidat="+document.forms[nom_form].elements['mobile_candidat'].value;
		var telecopie_candidat				= "&telecopie_candidat="+document.forms[nom_form].elements['telecopie_candidat'].value;
		var site_web_candidat				= "&site_web_candidat="+document.forms[nom_form].elements['site_web_candidat'].value;
		var niveau_etudes_candidat			= "&niveau_etudes_candidat="+document.forms[nom_form].elements['niveau_etudes_candidat'].value;	
		var permis_voiture_candidat			= "&permis_voiture_candidat="+document.forms[nom_form].elements['permis_voiture_candidat'].value;
		var situation_candidat				= "&situation_candidat="+document.forms[nom_form].elements['situation_candidat'].value;
			
		var login_candidat					= "&login_candidat="+document.forms[nom_form].elements['login_candidat'].value;
		var password_candidat				= "&password_candidat="+document.forms[nom_form].elements['password_candidat'].value;
		var region_candidat					= "&region_candidat="+document.forms[nom_form].elements['region_candidat'].value;		
		var pays_candidat					= "&pays_candidat="+document.forms[nom_form].elements['pays_candidat'].value;			
		if(document.forms[nom_form].elements['cacher_infos_perso_candidat'].checked == true){
			var cacher_infos_perso_candidat		= "&cacher_infos_perso_candidat=hidden";
		}else{
			var cacher_infos_perso_candidat		= "&cacher_infos_perso_candidat=visible";
		}		
		
		var url_cand = annee_naissance+mois_naissance+jour_naissance+nom_candidat+prenom_candidat+ville_candidat+adresse_candidat+civilite_candidat+email_candidat+code_postal_candidat+telephone_candidat+mobile_candidat+telecopie_candidat+site_web_candidat+niveau_etudes_candidat+permis_voiture_candidat+situation_candidat+date_disponibilite_candidat+nb_annee_experience_candidat+objectif_candidat+login_candidat+password_candidat+region_candidat+pays_candidat+cacher_infos_perso_candidat;
		window.location.href="index.php?langue="+langue+"&module=candidat&action="+page+"&categorie_titre_candidat="+nom_categ+url_cand;
	}else if(page=="infosGeneralesCandidat"){
		var annee_naissance					= "&annee_naissance="+document.forms[nom_form].elements['annee_naissance'].value;
		var mois_naissance					= "&mois_naissance="+document.forms[nom_form].elements['mois_naissance'].value;
		var jour_naissance					= "&jour_naissance="+document.forms[nom_form].elements['jour_naissance'].value;
		var nom_candidat					= "&nom_candidat="+document.forms[nom_form].elements['nom_candidat'].value;
		var prenom_candidat					= "&prenom_candidat="+document.forms[nom_form].elements['prenom_candidat'].value;
		var ville_candidat					= "&ville_candidat="+document.forms[nom_form].elements['ville_candidat'].value;
		var adresse_candidat				= "&adresse_candidat="+document.forms[nom_form].elements['adresse_candidat'].value;
		var civilite_candidat				= "&civilite_candidat="+document.forms[nom_form].elements['civilite_candidat'].value;
		var email_candidat					= "&email_candidat="+document.forms[nom_form].elements['email_candidat'].value;
		var code_postal_candidat			= "&code_postal_candidat="+document.forms[nom_form].elements['code_postal_candidat'].value;
		var telephone_candidat				= "&telephone_candidat="+document.forms[nom_form].elements['telephone_candidat'].value;
		var mobile_candidat					= "&mobile_candidat="+document.forms[nom_form].elements['mobile_candidat'].value;
		var telecopie_candidat				= "&telecopie_candidat="+document.forms[nom_form].elements['telecopie_candidat'].value;
		var site_web_candidat				= "&site_web_candidat="+document.forms[nom_form].elements['site_web_candidat'].value;
		var niveau_etudes_candidat			= "&niveau_etudes_candidat="+document.forms[nom_form].elements['niveau_etudes_candidat'].value;	
		var permis_voiture_candidat			= "&permis_voiture_candidat="+document.forms[nom_form].elements['permis_voiture_candidat'].value;
		var situation_candidat				= "&situation_candidat="+document.forms[nom_form].elements['situation_candidat'].value;		
		var region_candidat					= "&region_candidat="+document.forms[nom_form].elements['region_candidat'].value;		
		var pays_candidat					= "&pays_candidat="+document.forms[nom_form].elements['pays_candidat'].value;
		if(document.forms[nom_form].elements['cacher_infos_perso_candidat'].checked == true){
			var cacher_infos_perso_candidat		= "&cacher_infos_perso_candidat=hidden";
		}else{
			var cacher_infos_perso_candidat		= "&cacher_infos_perso_candidat=visible";
		}
		
		
		var url_cand = annee_naissance+mois_naissance+jour_naissance+nom_candidat+prenom_candidat+ville_candidat+adresse_candidat+civilite_candidat+email_candidat+code_postal_candidat+telephone_candidat+mobile_candidat+telecopie_candidat+site_web_candidat+niveau_etudes_candidat+permis_voiture_candidat+situation_candidat+region_candidat+pays_candidat+cacher_infos_perso_candidat;
		window.location.href="index.php?langue="+langue+"&module=candidat&action="+page+"&categorie_titre_candidat="+nom_categ+url_cand;
	}else if(page=="consulterOffre"){
		var REGION_OFFRE					= "&REGION_OFFRE="+document.forms[nom_form].elements['REGION_OFFRE'].value;
		var NIVEAU_QUALIFICATION_OFFRE		= "&NIVEAU_QUALIFICATION_OFFRE="+document.forms[nom_form].elements['NIVEAU_QUALIFICATION_OFFRE'].value;
		var TYPE_CONTRAT_OFFRE				= "&TYPE_CONTRAT_OFFRE="+document.forms[nom_form].elements['TYPE_CONTRAT_OFFRE'].value;
		var competenceOffre					= "&competenceOffre="+document.forms[nom_form].elements['competenceOffre'].value;
		
		var url_cand = REGION_OFFRE+NIVEAU_QUALIFICATION_OFFRE+TYPE_CONTRAT_OFFRE+competenceOffre;
		
		window.location.href="index.php?langue="+langue+"&module=public&action="+page+"&CATEGORIE_TITRE_OFFRE="+nom_categ+url_cand;
	}else if(page=="gererOffre"){

		var toto = document.forms[nom_form].elements['description_offre'].value;
		var titi = toto.replace('\n','<br />');
		alert(titi);
		var description_offre 			= "&description_offre="+document.forms[nom_form].elements['description_offre'].value;
		var reference_offre 			= "&reference_offre="+document.forms[nom_form].elements['reference_offre'].value;
		var intitule_offre 				= "&intitule_offre="+document.forms[nom_form].elements['intitule_offre'].value;
		var lieu_offre 					= "&lieu_offre="+document.forms[nom_form].elements['lieu_offre'].value;
		var type_offre 					= "&type_offre="+document.forms[nom_form].elements['type_offre'].value;
		var recup_type_contrat 			= "&recup_type_contrat="+document.forms[nom_form].elements['type_contrat'].value;
		var annee_debut 				= "&annee_debut="+document.forms[nom_form].elements['annee_debut'].value;
		var jour_debut 					= "&jour_debut="+document.forms[nom_form].elements['jour_debut'].value;
		var mois_debut 					= "&mois_debut="+document.forms[nom_form].elements['mois_debut'].value;
		
		var profil_candidat_offre 		= "&profil_candidat_offre="+document.forms[nom_form].elements['profil_candidat_offre'].value;
		var salaire_min_offre 			= "&salaire_min_offre="+document.forms[nom_form].elements['salaire_min_offre'].value;
		var salaire_max_offre 			= "&salaire_max_offre="+document.forms[nom_form].elements['salaire_max_offre'].value;
		var recup_type_region 			= "&recup_type_region="+document.forms[nom_form].elements['region_offre'].value;
		var recup_niveau_qualification 	= "&recup_niveau_qualification="+document.forms[nom_form].elements['niveau_qualification'].value;	
		var id_offre                 	= "&id_offre="+document.forms[nom_form].elements['id_offre'].value;
		var ajout_offre                 = "&ajout_offre="+document.forms[nom_form].elements['ajout_offre'].value;
		var pays_offre                 	= "&pays_offre="+document.forms[nom_form].elements['pays_offre'].value;
		

		var url_cand = reference_offre+intitule_offre+lieu_offre+type_offre+recup_type_contrat+annee_debut+jour_debut+mois_debut+description_offre+profil_candidat_offre+salaire_min_offre+salaire_max_offre+recup_type_region+recup_niveau_qualification+id_offre+ajout_offre+pays_offre;
		
		window.location.href="index.php?langue="+langue+"&module=entreprise&action="+page+"&categorie_titre_offre="+nom_categ+url_cand;
	}else if(page=="consulterCv"){
		var NIVEAU_ETUDES_CANDIDAT					= "&NIVEAU_ETUDES_CANDIDAT="+document.forms[nom_form].elements['NIVEAU_ETUDES_CANDIDAT'].value;
		var NB_ANNEE_EXPERIENCE_CANDIDAT		= "&NB_ANNEE_EXPERIENCE_CANDIDAT="+document.forms[nom_form].elements['NB_ANNEE_EXPERIENCE_CANDIDAT'].value;
		var competenceCv					= "&competenceCv="+document.forms[nom_form].elements['competenceCv'].value;
		
		var url_cand = NIVEAU_ETUDES_CANDIDAT+NB_ANNEE_EXPERIENCE_CANDIDAT+competenceCv;
		
		window.location.href="index.php?langue="+langue+"&module=entreprise&action="+page+"&CATEGORIE_TITRE_CANDIDAT="+nom_categ+url_cand;
	}else if(page=="listeCandidatAdmin"){
		var NIVEAU_ETUDES_CANDIDAT					= "&NIVEAU_ETUDES_CANDIDAT="+document.forms[nom_form].elements['NIVEAU_ETUDES_CANDIDAT'].value;
		var NB_ANNEE_EXPERIENCE_CANDIDAT		= "&NB_ANNEE_EXPERIENCE_CANDIDAT="+document.forms[nom_form].elements['NB_ANNEE_EXPERIENCE_CANDIDAT'].value;
		var competenceCv					= "&competenceCv="+document.forms[nom_form].elements['competenceCv'].value;
		
		var url_cand = NIVEAU_ETUDES_CANDIDAT+NB_ANNEE_EXPERIENCE_CANDIDAT+competenceCv;
		
		window.location.href="index.php?langue="+langue+"&module=admin&action="+page+"&CATEGORIE_TITRE_CANDIDAT="+nom_categ+url_cand;
	}else if(page=="listeOffreAdmin"){
		var REGION_OFFRE					= "&REGION_OFFRE="+document.forms[nom_form].elements['REGION_OFFRE'].value;
		var NIVEAU_QUALIFICATION_OFFRE		= "&NIVEAU_QUALIFICATION_OFFRE="+document.forms[nom_form].elements['NIVEAU_QUALIFICATION_OFFRE'].value;
		var TYPE_CONTRAT_OFFRE				= "&TYPE_CONTRAT_OFFRE="+document.forms[nom_form].elements['TYPE_CONTRAT_OFFRE'].value;
		var competenceOffre					= "&competenceOffre="+document.forms[nom_form].elements['competenceOffre'].value;
		
		var url_cand = REGION_OFFRE+NIVEAU_QUALIFICATION_OFFRE+TYPE_CONTRAT_OFFRE+competenceOffre;
		
		window.location.href="index.php?langue="+langue+"&module=admin&action="+page+"&CATEGORIE_TITRE_OFFRE="+nom_categ+url_cand;
	}else if(page=="nouveau_candidat"){
		var annee_naissance					= "&annee_naissance="+document.forms[nom_form].elements['annee_naissance'].value;
		var mois_naissance					= "&mois_naissance="+document.forms[nom_form].elements['mois_naissance'].value;
		var jour_naissance					= "&jour_naissance="+document.forms[nom_form].elements['jour_naissance'].value;
		var nom_candidat					= "&nom_candidat="+document.forms[nom_form].elements['nom_candidat'].value;
		var prenom_candidat					= "&prenom_candidat="+document.forms[nom_form].elements['prenom_candidat'].value;
		var ville_candidat					= "&ville_candidat="+document.forms[nom_form].elements['ville_candidat'].value;
		var adresse_candidat				= "&adresse_candidat="+document.forms[nom_form].elements['adresse_candidat'].value;
		var civilite_candidat				= "&civilite_candidat="+document.forms[nom_form].elements['civilite_candidat'].value;
		var email_candidat					= "&email_candidat="+document.forms[nom_form].elements['email_candidat'].value;
		var code_postal_candidat			= "&code_postal_candidat="+document.forms[nom_form].elements['code_postal_candidat'].value;
		var telephone_candidat				= "&telephone_candidat="+document.forms[nom_form].elements['telephone_candidat'].value;
		var mobile_candidat					= "&mobile_candidat="+document.forms[nom_form].elements['mobile_candidat'].value;
		var telecopie_candidat				= "&telecopie_candidat="+document.forms[nom_form].elements['telecopie_candidat'].value;
		var site_web_candidat				= "&site_web_candidat="+document.forms[nom_form].elements['site_web_candidat'].value;
		var niveau_etudes_candidat			= "&niveau_etudes_candidat="+document.forms[nom_form].elements['niveau_etudes_candidat'].value;	
		var permis_voiture_candidat			= "&permis_voiture_candidat="+document.forms[nom_form].elements['permis_voiture_candidat'].value;
		var situation_candidat				= "&situation_candidat="+document.forms[nom_form].elements['situation_candidat'].value;
			
		var date_disponibilite_candidat		= "&date_disponibilite_candidat="+document.forms[nom_form].elements['date_disponibilite_candidat'].value;
		var nb_annee_experience_candidat	= "&nb_annee_experience_candidat="+document.forms[nom_form].elements['nb_annee_experience_candidat'].value;
		var objectif_candidat				= "&objectif_candidat="+document.forms[nom_form].elements['objectif_candidat'].value;
		var login_candidat					= "&login_candidat="+document.forms[nom_form].elements['login_candidat'].value;
		var password_candidat				= "&password_candidat="+document.forms[nom_form].elements['password_candidat'].value;
		var region_candidat					= "&region_candidat="+document.forms[nom_form].elements['region_candidat'].value;		
		var pays_candidat					= "&pays_candidat="+document.forms[nom_form].elements['pays_candidat'].value;			
		if(document.forms[nom_form].elements['cacher_infos_perso_candidat'].checked == true){
			var cacher_infos_perso_candidat		= "&cacher_infos_perso_candidat=hidden";
		}else{
			var cacher_infos_perso_candidat		= "&cacher_infos_perso_candidat=visible";
		}		
		
		var url_cand = annee_naissance+mois_naissance+jour_naissance+nom_candidat+prenom_candidat+ville_candidat+adresse_candidat+civilite_candidat+email_candidat+code_postal_candidat+telephone_candidat+mobile_candidat+telecopie_candidat+site_web_candidat+niveau_etudes_candidat+permis_voiture_candidat+situation_candidat+date_disponibilite_candidat+nb_annee_experience_candidat+objectif_candidat+login_candidat+password_candidat+region_candidat+pays_candidat+cacher_infos_perso_candidat;
		window.location.href="index.php?langue="+langue+"&module=admin&action="+page+"&categorie_titre_candidat="+nom_categ+url_cand;		
	}
	
}

function affiche_stat(format_stat,langue,mode_recrut)
{
	//document.frm_gen_stat.format_stat.value=format;
	//document.frm_gen_stat.submit();
	if(document.frm_gen_stat.chk_niveau_etude.checked==true){
		var chk_niveau_etude 			= "ok";
	}else{
		var chk_niveau_etude 			= "ko";
	}
	if(document.frm_gen_stat.chk_nb_an_experience.checked==true){
		var chk_nb_an_experience 			= "ok";
	}else{
		var chk_nb_an_experience 			= "ko";	
	}
	/*
	if(document.frm_gen_stat.chk_code_postal.checked==true){
		var chk_code_postal 			= "ok";
	}else{
		var chk_code_postal 			= "ko";	
	}
	*/
	if(document.frm_gen_stat.chk_age.checked==true){
		var chk_age 			= "ok";
	}else{
		var chk_age 			= "ko";	
	}
	/*
	if(document.frm_gen_stat.chk_cand_titre.checked==true){
		var chk_cand_titre 			= "ok";
	}else{
		var chk_cand_titre 			= "ko";
	}
	*/
	if(document.frm_gen_stat.chk_cand_civilite.checked==true){
		var chk_cand_civilite 			= "ok";
	}else{
		var chk_cand_civilite 			= "ko";
	}
	if(document.frm_gen_stat.chk_cand_secteur_act.checked==true){
		var chk_cand_secteur_act 			= "ok";
	}else{
		var chk_cand_secteur_act 			= "ko";
	}	
	if(document.frm_gen_stat.chk_cand_region.checked==true){
		var chk_cand_region 			= "ok";
	}else{
		var chk_cand_region 			= "ko";
	}	
	if(document.frm_gen_stat.chk_cand_pays.checked==true){
		var chk_cand_pays 			= "ok";
	}else{
		var chk_cand_pays 			= "ko";
	}		
	if(document.frm_gen_stat.chk_cand_permis.checked==true){
		var chk_cand_permis 			= "ok";
	}else{
		var chk_cand_permis 			= "ko";
	}	
	if(document.frm_gen_stat.chk_cand_situation.checked==true){
		var chk_cand_situation 			= "ok";
	}else{
		var chk_cand_situation 			= "ko";
	}					
	if(document.frm_gen_stat.chk_cand_dispo.checked==true){
		var chk_cand_dispo 			= "ok";
	}else{
		var chk_cand_dispo 			= "ko";
	}		
	if(document.frm_gen_stat.chk_cand_niv_exp.checked==true){
		var chk_cand_niv_exp 			= "ok";
	}else{
		var chk_cand_niv_exp 			= "ko";
	}								

		
	if(mode_recrut=="non"){
		/*
		if(document.frm_gen_stat.chk_contact_code_postal.checked==true){
			var chk_contact_code_postal 			= "ok";
		}else{
			var chk_contact_code_postal 			= "ko";
		}
		*/
		if(document.frm_gen_stat.chk_contact_taille.checked==true){
			var chk_contact_taille 			= "ok";
		}else{
			var chk_contact_taille 			= "ko";
		}
		if(document.frm_gen_stat.chk_contact_activite.checked==true){
			var chk_contact_activite 			= "ok";
		}else{
			var chk_contact_activite 			= "ko";
		}
	}else{
		///var chk_contact_code_postal 			= "ko";	
		var chk_contact_taille 			= "ko";
		var chk_contact_activite 			= "ko";
	}
	if(document.frm_gen_stat.chk_offre_type.checked==true){
		var chk_offre_type 			= "ok";
	}else{
		var chk_offre_type 			= "ko";
	}
	if(document.frm_gen_stat.chk_offre_region.checked==true){
		var chk_offre_region 			= "ok";
	}else{
		var chk_offre_region 			= "ko";
	}
	/*
	if(document.frm_gen_stat.chk_offre_intitule.checked==true){
		var chk_offre_intitule 			= "ok";
	}else{
		var chk_offre_intitule 			= "ko";
	}
	*/
	if(document.frm_gen_stat.chk_offre_type_contrat.checked==true){
		var chk_offre_type_contrat 			= "ok";
	}else{
		var chk_offre_type_contrat 			= "ko";
	}	
	
	
	if(format_stat=="html"){
		window.open('modules/admin/affiche_statistique.php?chk_offre_type_contrat='+chk_offre_type_contrat+'&chk_offre_region='+chk_offre_region+'&chk_offre_type='+chk_offre_type+'&chk_contact_activite='+chk_contact_activite+'&chk_contact_taille='+chk_contact_taille+'&langue='+langue+'&format_stat='+format_stat+'&chk_niveau_etude='+chk_niveau_etude+'&chk_nb_an_experience='+chk_nb_an_experience+'&chk_age='+chk_age+'&chk_cand_civilite='+chk_cand_civilite+'&chk_cand_secteur_act='+chk_cand_secteur_act+'&chk_cand_region='+chk_cand_region+'&chk_cand_pays='+chk_cand_pays+'&chk_cand_permis='+chk_cand_permis+'&chk_cand_situation='+chk_cand_situation+'&chk_cand_dispo='+chk_cand_dispo+'&chk_cand_niv_exp='+chk_cand_niv_exp+'','popup','height=600,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
	}else if(format_stat=="excel"){
		//window.open('writeexcel/excel_statistique.php?chk_offre_type_contrat='+chk_offre_type_contrat+'&chk_offre_intitule='+chk_offre_intitule+'&chk_offre_region='+chk_offre_region+'&chk_offre_type='+chk_offre_type+'&chk_contact_activite='+chk_contact_activite+'&chk_contact_taille='+chk_contact_taille+'&chk_contact_code_postal='+chk_contact_code_postal+'&chk_cand_titre='+chk_cand_titre+'&langue='+langue+'&format_stat='+format+'&chk_niveau_etude='+chk_niveau_etude+'&chk_nb_an_experience='+chk_nb_an_experience+'&chk_code_postal='+chk_code_postal+'&chk_age='+chk_age+'','popup','height=600,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
		//window.location.target="_blank"
		//window.location.href='writeexcel/excel_statistique.php?chk_offre_type_contrat='+chk_offre_type_contrat+'&chk_offre_intitule='+chk_offre_intitule+'&chk_offre_region='+chk_offre_region+'&chk_offre_type='+chk_offre_type+'&chk_contact_activite='+chk_contact_activite+'&chk_contact_taille='+chk_contact_taille+'&chk_contact_code_postal='+chk_contact_code_postal+'&chk_cand_titre='+chk_cand_titre+'&langue='+langue+'&format_stat='+format+'&chk_niveau_etude='+chk_niveau_etude+'&chk_nb_an_experience='+chk_nb_an_experience+'&chk_code_postal='+chk_code_postal+'&chk_age='+chk_age
		//window.open('writeexcel/excel_statistique.php?chk_offre_type_contrat='+chk_offre_type_contrat+'&chk_offre_intitule='+chk_offre_intitule+'&chk_offre_region='+chk_offre_region+'&chk_offre_type='+chk_offre_type+'&chk_contact_activite='+chk_contact_activite+'&chk_contact_taille='+chk_contact_taille+'&chk_contact_code_postal='+chk_contact_code_postal+'&chk_cand_titre='+chk_cand_titre+'&langue='+langue+'&chk_niveau_etude='+chk_niveau_etude);
		document.frm_gen_stat.action = "writeexcel/excel_statistique.php";
		document.frm_gen_stat.format_stat.value=format_stat;
		document.frm_gen_stat.submit();		
	}else if(format_stat=="pdf"){
		document.frm_gen_stat.action = "modules/admin/affiche_statistique.php";
		document.frm_gen_stat.format_stat.value=format_stat;
		document.frm_gen_stat.submit();			
		//window.open('modules/admin/affiche_statistique.php?chk_offre_type_contrat='+chk_offre_type_contrat+'&chk_offre_intitule='+chk_offre_intitule+'&chk_offre_region='+chk_offre_region+'&chk_offre_type='+chk_offre_type+'&chk_contact_activite='+chk_contact_activite+'&chk_contact_taille='+chk_contact_taille+'&chk_contact_code_postal='+chk_contact_code_postal+'&chk_cand_titre='+chk_cand_titre+'&langue='+langue+'&format_stat='+format_stat+'&chk_niveau_etude='+chk_niveau_etude+'&chk_nb_an_experience='+chk_nb_an_experience+'&chk_code_postal='+chk_code_postal+'&chk_age='+chk_age+'','popup','height=600,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=yes,scrollbars=yes')
	}
}


/*
function affiche_stat_pdf(format)
{
	document.frm_gen_stat.format_stat.value=format;
	document.frm_gen_stat.submit();
}
*/


function affiche_popup(langue,format)
{
	//document.frm_gen_stat.format_stat.value=format;
	window.open('modules/admin/affiche_statistique.php?langue='+langue+'&format='+format+'','popup','height=310,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=no,scrollbars=yes')
}	


function verifFormLettre(){
	var titre_lettre=document.form_lettre.titre_lettre.value;
	var contenu_lettre=document.form_lettre.contenu_lettre.value;
	var chainealert="vous n'avez pas rempli le champ obligatoire : \n---\nyou did not fill the obligatory field ";
	
	var test=0;
	if(titre_lettre==""){
		chainealert=chainealert+" Titre de la lettre \n---\nTitrate letter ";
		test=1;
	}else if(contenu_lettre==""){
		chainealert=chainealert+" Contenu de la lettre \n---\nContents of the letter";
		test=1;
	}
	if (test==1){
		alert(chainealert);
		return false;
	}else{
		return true;
	}
}

function verif_frm_table(){
	var administrateur			= document.frm_etape_2.administrateur.value;
	var competence				= document.frm_etape_2.competence.value;
	var contact					= document.frm_etape_2.contact.value;
	var candidat				= document.frm_etape_2.candidat.value;
	var formation				= document.frm_etape_2.formation.value;
	var langue					= document.frm_etape_2.langue.value;
	var mission					= document.frm_etape_2.mission.value;
	var modeliser				= document.frm_etape_2.modeliser.value;
	var offre					= document.frm_etape_2.offre.value;
	var rubrique				= document.frm_etape_2.rubrique.value;
	var lettre					= document.frm_etape_2.lettre.value;
	
	var chainealert="Toutes les tables doivent etre renseignées : \n---\nAll the tables must be indicated :";
	
	var test=0;
	if( administrateur=="" ||  competence=="" || contact=="" || candidat=="" || formation=="" || langue=="" || formation==""  || mission=="" || modeliser=="" || offre=="" ||  rubrique=="" || lettre==""){
		
		chainealert=chainealert;
		test=1;
	}
	if (test==1){
		alert(chainealert);
		return false;
	}else{
		return true;
	}
}

function verifMail(a) 
{
	testm = false ;
	for (var j=1 ; j<(a.length) ; j++) 
	{
		if (a.charAt(j)=='@') 
		{ 
			if (j<(a.length-4))
			{ 
				for (var k=j ; k<(a.length-2) ; k++) 
				{ 
					if (a.charAt(k)=='.') testm = true; 
				} 
			} 
		} 
	} 
	
	if (testm==false) alert('Votre adresse e-mail est incorrecte. \n---\nYour address e-mail is incorrect.'); 
	
	return testm ; 
}

function verifLongeurChaine(a)
{
	//testm = false ;
	if(a.length < 35)
	{
		testm = true; 
	}else 
	{
		testm = false ;
	}
	if (testm==false) alert("Le texte ne peut excéder 35 caractères ! \n---\nThe text cannot exceed 35 characters !");
	return testm ; 
}

function trim(string) 
{
	return string.replace(/(^\s*)|(\s*$)/g,''); 
}

function verifAfficheMail(){

	var sujet_mail 	= document.frm_envoi_mail.sujet_mail2.value;
	var desc_mail 	= document.frm_envoi_mail.desc_mail.value;
	var to_mail 	= document.frm_envoi_mail.to_mail.value;
	var email 		= document.frm_envoi_mail.email.value;
	var result 		= true;
	

	result =  verifMail(email);

	if(sujet_mail=="" ){
		alert("Saisissez un sujet \n---\nSeize a subject");
		result =  false;
	}
	if(to_mail=="" ){
		alert("Saisissez un expéditeur \n---\nSeize a subject");
		result =  false;
	}	
	/*
	if(desc_mail=="" ){
		alert("Saisissez une description \n---\nSeize a description");
		result =  false;
	}	
	*/
	

	return result;
}

function verif_telephone(nom_element){
  var s;
  for(var i = 0; i < nom_element.length; i++)
  {

    // le caractuel est stocké dans s.
    s = nom_element.charAt(i);

    // Caractères valides : espace, parenthèses, "(" et ")".
    if( !((s >= 0) && (s <= 9))
     && (s != '(') && (s != ')')
     )
    {
      return(false);
    }
  }
}

var body_bgcolor;
var body_bg_img = "http://eur.i1.yimg.com/us.yimg.com";
var body_text;         
var lt_bgcolor;        
var head_bgcolor;      
var head_text_color;   
var subhead_bgcolor;   
var subhead_text_color;
var body_alink;        
var body_vlink;        
var body_text;         
var head_text_face;   
var head_text_size;
var subhead_text_face;
var subhead_text_size;

function initVars()
{
  body_bgcolor       = getRadioValue('.body_bgcolor'); 
  body_text          = getRadioValue('.body_text'); 
  lt_bgcolor         = getRadioValue('.lt_bgcolor'); 
  head_bgcolor       = getRadioValue('.head_bgcolor'); 
  head_text_color    = getRadioValue('.head_text_color'); 
  subhead_bgcolor    = getRadioValue('.subhead_bgcolor'); 
  subhead_text_color = getRadioValue('.subhead_text_color'); 
  body_alink         = getRadioValue('.body_alink'); 
  body_vlink         = getRadioValue('.body_vlink'); 
  body_text          = getRadioValue('.body_text'); 
  head_text_face     = getListboxValue('.head_text_face',true);
  head_text_size     = getListboxValue('.head_text_size',false);
  subhead_text_face  = getListboxValue('.subhead_text_face',true);
  subhead_text_size  = getListboxValue('.subhead_text_size',false);
}

function getRadioValue (property)
{
  var retVal;
  var i=0;
  while (i < 48) {
    if (document.fm[property][i].checked) {
      return document.fm[property][i].value;
    }
    i++;
  }
  if (document.fm[property][48].checked) {
    return '';
  }
  return document.fm[property + '.txt'].value;
}

function getListboxValue (property, isFont)
{
  var val = document.fm[property][document.fm[property].selectedIndex].value;
  if (val == 'def') {
    return '';
  }
  else if (val == '') {
    return 'Arial';
  } else {
    return val;
  }
}

function redrawPreview(property)
{
  var p = '<html><head></head><body ';

/*
  if (body_bgcolor != '') {
    p += 'bgcolor=' + body_bgcolor;
  }

  if (body_text != '') {
    p += ' text=' + body_text;
  }

  if (document.fm['.body_bg_img'] && document.fm['.body_bg_img'].checked) {
    p += ' background=' + body_bg_img;
  }
  
  p += '><table border=0 cellpadding=2 cellspacing=1 bgcolor=000000><tr><td bgcolor=ffffff><font face=Arial color=000000><b>' + "Aperçu" + '</b></font>&nbsp;<font face=Arial size=-1 color=000000>' + "(pour aperçu seulement)" + '</font></td></tr></table><center><table border=0 cellpadding=3 cellspacing=0 width=95%"><tr valign=top><td width=204><table border=0 cellpadding=3 cellspacing=0 width="100%"';
  
  if (lt_bgcolor != '') {
    p += ' bgcolor=' + lt_bgcolor;
  }
  */
  
  p += 'bgcolor=' + property;
  p += '>';
  
  /*
  if (head_bgcolor != '') {
    p += ' bgcolor=' + head_bgcolor;
  }
  
  p += '><td><img align=right border=0 height=15 width=18 src="http://eur.i1.yimg.com/us.yimg.com/i/my/x.gif" alt="' + "Supprimer" + '"><b><font';
 
  if (head_text_face != '') {
    p += ' face="' + head_text_face + '"';
  }
  if (head_text_color != '') {
    p += ' color=' + head_text_color;
  }
  if (head_text_size != '') {
    p += ' size=' + head_text_size;
  }
  p += '>Header</font></b></td></tr><tr><td width=200 align=center nowrap><br>' + "[Couleur de fond de la marge]" + '<br><br></center></td></tr></table></td><td width="99%"><table border=0 cellpadding=3 cellspacing=0 width="100%"><tr';
 
  if (head_bgcolor != '') {
    p += ' bgcolor=' + head_bgcolor;
  }
 
  p += '><td nowrap><img align=right border=0 height=15 width=18 src="http://eur.i1.yimg.com/us.yimg.com/i/my/x.gif" alt="' + "Supprimer" + '"> <img align=right border=0 height=15 width=28 src="http://eur.i1.yimg.com/us.yimg.com/i/my/edit2.gif" alt="' + "Modifier" + '"><img align=right src="http://eur.i1.yimg.com/us.yimg.com/i/my/detach.gif" border=0 height=15 width=18 alt="' + "Détacher" + '"><b><font';
 
  if (head_text_face != '') {
    p += ' face="' + head_text_face + '"';
  }
  if (head_text_color != '') {
    p += ' color=' + head_text_color;
  }
  if (head_text_size != '') {
    p += ' size=' + head_text_size;
  }
   
  p += '>' + "Titre" + '</font></b></td></tr><tr';
 
  if (subhead_bgcolor != '') {
    p += ' bgcolor=' + subhead_bgcolor;
  }
 
  p += '><td><font';
 
  if (subhead_text_face != '') {
    p += ' face="' + subhead_text_face + '"';
  }
  if (subhead_text_color != '') {
    p += ' color=' + subhead_text_color;
  }
  if (subhead_text_size != '') {
    p += ' size=' + subhead_text_size;
  }
   
  p += '><b>' + "Sous-titre" + '</b></font></td></tr><tr><td><u><font color=';
 
  if (body_alink != '') {
    p += body_alink;
  } else {
    p += '0000ff';
  }
 
  p += '>' + "Liens non concultés" + '</font></u> &nbsp;&nbsp;&nbsp;&nbsp; <u><font color=';
 
  if (body_vlink != '') {
    p += body_vlink;
  } else {
    p += '840084';
  }
  
  p += '>' + "Liens consultés" + '</font></u> &nbsp;&nbsp;&nbsp;&nbsp; <font';
 
  if (body_text != '') {
    p += ' color=' + body_text;
  }
  */
 
  //p += '>' + "Texte" + '</font></td></tr></table></td></tr></table></body></html>\n';
  
 p +=' toto</body></html>\n';

  //var pvd = parent.frames.preview.document;
  var pvd = window.open('modules/admin/preview.php?bgcolor='+property,'popup','height=400,toolbar=no,location=no,directories=no,status=yes,width=600,resizable=no,scrollbars=yes');
  //pvd.open();
  //pvd.writeln(p);
  //pvd.close();
}

function setTxt (property) 
{
  var val = getRadioValue(property);
  if (val == 'def') { val = ''; }
  eval(property.substr(1) + '="' + val + '";');
  //document.fm[property + '.txt'].value = val;
  redrawPreview(val);
}

function chkTxt (property)
{
  var val = document.fm[property + '.txt'].value;
  if (val != '') {
    document.fm[property][49].checked='1';
    eval(property.substr(1) + '="' + val + '";');
  }
  redrawPreview();
}

function updateListbox (property)
{
  var val = document.fm[property][document.fm[property].selectedIndex].value;
  if (val == 'def') { val = ''; }
  eval(property.substr(1) + '="' + val + '";');
  redrawPreview();
}

function check(list_form,field) 
{
		if(list_form.master_list.checked==false){
			var buttoncheck = "true";
		}else{
			var buttoncheck = "false";
		}
		
		if (buttoncheck == "false") {
			for (i = 0; i < field.length; i++) 
			{
				field[i].checked = true;
			}
			buttoncheck = "true";
			return "Désélectionner"; 
		}else{
			for (i = 0; i < field.length; i++) 
			{
				field[i].checked = false; 
			}
			buttoncheck = "false";
			return "Tout sélectionner"; 
		}

}

function upd_suivi(id_candidature,id_candidat,idOffre,langue,btn_suivi){
	window.location.href="modules/entreprise/upd_candidature.php?id_candidature="+id_candidature+"&id_candidat="+id_candidat+"&idOffre="+idOffre+"&langue="+langue+"&btn_suivi[]="+btn_suivi;
}

function selection_multiple(type_action, field,langue)
{
	var id_candidat="";
	if(type_action=='mail'){
		if(field.length > 0){	
			for (i = 0; i < field.length; i++) 
			{
				eval(field[i])
				if(field[i].checked == true && field[i].value!="" ){
					id_candidat = id_candidat+field[i].value+'_@@_';
				}
			}
			if(id_candidat!=""){
				window.open('modules/entreprise/affiche_mail_multiple.php?langue='+langue+'&t_id_candidat='+id_candidat,'popup1','height=650,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
			}else{
				alert("Aucun candidats sélectionnés");
			}
		}	
	}else if(type_action=='profil'){
		if(field.length > 0){	
			for (i = 0; i < field.length; i++) 
			{
				eval(field[i])
				if(field[i].checked == true && field[i].value!="" ){
					id_candidat = id_candidat+field[i].value+'_@@_';
				}
			}
			if(id_candidat!=""){
				window.open('modules/entreprise/enreg_classer_cv.php?langue='+langue+'&t_id_candidat='+id_candidat,'popup1','height=300,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=yes,scrollbars=no')
			}else{
				alert("Aucun candidats sélectionnés");
			}
		}	
	}	
}

function selection_multiple_admin(type_action, field,langue)
{
	var id_candidat="";
	if(type_action=='mail'){
		if(field.length > 0){	
			for (i = 0; i < field.length; i++) 
			{
				eval(field[i])
				if(field[i].checked == true && field[i].value!="" ){
					id_candidat = id_candidat+field[i].value+'_@@_';
				}
			}
			if(id_candidat!=""){
				window.open('../../modules/entreprise/affiche_mail_multiple.php?langue='+langue+'&t_id_candidat='+id_candidat,'popup1','height=650,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
			}else{
				alert("Aucun candidats sélectionnés");
			}
		}	
	}else if(type_action=='profil'){
		if(field.length > 0){	
			for (i = 0; i < field.length; i++) 
			{
				eval(field[i])
				if(field[i].checked == true && field[i].value!="" ){
					id_candidat = id_candidat+field[i].value+'_@@_';
				}
			}
			if(id_candidat!=""){
				window.open('../../modules/entreprise/enreg_classer_cv.php?langue='+langue+'&t_id_candidat='+id_candidat,'popup1','height=300,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=yes,scrollbars=no')
			}else{
				alert("Aucun candidats sélectionnés");
			}
		}	
	}	
}

function selection_multiple2(type_action, field,langue,idOffre,suivi,tri_cv_offre,perPage)
{
	var id_candidat="";
	
	if(type_action=='sup_cand'){
		if(field.length > 0){	
			for (i = 0; i < field.length; i++) 
			{
				eval(field[i])
				if(field[i].checked == true && field[i].value!="" ){
					id_candidat = id_candidat+field[i].value+'_@@_';
				}
			}
			if(id_candidat!=""){
				window.location.href='modules/entreprise/sup_candidature.php?langue='+langue+'&t_id_candidat='+id_candidat+'&idOffre='+idOffre+'&suivi='+suivi+'&tri_cv_offre='+tri_cv_offre+'&perPage='+perPage;
			}else{
				alert("Aucun candidats sélectionnés");
			}
		}			
	}
}

function selection_multiple_recruteur(type_action, field,langue)
{
	var id_contact="";
	if(type_action=='mail'){
		if(field.length > 0){	
			for (i = 0; i < field.length; i++) 
			{
				eval(field[i])
				if(field[i].checked == true && field[i].value!="" ){
					id_contact = id_contact+field[i].value+'_@@_';
				}
			}
			if(id_contact!=""){
				window.open('modules/entreprise/affiche_mail_multiple_recruteur.php?langue='+langue+'&t_id_contact='+id_contact,'popup1','height=650,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
			}else{
				alert("Aucun recruteurs sélectionnés");
			}
		}	
	}
}

function selection_multiple_client(type_action, field,langue)
{
	var id_client="";
	if(type_action=='mail'){
		if(field.length > 0){	
			for (i = 0; i < field.length; i++) 
			{
				eval(field[i])
				if(field[i].checked == true && field[i].value!="" ){
					id_client = id_client+field[i].value+'_@@_';
				}
			}
			if(id_client!=""){
				window.open('modules/entreprise/affiche_mail_multiple_client.php?langue='+langue+'&t_id_client='+id_client,'popup1','height=650,toolbar=no,location=no,directories=no,status=yes,width=800,resizable=no,scrollbars=yes')
			}else{
				alert("Aucun clients sélectionnés");
			}
		}	
	}
}

function attente2()
{

var valpage="";
valpage=valpage+'\n'+'var largeur=-1;'
valpage=valpage+'\n'+'var tps=0;'
valpage=valpage+'\n'+'var temps=0;'
valpage=valpage+'\n'+'tempo="0";'
valpage=valpage+'\n'+'largeur=largeur+1;'
valpage=valpage+'\n'+'function lancer()'
valpage=valpage+'\n'+'{ largeur=largeur+1;'
valpage=valpage+'\n'+'largeur2=largeur*5+10;'
valpage=valpage+'\n'+'temps=temps+0.2;'
valpage=valpage+'\n'+'var rech=".";'
valpage=valpage+'\n'+'var vattemp=\'"\'+temps+\'"\';'
valpage=valpage+'\n'+'var a=vattemp.indexOf(rech,0);'

valpage=valpage+'\n'+'if(a!=-1) {var tempo=vattemp.substring(1,a);}'
valpage=valpage+'\n'+'else{ var tempo=vattemp.replace(\'"\',\'\');;'
valpage=valpage+'\n'+'      var tempo=tempo.replace(\'"\',\'\');};'


valpage=valpage+'\n'+'text=\'<font face=tahoma style="font-size:10px">\'+tempo+\' s</font><br><table width=100 height=5 border=1 cellspacing=0 cellpadding=0  bordercolordark=#0088bb bordercolorligth=#0088dd><tr><td width=100>\''
valpage=valpage+'\n'+'text=text+\'<table width=100 height=5 border=0 cellspacing=1 cellpadding=0 ><tr>\''
valpage=valpage+'\n'+'for(var i=0;i<30;i++)'
valpage=valpage+'\n'+'{if(largeur<=i){text=text+\'<td bgcolor=#ffffff width=\'+largeur2+\'><font size=1px>&nbsp;</font></td>\'}'
valpage=valpage+'\n'+'else'
valpage=valpage+'\n'+'{text=text+\'<td bgcolor=#00aadd width=\'+largeur2+\'><font size=1px>&nbsp;</font></td>\'}'
valpage=valpage+'\n'+'}'
valpage=valpage+'\n'+'text=text+\'</tr></table></td></tr></table>\''
valpage=valpage+'\n'+'document.getElementById("pouet").innerHTML=text'


valpage=valpage+'\n'+'tps=tps+1;'
valpage=valpage+'\n'+'if(tps<1000)'
valpage=valpage+'\n'+'{if(largeur<=30){'
valpage=valpage+'\n'+'setTimeout(\'lancer()\',200)}'
valpage=valpage+'\n'+'else{'
valpage=valpage+'\n'+'largeur=-1;'
valpage=valpage+'\n'+'setTimeout(\'lancer()\',200)}'
valpage=valpage+'\n'+'}'
valpage=valpage+'\n'+'}'


 return valpage

}

function attente()
{
valpage=valpage='<html><head></head><body onload="lancer()">'
valpage=valpage+'\n'+'<table id=att border=0>'
valpage=valpage+'\n'+'<tr><td align=center><div id=pouet></div></td></tr>'
valpage=valpage+'\n'+'<tr><td align=center><font face=tahoma style="font-size:10px">Analyse du CV ...</font></td></tr></table>'
valpage=valpage+'\n'+'<scr'+'ipt>'
valpage=valpage+'\n'+'var largeur=-1;'
valpage=valpage+'\n'+'var tps=0;'
valpage=valpage+'\n'+'var temps=0;'
valpage=valpage+'\n'+'tempo="0";'
valpage=valpage+'\n'+'largeur=largeur+1;'
valpage=valpage+'\n'+'function lancer()'
valpage=valpage+'\n'+'{ largeur=largeur+1;'
valpage=valpage+'\n'+'largeur2=largeur*5+10;'
valpage=valpage+'\n'+'temps=temps+0.2;'
valpage=valpage+'\n'+'var rech=".";'
valpage=valpage+'\n'+'var vattemp=\'"\'+temps+\'"\';'
valpage=valpage+'\n'+'var a=vattemp.indexOf(rech,0);'

valpage=valpage+'\n'+'if(a!=-1) {var tempo=vattemp.substring(1,a);}'
valpage=valpage+'\n'+'else{ var tempo=vattemp.replace(\'"\',\'\');;'
valpage=valpage+'\n'+'      var tempo=tempo.replace(\'"\',\'\');};'


valpage=valpage+'\n'+'text=\'<font face=tahoma style="font-size:10px">\'+tempo+\' s</font><br><table width=100 height=5 border=1 cellspacing=0 cellpadding=0  bordercolordark=#0088bb bordercolorligth=#0088dd><tr><td width=100>\''
valpage=valpage+'\n'+'text=text+\'<table width=100 height=5 border=0 cellspacing=1 cellpadding=0 ><tr>\''
valpage=valpage+'\n'+'for(var i=0;i<30;i++)'
valpage=valpage+'\n'+'{if(largeur<=i){text=text+\'<td bgcolor=#ffffff width=\'+largeur2+\'><font size=1px>&nbsp;</font></td>\'}'
valpage=valpage+'\n'+'else'
valpage=valpage+'\n'+'{text=text+\'<td bgcolor=#00aadd width=\'+largeur2+\'><font size=1px>&nbsp;</font></td>\'}'
valpage=valpage+'\n'+'}'
valpage=valpage+'\n'+'text=text+\'</tr></table></td></tr></table>\''
valpage=valpage+'\n'+'document.getElementById("pouet").innerHTML=text'


valpage=valpage+'\n'+'tps=tps+1;'
valpage=valpage+'\n'+'if(tps<1000)'
valpage=valpage+'\n'+'{if(largeur<=30){'
valpage=valpage+'\n'+'setTimeout(\'lancer()\',200)}'
valpage=valpage+'\n'+'else{'
valpage=valpage+'\n'+'largeur=-1;'
valpage=valpage+'\n'+'setTimeout(\'lancer()\',200)}'
valpage=valpage+'\n'+'}'
valpage=valpage+'\n'+'}'
valpage=valpage+'\n'+'</scr'+'ipt>'
valpage=valpage+'\n'+'</body>'
valpage=valpage+'\n'+'</html>'

 return valpage

}
var att=""
function appelattente()
{
 valpage=valpage=attente()
 att=window.open('','la_blank','width=160px,height=2px,left=220,top=60,toolbar=no,location=no,menubar=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,menuBar=no'); 
 att.document.open()
 att.document.write(valpage)
 att.document.close()
}

function appelattente2()
{
 return attente2()

}
 
 function fermeattente()
 {att.close()
 }

function cache(idf) {
	  if (document.getElementById) {
		  document.getElementById(idf).style.visibility="hidden";
		} else if (document.all) {
		  document.all[idf].style.visibility="hidden";
		} else if (document.layers) {
		  document.layers[idf].visibility="hidden";
		} }	
function analyse_cv(langue,user_file)
{
	//document.frm_gen_stat.format_stat.value=format;
	window.open('modules/candidat/upload_cv_emanation.php?langue='+langue+'&user_file='+user_file+'','popup','height=310,toolbar=no,location=no,directories=no,status=yes,width=500,resizable=no,scrollbars=yes')
}			
function NewResume() {
	clig( 'UploadWait' , 5000 ) ;
	/*
	document.formu.action='ResumeUpload.php' ;
	document.formu.encoding=  'multipart/form-data' ;
	document.formu.submit();
	*/
}
function clig( id , tim){
	document.getElementById(id).style.visibility == 'hidden' ?
		document.getElementById(id).style.visibility = 'visible' :
		document.getElementById(id).style.visibility = 'hidden'  ;
	setTimeout( "clig('"+id+"',"+tim+") ;" , tim ) ; 
}
function limite(zone,max) 
{ 
if(zone.value.length>=max){zone.value=zone.value.substring(0,max);} 
} 