function sendJobForm(){
	//fckeditor tweak
	var oEditorShort = FCKeditorAPI.GetInstance('description');
	document.getElementById('description').value = oEditorShort.EditorDocument.body.innerHTML;
	
	var oEditorShort = FCKeditorAPI.GetInstance('qualification');
	document.getElementById('qualification').value = oEditorShort.EditorDocument.body.innerHTML;
	
	var oEditorShort = FCKeditorAPI.GetInstance('avantages');
	document.getElementById('avantages').value = oEditorShort.EditorDocument.body.innerHTML;
	
	processForm('fJob', location.href+"?caAction=sendToDB&validate=true", null, function(rAct){
		if (rAct.readyState == 4 && rAct.status == 200){
					
			var fJob = document.getElementById('fJob');
			if(rAct.responseText.indexOf('erreur') == -1)
				fJob.submit();
			else{
				var results = document.getElementById('caResults');
				results.innerHTML = rAct.responseText;
			}
		}
	});
}

function sendCand(id){
	
	var results = document.getElementById('caResults');
	processForm('fCand', selfUrl+"?caAction=sendCand&id="+id, results, fillContainer);
}

function setDate(value){
	var hDate = document.getElementById(curDateId);
	hDate.value = value;
}

function modifyJob(id){
	location.href = AddModURL+"?caAction=editJob&id="+id;
}

function delJob(id){
	if (id == 18)
		alert('Vous ne pouvez pas effacer le poste \'Générale\'')
	else{
		location.href = selfUrl+"?caAction=delJob&id="+id;
	}
}

function delCand(id){
	var candInfos = document.getElementById('candInfos');

	getInfos(selfUrl+"?caAction=delCand&id="+id, candInfos, fillContainer);
	
}

function showApplyForm(id){
	
	var jobInfos = document.getElementById('jobInfos');
	getInfos(selfUrl+"?caAction=apply&id="+id, null, function(rAct){
		if (rAct.readyState == 4 && rAct.status == 200){
			dhtmlHistory.add("apply", rAct.responseText);
			jobInfos.innerHTML = rAct.responseText;
		}
	});
}

function showJob(id){
	
	var jobInfos = document.getElementById('jobInfos');
	if (jobInfos == null){
		alert('SVP ajouter l\'element "jobInfos" à l\'endroit où vous voulez les formulaires');
	}
	else{
		getInfos(selfUrl+"?caAction=showJob&id="+id, null, function(rAct){
			if (rAct.readyState == 4 && rAct.status == 200){
				histOldData = jobInfos.innerHTML;
				dhtmlHistory.add("showJob", rAct.responseText);
				jobInfos.innerHTML = rAct.responseText;
			}
		});
	}
}

function systemHist(newLocation, historyData) {
	
	if (newLocation == ""){
		var jobInfos = document.getElementById('jobInfos');
		var candInfos = document.getElementById('candInfos');
		
		if (typeof histOldData == "undefined")
			location.href = selfUrl;
		else if (jobInfos != null)
			jobInfos.innerHTML = histOldData;
		else if (candInfos != null)
			candInfos.innerHTML = histOldData;
	}
	else if (newLocation == 'showJob' || newLocation == 'apply')
	{
		var jobInfos = document.getElementById('jobInfos');
		jobInfos.innerHTML = historyData;
	}
	else if (newLocation == 'showCands'){
		var candInfos = document.getElementById('candInfos');
		candInfos.innerHTML = historyData;
	}
	
}

function showCandsList(id){
	
	var candInfos = document.getElementById('candInfos');
	if (candInfos == null){
		alert('SVP ajouter l\'element "candInfos" a l\'endroit ou vous voulez le listing des candidatures');
	}
	else{
		getInfos(selfUrl+"?caAction=showJobCands&id="+id, null, function(rAct){
			if (rAct.readyState == 4 && rAct.status == 200){
				histOldData = candInfos.innerHTML;
				candInfos .innerHTML =  rAct.responseText;
				dhtmlHistory.add("showCands", rAct.responseText);
			}
			
		});
	}
}