function CanviCaptcha(width,height)
{
	document.getElementById('imgcaptcha').innerHTML = "<img src='captcha.php?void=" + Math.ceil(Math.random()*100) + "' width='" + width + "' height='" + height + "' vspace='0' align='absmiddle'>";
}
function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	  {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  return new XMLHttpRequest();
	  }
	if (window.ActiveXObject)
	  {
	  // code for IE6, IE5
	  return new ActiveXObject("Microsoft.XMLHTTP");
	  }
	return null;
}
function TaulaFormacioAcademica(idContingut)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	xmlhttp.open("GET","http://www.imancorp.es/admin/ajax/getFormacio.php?idContingut=" + idContingut,true);
	xmlhttp.send(null);
	return true;
}
function TaulaExperienciaLaboral(idContingut)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	xmlhttp.open("GET","http://www.imancorp.es/admin/ajax/getExperiencia.php?idContingut=" + idContingut,true);
	xmlhttp.send(null);
	return true;
}
function TaulaIdiomes(idContingut)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	xmlhttp.open("GET","http://www.imancorp.es/admin/ajax/getIdiomes.php?idContingut=" + idContingut,true);
	xmlhttp.send(null);
	return true;
}

function ResetFormulari(quin)
{
	if(quin == "formacio")
	{
		document.getElementById('nom_formacio').value = '';
		document.getElementById('formacio_dataInici').value = '';
		document.getElementById('formacio_dataFi').value = '';
		document.getElementById('idRegistreFormacio').value = '';
	}
	if(quin == "idiomes")
	{
		document.getElementById('idioma_idioma').value = '';
		document.getElementById('idioma_nivell').value = '';
		document.getElementById('idRegistreIdioma').value = '';
	}
	if(quin == "experiencia")
	{
		document.getElementById('experiencia_nom_empresa').value = '';
		document.getElementById('experiencia_carrec').value = '';
		document.getElementById('experiencia_dataInici').value = '';
		document.getElementById('experiencia_dataFi').value = '';
		document.getElementById('experiencia_descripcio').value = '';
		document.getElementById('idRegistreExperiencia').value = '';
	}
}
function SaveFormation(idContingut)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	nom_formacio = document.getElementById('nom_formacio').value;
	formacio_dataInici = document.getElementById('formacio_dataInici').value;
	formacio_dataFi = document.getElementById('formacio_dataFi').value;
	idRegistreFormacio = document.getElementById('idRegistreFormacio').value;
	var url = "http://www.imancorp.es/admin/ajax/save.php?type=formacio&nom_formacio=" + nom_formacio + "&formacio_dataInici=" + formacio_dataInici + "&formacio_dataFi=" + formacio_dataFi + "&idRegistreFormacio=" + idRegistreFormacio + "&idContingut=" + idContingut;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function DeleteFormation(idRegistre)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/delete.php?type=formacio&idRegistre=" + idRegistre + "&idContingut=contingutFormacio";
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function EditFormation(idRegistre)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/edit.php?type=formacio&idRegistreFormacio=" + idRegistre;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function SaveExperience(idContingut)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	experiencia_nom_empresa = document.getElementById('experiencia_nom_empresa').value;
	experiencia_carrec = document.getElementById('experiencia_carrec').value;
	experiencia_dataInici = document.getElementById('experiencia_dataInici').value;
	experiencia_dataFi = document.getElementById('experiencia_dataFi').value;
	experiencia_descripcio = document.getElementById('experiencia_descripcio').value;
	idRegistreExperiencia = document.getElementById('idRegistreExperiencia').value;
	var url = "http://www.imancorp.es/admin/ajax/save.php?type=experiencia&experiencia_nom_empresa=" + experiencia_nom_empresa + "&experiencia_carrec=" + experiencia_carrec + "&experiencia_dataInici=" + experiencia_dataInici + "&experiencia_dataFi=" + experiencia_dataFi + "&experiencia_descripcio=" + experiencia_descripcio + "&idRegistreExperiencia=" + idRegistreExperiencia + "&idContingut=" + idContingut;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function DeleteExperience(idRegistre)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/delete.php?type=experiencia&idRegistre=" + idRegistre + "&idContingut=contingutExperiencia";
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function EditExperience(idRegistre)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/edit.php?type=experiencia&idRegistreExperiencia=" + idRegistre;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function SaveLang(idContingut)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	idioma_idioma = document.getElementById('idioma_idioma').value;
	idioma_nivell = document.getElementById('idioma_nivell').value;
	idRegistreIdioma = document.getElementById('idRegistreIdioma').value;
	var url = "http://www.imancorp.es/admin/ajax/save.php?type=idioma&idioma_idioma=" + idioma_idioma + "&idioma_nivell=" + idioma_nivell + "&idRegistreIdioma=" + idRegistreIdioma + "&idContingut=" + idContingut;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function DeleteLang(idRegistre)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/delete.php?type=idioma&idRegistre=" + idRegistre + "&idContingut=contingutIdiomes";
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function EditLang(idRegistre)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/edit.php?type=idioma&idRegistreIdioma=" + idRegistre;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function InscriureOferta(idOferta,idContingut)
{
	//lon();
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/inscriure_oferta.php?idOferta=" + idOferta + "&idContingut=" + idContingut;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
function SendNewPwd(email_recordar,idContingut)
{
	var xmlhttp=GetXmlHttpObject();
	if(xmlhttp==null) { alert("El navegador no soporta AJAX"); }
	xmlhttp.onreadystatechange = function()
	{
		if (xmlhttp.readyState == 4)
		{
			var resposta = xmlhttp.responseText;
			eval(resposta);
			//loff();
		};
	}
	
	var url = "http://www.imancorp.es/admin/ajax/recordar_contrasenya.php?email_recordar=" + email_recordar + "&idContingut=" + idContingut;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
	return true;
}
