function no_cache()
{
	date_object = new Date();
	var param = date_object.getTime();
	return param;
}

function AjaxObject()
{
	if(window.XMLHttpRequest)
	{
		xhr_object = new XMLHttpRequest();
		return xhr_object;
	}
	else if(window.ActiveXObject)
	{
		xhr_object = new ActiveXObject('Microsoft.XMLHTTP');
		return xhr_object;
	}
	else
	{ 
		alert('Votre navigateur ne supporte pas les objets XMLHTTPRequest...');
		return;
	}
}

function checkFormAnnonce()
{
	if(document.getElementById('id_recruteur'))
	{
		if(document.getElementById('id_recruteur').value != 0 || document.getElementById('id_recruteur').value != "")
		{
			document.getElementById('add_annonce').submit();
		}
		else
		{
			alert("Vous devez indiquer un recruteur !");
		}
	}
	else
	{
		alert("Vous devez indiquer un recruteur !");
	}
}

function paysFilter(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('region_ville').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/ajax/select_region_ville/' + pays ,true);
	xhr_object.send(null);
}

function choixTypeSShome(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('choix_type').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/select_ss_home/' + pays ,true);
	xhr_object.send(null);
}



function choixTypeAnnonce(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('type_annonce').innerHTML = reponse;
			choixBlocMandat(pays);
		}
	}
	xhr_object.open('GET','/admin/ajax/type_annonce/' + pays ,true);
	xhr_object.send(null);
}

function choixBlocMandat(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('bloc_mandat').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/bloc_mandat/' + pays ,true);
	xhr_object.send(null);
}

function choixTypeSociete(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('type_societe').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/type_societe/' + pays ,true);
	xhr_object.send(null);
}

function choixTypeCabinet(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('type_cabinet').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/type_cabinet/' + pays ,true);
	xhr_object.send(null);
}

function choixTypeMandataire(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('type_mandataire').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/type_mandataire/' + pays ,true);
	xhr_object.send(null);
}

function choixTypeAide(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('choix_type').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/select_aide/' + pays ,true);
	xhr_object.send(null);
}

function choixBlocSShome(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('choix_bloc').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/select_ss_home2/' + pays ,true);
	xhr_object.send(null);
}

function choixTypeVideo(pays)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('choix_type').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/up_video/' + pays ,true);
	xhr_object.send(null);
}

function visu_cam(id)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('cam_ajax').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/ajax/visu_cam/' + id ,true);
	xhr_object.send(null);
}

function choix_cv(id,recherche)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			
		}
	}
	xhr_object.open('GET','/ajax/choix_cv/' + id + '/' + recherche ,true);
	xhr_object.send(null);
}

function reco_cam(id)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('cam_ajax').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/ajax/reco_cam/' + id ,true);
	xhr_object.send(null);
}

function socCabinet(cab)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('soc_cab').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/select_soc_cab/' + cab ,true);
	xhr_object.send(null);
}

function aboRecrut(abo)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('recrut_abo').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/admin/ajax/recrut_abo/' + abo ,true);
	xhr_object.send(null);
}

function ajoutSelectionCandidat(id_candidat,id_annonce)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
		}
	}
	xhr_object.open('GET','/ajax/add_select_candidat/' + id_candidat + '/' + id_annonce ,true);
	xhr_object.send(null);
}

function ajoutSelectionRecruteur(id_recruteur,id_recherche)
{
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState != 4) 
		{
			
		}
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
		}
	}
	xhr_object.open('GET','/ajax/add_select_recruteur/' + id_recruteur + '/' + id_recherche ,true);
	xhr_object.send(null);
}

function changeMois(mois,annee)
{	
	xhr_object = AjaxObject();
	var param = no_cache();
	xhr_object.onreadystatechange = function()
	{
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('calendrier').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/ajax/calendrier/' + mois + '/' + annee ,true);
	xhr_object.send(null);
	
	return false;
}

function changeVote(nb,url)
{
	if(nb>0)
	{
		for (i=1; i<=nb; i++) 
		{
			var tmp = 'vote'+i;
			document.getElementById(tmp).src = url + '/images/star-on.png';
		}
	}
	nb = parseInt(nb)+1;
	for (j=nb; j<=5; j++) 
	{
		var tmp = 'vote'+j;
		document.getElementById(tmp).src = url + '/images/star-off.png';
	}
}

function changeAdequation(nb,url,id)
{
	if(nb>0)
	{
		for (i=1; i<=nb; i++) 
		{
			var tmp = 'vote'+i+'_'+id;
			document.getElementById(tmp).src = url + '/images/star2-on.png';
		}
	}
	nb = parseInt(nb)+1;
	for (j=nb; j<=5; j++) 
	{
		var tmp = 'vote'+j+'_'+id;
		document.getElementById(tmp).src = url + '/images/star2-off.png';
	}
}

function adequation(note,id_poste,id_cv)
{	
	xhr_object = AjaxObject();
	var param = no_cache();
	
	xhr_object.onreadystatechange = function()
	{
		if(xhr_object.readyState == 4 && xhr_object.status == 200)
		{
			var reponse = xhr_object.responseText;
			document.getElementById('adequation').innerHTML = reponse;
		}
	}
	xhr_object.open('GET','/ajax/adequation/' + note + '/' + id_poste + '/' + id_cv ,true);
	xhr_object.send(null);
	
	return false;
}
function afficheRech(idRbtn)
{
if (idRbtn.id == "ouiClt")

document.getElementById('complement').style.display="inline";

else if (idRbtn.id == "nonClt")
document.getElementById('complement').style.display="none";


}
function cacheCalendrier() {
	
		if(document.getElementById('selectAll').checked)
		{
		document.getElementById('calendrierExtraction').style.display="none";
		document.getElementById('checkCache').style.cssFloat="left";
		}
		else{
				document.getElementById('calendrierExtraction').style.display="inline";
				document.getElementById('checkCache').style.cssFloat="right";
				}
}

