//------------------------------------------function formumlaire client / permet d'appeler derrière bouton (demande) les pages html------------------------------------------------------------------
function Goto() {
 window.location.href = "javascript:AXOpenWindow('demande_simplifiee.htm', 'ddes', '794', '397', 'no', 'no', 'no', 'no')";}


function Goto2() {
 window.location.href ="javascript:AXOpenWindow('demande_complete.htm', 'ddec', '817', '400', 'yes', 'no', 'no', 'no')";}


function Goto3() {
 window.location.href = "confirmation_envoi.htm";}

function Goto4() {
 window.location.href = "confirmation_envoi2.htm";}


//------------------------------------------function mouseover - homepage - bloc domaines d'expertise------------------------------------------------------------------





function displayimage(id,newSrc) {
    if (document.images) {
        document.images[id].src = eval(newSrc+".src");
        }
}


//-----------------------------------------function show metiers de la cible---------------------------------------------------------


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



var refer=true;
function show(id) {
  document.all[id].style.visibility="visible";
  refer=false;


}
function hide(id){
  document.all[id].style.visibility="hidden";
  refer=true;
}
//-----------------------------------------function sous_menu---------------------------------------------------------

/* fonctions elementaires pour les menus: */
  function montre(id) {
	  if (document.getElementById) {
		  document.getElementById(id).style.visibility="visible";
		} else if (document.all) {
		  document.all[id].style.visibility="visible";
		} else if (document.layers) {
		  document.layers[id].visibility="visible";
		} } 
		
    function cache(id) {
	  if (document.getElementById) {
		  document.getElementById(id).style.visibility="hidden";
		} else if (document.all) {
		  document.all[id].style.visibility="hidden";
		} else if (document.layers) {
		  document.layers[id].visibility="hidden";
		} }
		
/* fonctions de "haut niveau" pour les menus*/
		function montre_menu(num) {  
			/* num = numero du menu. Il faut montrer le fond, puis les ecritures */
			cache_tout();			
			montre_menu2(num);
			}
		function montre_menu2(num) {  
			/* num = numero du menu. Il faut montrer le fond, puis les ecritures */
			montre("smf"+num.toString());
			montre("contents"+num.toString());
			}
		function cache_menu(num) {
			cache("smf"+num.toString());
			cache("contents"+num.toString());
			}
		 function cache_tout() {
				for (var i=1; i<5 ; i++) { cache_menu(i) ; }
			}
				

//-----------------------------------------function permettant de cacher le curseur ou modifier le curseur---------------------------------------------------------


//-----------------------------------------function lancement popup---------------------------------------------------------


function AXOpenWindow(url, title, width, height, scrollbars, menu, status, resize)
{
	newwindowa = window.open(url, title, 'width=' + width + ',height=' + height + ',directories=no,menubar=' + menu + ',toolbar=no,status='+status+',resize='+resize+',scrollbars=' + scrollbars);
}
	


function Reload()
{
window.location = window.location;
}

function GotoHP()
{
window.location = "http://www.pluscadres.com";
}

//--------------------- function pour les metiers -------------//

function interim_cadre_Metiers(FormName, Metier){

	window.document.body.style.cursor  = "wait";
	document.forms[FormName].Metiers.value=Metier; 
	searchDocuments(FormName);
}
function interim_cadre_Recherche(FormName){

window.document.body.style.cursor  = "wait";
document.forms[FormName].Metiers.value="0"; 
searchDocuments(FormName);
}

function searchDocuments(FormName)
{	
	var doc = document.forms[FormName];
	var FinURL = "&SearchOrder=4";
	var DebutURL = "&Query=";
	var queryVide = "[Form]=Annonce"
	var MedURL = "";
	var MedURLDT = "";
	var MedURLDept = "";
	var MedURLType = "";
	var URL = "";
	var temp = "";
	var db = window.location.pathname;
	//var firstpart  = db.split(".nsf");
	//var dbpath = firstpart[0] + ".nsf";
	var dbpath = "../../agmc/agmcannonce.nsf";
     var AnCadre = "1";

	if (doc.Metiers.value !="0") {	
		MedURL = "([AnGroupeCategCadre]+Contains+\""+ doc.Metiers.value + "\")"
		doc.Metiers.value= "0";

	} else {
		if (doc.QUFullText.value != "") {
			temp = doc.QUFullText.value;
			doc.QUFullText.value = "";
			MedURL = "([ANRecherche]+Contains+\""+temp + "\")"
			/*
			MedURL = "([ANTitre]+Contains+\""+temp + "\""
               MedURL += "+OR+[ANLibelle]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANCompetences]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANDuree]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANActiviteClient]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANType]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANCategorie]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANLieu]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANRemuneration]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANContact]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANSecteurGeo]+Contains+\""+temp + "\""
			MedURL += "+OR+[ANRef]+Contains+\""+temp+"\")";		
			*/
		}
		for(var i = 0; i <doc.Departements.length;i++) {
			if (doc.Departements[i].selected){
				if (doc.Departements[i].value == "99") {
					MedURLDept = "";
					break;
				}
				if (doc.Departements[i].value == "R1") {
					MedURLDept = "([ANRegion]=\"Ile-de-France\")";
					break;
				}
				if (doc.Departements[i].value == "R2") {
					MedURLDept = "([ANRegion]=\"Rhones-Alpes\")";
					break;
				}
				if (doc.Departements[i].value == "R3") {
					MedURLDept = "([ANRegion]=\"Autres Regions\")";
					break;
				}
				if (doc.Departements[i].value == "R4") {
					MedURLDept = "([ANRegion]=\"Autres Pays\")";
					break;
				}
				MedURLDept = "([ANdeptCode]=\""+doc.Departements[i].value+"\")";
				break;
			}
		}
		doc.Departements.value = 99
	}
	
	//if (doc.QUInterim.checked){	
		//MedURLType = "([ANDuree] CONTAINS NOT\"CDI\")";
		//doc.QUInterim.checked = false;
	//}
	//if (doc.QUCDI.checked){
		//MedURLType = "([ANDuree] CONTAINS \"CDI\")";
		//doc.QUCDI.checked = false;
	//}
	MedURLType=""
	if (MedURLType == "" && MedURLDept =="") {
		MedURLDT = "";
	}
	if (MedURLType != "" && MedURLDept =="") {	
		MedURLDT = MedURLType;	
	}		
	if (MedURLType == "" && MedURLDept !="") {
		MedURLDT = MedURLDept;
	}
	if (MedURLType != "" && MedURLDept !="") {	
		MedURLDT= MedURLDept +" And "+ MedURLType;	
	}
	if (MedURL == "" && MedURLDT =="") {
		temp = doc.URL.value + DebutURL + queryVide+FinURL;
		URL = doc.URL.value + DebutURL + escape(queryVide)+FinURL;
	} else {
		if (MedURL != "" && MedURLDT =="" ) {
			temp = URL = doc.URL.value + DebutURL + MedURL +FinURL;
			URL = doc.URL.value + DebutURL + escape(MedURL) +FinURL;
		}
		if (MedURL == "" && MedURLDT !="" ) {
			temp = doc.URL.value + DebutURL + MedURLDT +FinURL;
			URL = doc.URL.value + DebutURL + escape(MedURLDT) +FinURL;
		}
		if (MedURL != "" && MedURLDT !="" ) {
			temp = doc.URL.value + DebutURL + MedURL +" And "+ MedURLDT+FinURL;
			URL = doc.URL.value + DebutURL + escape(MedURL) +" And "+ escape(MedURLDT) +FinURL;
		}
	}
	//alert(URL);

	window.open("/"+doc.FilePath.value+URL,"_top");
}
function envoyerFAQ(FormName){
var message = ""
if (document.forms[FormName].nom.value=="") {
message = " * Le champ Nom est obligatoire";
document.forms[FormName].nom.focus();
}

if (document.forms[FormName].email.value=="") {
if (message == "")  {
message = " * Le champ E-mail est obligatoire"; 
document.forms[FormName].email.focus();
}
else {
message = message + "\n" + " * Le champ E-mail est obligatoire";
}
}

if (message != "" ) {
alert(message);
return false;
} else {
envoiDocuments(FormName);
}
}
function envoiDocuments(FormName)
	{
		document.forms[FormName].SaveOptions.value='0';
		document.forms[FormName].submit();
	}
