function asigna_candidat_compra_bustia(id_candidat)
{
	
	var estado=document.getElementById(id_candidat);
	if(estado.checked==true)
	{
		
		xajax_asigna_candidat(id_candidat,'1','1');
	
	}
	else
	{
		xajax_asigna_candidat(id_candidat,'0','1');
	
	}
	
}
function asigna_candidat_compra_cercador(id_candidat)
{
	
	var estado=document.getElementById(id_candidat);
	if(estado.checked==true)
	{
		
		xajax_asigna_candidat(id_candidat,'1','2');
	
	}
	else
	{
		xajax_asigna_candidat(id_candidat,'0','2');
	
	}
	
}
function asigna_candidat_compra_ofertes(id_candidat)
{
	
	var estado=document.getElementById(id_candidat);
	if(estado.checked==true)
	{
		
		xajax_asigna_candidat(id_candidat,'1','3');
	
	}
	else
	{
		xajax_asigna_candidat(id_candidat,'0','3');
	
	}
	
}
function view_div_warning()
{
	document.getElementById("warningUsuari_2").style.visibility="visible";
}
function warningOferta()
{
	window.opener.document.location='controller.php?page=RegistreCandidatAction';
	window.close();
}
function hideWarning_2()
{
	document.getElementById("warningUsuari_2").style.visibility="hidden";
}
function asigna_rss(msg1,msg2)
{
	var provincia_rss=document.rss.provincia_ofertes.value;
	var categoria_rss=document.rss.categoria_laboral_ofertes.value;
	document.getElementById("rss_info").innerHTML=msg1;
	document.getElementById("rss_info2").innerHTML=msg2;
	document.getElementById("rss_text").innerHTML="http://www.cv10.es/rss.php?idp="+provincia_rss+"&idc="+categoria_rss;
	document.getElementById("google_rss").innerHTML="<a href='http://fusion.google.com/add?feedurl=http://www.cv10.es/rss.php?idp="+provincia_rss +"&idc="+categoria_rss+"'><img src='templates/default/images/img/google.bmp' border=0/></a>";
	document.getElementById("yahoo_rss").innerHTML="<a href='http://add.my.yahoo.com/rss?url=http://www.cv10.es/rss.php?idp="+provincia_rss +"&idc="+categoria_rss+"'><img src='templates/default/images/img/yahoo.bmp'border=0/></a>";
	document.rss.link_rss.value="http://www.cv10.es/rss.php?idp="+provincia_rss + "&idc=" + categoria_rss;
}
function desplegar_buscador(desplegar,plegar)
{
		 document.getElementById("resultatsPortada").style.visibility="hidden";
		
			document.getElementById("cerca_portada").style.height="700px";
		
		document.getElementById("desplega_cercador_portada").innerHTML="<div class='fletxa_plegable pointer' onclick=\"plegar_buscador('"+ desplegar + "','"+plegar+"');\">"+plegar+"</div><div class='img_fletxa_desplegable_bottom pointer'  onclick=\"plegar_buscador('"+ desplegar + "','"+plegar+"');\"></div>";

}
function plegar_buscador(desplegar,plegar)
{
		document.getElementById("resultatsPortada").style.visibility="visible";
		document.getElementById("desplega_cercador_portada").innerHTML="<div class='fletxa_desplegable pointer' onclick=\"desplegar_buscador('"+ desplegar + "','"+plegar+"');\">"+desplegar+"</div><div class='img_fletxa_desplegable_top pointer'  onclick=\"desplegar_buscador('"+ desplegar + "','"+plegar+"');\"></div>";
		document.getElementById("cerca_portada").style.height="85px";

}
function hideWarning()
{
	document.getElementById("warningUsuari").style.visibility="hidden";
}
function CompraCandidatPopup(id,tipo)
{
	//opener.document.compraCandidat.reset();
	var e=opener.document.getElementById(id);
	//e.checked=true;
	
	if(document.createEvent) 
	{
		
		var evObj = document.createEvent('MouseEvents');
		evObj.initEvent('click',true,true);
		e.dispatchEvent(evObj);
		//CompraCandidatPopup_2(tipo);
		setTimeout ("CompraCandidatPopup_2('"+tipo + "');", 2000); 
		//return false;
	}
	else if(document.createEventObject) {
		e.checked=true;
		e.fireEvent('onclick');
		//CompraCandidatPopup_2(tipo);
		setTimeout ("CompraCandidatPopup_2('"+tipo + "');", 2000); 
		//return false;
	}
	else {
			
		e.click();
		//CompraCandidatPopup_2(tipo);
		setTimeout ("CompraCandidatPopup_2('"+tipo + "');", 2000); 
		//return false;
	}
	
		
	//opener.document.compraCandidat.getElementById(id).checked=true;
	
}
function CompraCandidatPopup_2(tipo)
{
		
		var e=opener.document.getElementById(tipo);
		if(document.createEvent) 
		{
			var evObj = document.createEvent('MouseEvents');
			evObj.initEvent('click',true,true);
			e.dispatchEvent(evObj);
			//return false;
		}
		else if(document.createEventObject) {
			e.fireEvent('onclick');
			
			//return false;
		}
		else {
			e.click();
			//return false;
		}
		window.close();	
}
function estatEntrevista(id,tipo)
{
	xajax_cambiaEntrevista(id,tipo);
}
function tarifes_planes(formu,texto_error)
{
	var tipo_tarifa;
	var tipo;
	var preu_tarifa;
	var check_valor=document.getElementsByName("tarifes");
	tipo=0;
	for (var x=0; x < check_valor.length; x++) 
	{
		if(check_valor[x].checked==true)
			tipo=check_valor[x].value;
	}
	if(tipo>0)
	{
		
		if(tipo==1)
		{
			tipo_tarifa="pack 1cv";
			preu_tarifa="767";
		}
		else if(tipo==2)
		{
			tipo_tarifa="pack 5cv";
		preu_tarifa="3540";
		}
		else if(tipo==3)
		{
			tipo_tarifa="pack 10cv";
			preu_tarifa="5900";
		}
		else if(tipo==4)
		{
			tipo_tarifa="Tarifa plana 3 mesos";
			preu_tarifa="10030";
		}
		else if(tipo==5)
		{
			tipo_tarifa="Tarifa plana 6 mesos";
			preu_tarifa="15930";
		}
		else if(tipo==6)
		{
			tipo_tarifa="Tarifa plana 1 any";
			preu_tarifa="26550";
		}
		if(tipo_tarifa!="")
		{
			if(formu=="tcredit")
			{
				document.tcredit.tarifa.value=tipo_tarifa;
				document.tcredit.preu_tarifa.value=preu_tarifa;
				if(tipo==1 || tipo==2 || tipo==3)
				{
					document.tcredit.tipus.value="cvs";
					if(tipo==1)
						document.tcredit.ncvs.value="1";
					if(tipo==2)
						document.tcredit.ncvs.value="5";
					if(tipo==3)
						document.tcredit.ncvs.value="10";
				}
				else
				{
					document.tcredit.tipus.value="planas";
					
				}
				document.tcredit.submit();
			}
			if(formu=="ttransfer")
			{
				document.ttransfer.tarifa.value=tipo_tarifa;
				document.ttransfer.submit();
			}
			if(formu=="tdomi")
			{
				document.tdomi.tarifa.value=tipo_tarifa;
				document.tdomi.submit();
			}
		}
	}
	else
	{
		alert(texto_error);	
	}
	
}
function link_principal()
{
	var url_cv10=location.pathname;
	var url_cv10=url_cv10.substr(1,8);
	if(url_cv10=="cv10_new")
		url_cv10="http://www.cv10.es/cv10_new/";
	else
		url_cv10="http://www.cv10.es/";
	window.location.href=url_cv10;
}
function alert_oferta(mensaje)
{
	alert(mensaje);
}
function texto_cajas_form(texto_user,texto_pass)
{
		if(document.getElementById('usuari').value==texto_user)
		{
			document.getElementById('usuari').value="";
			document.getElementById('usuari').style.color="#666666";

		}
		if(document.getElementById('password').value==texto_pass)
		{
			document.getElementById('password').value="";
			document.getElementById('pass_treballador').innerHTML="<input type='password' id='password' name='password' class=inputFormTreballador tabIndex=2>";
			document.getElementById('password').style.color="#666666";
		}
		if(document.getElementById('usuari2').value==texto_user)
		{
			document.getElementById('usuari2').value="";
			document.getElementById('usuari2').style.color="#666666";

		}
		if(document.getElementById('password2').value==texto_pass)
		{
			document.getElementById('password2').value="";
			document.getElementById('pass_empresa').innerHTML="<input type='password' id='password2' name='password2' class=inputFormTreballador tabIndex=4>";
			document.getElementById('password2').style.color="#666666";
			
		}
}
function texto_cajas_form_normal(texto_user,texto_pass)
{
		if(document.getElementById('usuari').value=="" && document.getElementById('password').value=="")
		{
			document.getElementById('pass_treballador').innerHTML="<input type='text' id='password' name='password' class=inputFormTreballador tabIndex=2>";
			document.getElementById('usuari').value=texto_user;
			document.getElementById('usuari').style.color="#999999";
			document.getElementById('password').value=texto_pass;
			document.getElementById('password').style.color="#999999";
			
			
		}
		if(document.getElementById('usuari2').value=="" && document.getElementById('password2').value=="")
		{
			document.getElementById('pass_empresa').innerHTML="<input type='text' id='password2' name='password2' class=inputFormTreballador tabIndex=4>";
			document.getElementById('usuari2').value=texto_user;
			document.getElementById('usuari2').style.color="#999999";
			document.getElementById('password2').value=texto_pass;
			document.getElementById('password2').style.color="#999999";
			

		}
}
function texto_cajas(salari,horari,contracte,altres,experiencia,lloc_treball)
{
	 var rd=document.getElementById("salari").value;
	 if(rd.substr(0,2)=="")
	 {
		document.getElementById("salari").value=salari;
		document.getElementById("salari").style.color="#666666";
	 }
	 var rs=document.getElementById("horari").value;
	 if(rs.substr(0,2)=="")
	 {
		document.getElementById("horari").value=horari;
		document.getElementById("horari").style.color="#666666";
	 }
	
	var rt=document.getElementById("contracte").value;
	 if(rt.substr(0,2)=="")
	 {
		document.getElementById("contracte").value=contracte;
		document.getElementById("contracte").style.color="#666666";
	 }
	  var ru=document.getElementById("altres").value;
	 if(ru.substr(0,2)=="")
	 {
		document.getElementById("altres_requisits").value=altres;
		document.getElementById("altres_requisits").style.color="#666666";
	 }
	  var rv=document.getElementById("experiencia").value;
	 if(rv.substr(0,2)=="")
	 {
		document.getElementById("experiencia").value=experiencia;
		 document.getElementById("experiencia").style.color="#666666";
	 }
	  var rw=document.getElementById("lloc_treball").value;
	 if(rw.substr(0,2)=="")
	 {
		document.getElementById("lloc_treball").value=lloc_treball;
		document.getElementById("lloc_treball").style.color="#666666";
	 }
	 
}

function texto_cajas_relleno(tipo,texto)
{
	 var rd=document.getElementById(tipo).value;
	 if(rd.substr(0,2)=="")
	 {
			document.getElementById(tipo).value=texto;
		document.getElementById(tipo).style.color="#666666";
	 }
}
function texto_cajas_vacios(tipo,texto)
{
	var rz=document.getElementById(tipo).value;
	
	if(rz.substr(0,2)=="ex")
	{
		document.getElementById(tipo).value="";
		document.getElementById(tipo).style.color="#000000";
	}
	if(rz.substr(0,8)=="Comunica")
	{
		document.getElementById(tipo).value="";
		document.getElementById(tipo).style.color="#000000";
	}
	if(rz.substr(0,6)=="Respon")
	{
		document.getElementById(tipo).value="";
		document.getElementById(tipo).style.color="#000000";
	}
}

function ofertas_div(data,treball,empresa,provincia,poblacio,posicio,valor)
{
	if(valor==1)
	{
		var capa="<div id='oferta_div'>	<table width='600' cellspacing=0 cellpadding=0 height=40><tr><td valign='top' width='200'><div class='textBlauOfertaNegreBold' id='treball_div_oferta'></div></td>";
		capa+="<td valign='top' width='10'><div class='textBlauOfertaNegre'></div></td>";
		capa+="<td valign='top' width='220'><div class='textBlauOfertaNegre' id='empresa_div_oferta'></div></td>";
		capa+="<td valign='top' width='10'><div class='textBlauOfertaNegre'></div></td>";
		capa+="<td valign='top' width='80'><div class='textBlauOfertaNegre' id='provincia_div_oferta'></div></td>";
		capa+="<td valign='top' width='80'><div class='textBlauOfertaNegre' id='poblacio_div_oferta'></div></td>";
		capa+="</tr></table><div>";
		
		
		
		
		//var capa="dsssss";
		document.getElementById(posicio).innerHTML=capa;
		document.getElementById(posicio).style.width="0px";
		document.getElementById(posicio).style.height="0px";
		document.getElementById("oferta_div").style.visibility = "visible";
		//var r=document.getElementById(posicio).style.marginTop-50;
		//document.getElementById(posicio).style.marginTop = r+'px';
		document.getElementById("treball_div_oferta").innerHTML=treball;
		document.getElementById("empresa_div_oferta").innerHTML=empresa;
		document.getElementById("provincia_div_oferta").innerHTML=provincia;
		document.getElementById("poblacio_div_oferta").innerHTML=poblacio;
	}
	if(valor==0)
	{

		//var newLayer=document.getElementById("oferta_div");
		//newLayer.parentNode.removeChild(newLayer); 
		document.getElementById("treball_div_oferta").innerHTML="";
		document.getElementById("empresa_div_oferta").innerHTML="";
		document.getElementById("provincia_div_oferta").innerHTML="";
		document.getElementById("poblacio_div_oferta").innerHTML="";
		document.getElementById("oferta_div").style.visibility = "hidden";
		document.getElementById(posicio).innerHTML="";
		document.getElementById(posicio).style.width="0px";
		document.getElementById(posicio).style.height="0px";
		
		//document.getElementById(posicio).style.marginTop="-50px";
		
		
	}
}
function comprarCandidatCredit(tipo,id,texto_salida,texto_error,noselect)
{
	
	//setTimeout ("CompraCandidatPopup_2('"+tipo + "');", 2000); 
	var check_compra=document.getElementsByName("array_sessio[]");
	//var check_compra=xajax_retorna_array_sessio();
	var url_compra=location.pathname;
	var total_url=url_compra.substr(1,8);
	if(total_url=="cv10_new")
		url_compra="http://www.cv10.es/cv10_new/";
	else
		url_compra="http://www.cv10.es/";
	//var check_compra=document.compraCandidat["compra[]"];
	//check_compra
	var check_preus=document.compraCandidat["preus[]"];
	var preuTotal=0;
	var marcados=0;

	if(check_compra[0])
	{
		for (var x=0; x < check_compra.length; x++) 
			{
	
				 if(check_compra[x].value!="")
				 {
						marcados++; 
				 }
				
			}
			
	}
	else
	{
		/*
		if(document.compraCandidat["compra[]"].checked==true)
		 {
			
			marcados++;
			var preu=parseInt(document.compraCandidat["preus[]"].value);
			preuTotal=preuTotal+preu;
					
		 }
		else
		{*/
			alert(noselect);	
		//}
	}
	var total_candidats=marcados;
	var total_cvs_empresa=document.getElementById("cvs_act").value;
	if(total_candidats>total_cvs_empresa && (tipo==1 || tipo==8 || tipo==10))
	{
		alert(texto_error);
	}
	else
	{
	//if(totalGratis>0)
		//var $salida="Cost Total: " + preuTotal + " " + totalGratis + " Currículum Gratis sense Cost";
	//else
		//var $salida="Cost Total: " + preuTotal;
	//if(confirm($salida))
	var x=document.forms.compraCandidat;
	
	if(tipo==1)
	{	
		if(total_candidats>0)
		{
			document.getElementById("enviar").value ="compraTpv";
			x.action=url_compra+"controller.php?page=CercaCvAction";
			document.compraCandidat.submit();
			
			
			//var compra_t=document.compraCandidat["compra[]"];
			
			//var url=document.compraTpv["Ds_Merchant_MerchantURL"].value;
			//xajax_salidaTpv(preuTotal,url);
			//alert(document.compraTpv["Ds_Merchant_MerchantSignature"].value);
			//var salida=xajax_CompraTpvTotal(preuTotal,document.compraTpv["Ds_Merchant_MerchantURL"].value);
			//document.compraTpv["Ds_Merchant_MerchantSignature"].value=salida;
			//alert(document.compraTpv["Ds_Merchant_MerchantSignature"].value);
			//document.compraTpv["Ds_Merchant_Amount"].value=preuTotal;
			//document.compraTpv.submit();
			//x.action="http://www.cv10.es/cv10_new/controller.php?page=CercaCvAction";
		}
	}
	if(tipo==8)
	{	
		if(total_candidats>0)
		{
			document.getElementById("enviar").value ="compraTpv";
			x.action=url_compra+"controller.php?page=OfertesAction";
			document.compraCandidat.submit();
			
			
			//var compra_t=document.compraCandidat["compra[]"];
			
			//var url=document.compraTpv["Ds_Merchant_MerchantURL"].value;
			//xajax_salidaTpv(preuTotal,url);
			//alert(document.compraTpv["Ds_Merchant_MerchantSignature"].value);
			//var salida=xajax_CompraTpvTotal(preuTotal,document.compraTpv["Ds_Merchant_MerchantURL"].value);
			//document.compraTpv["Ds_Merchant_MerchantSignature"].value=salida;
			//alert(document.compraTpv["Ds_Merchant_MerchantSignature"].value);
			//document.compraTpv["Ds_Merchant_Amount"].value=preuTotal;
			//document.compraTpv.submit();
			//x.action="http://www.cv10.es/cv10_new/controller.php?page=CercaCvAction";
		}
	}
	if(tipo==10)
	{	
		
		if(total_candidats>0)
		{
		
			document.getElementById("enviar").value ="compraTpv";
			x.action=url_compra+"controller.php?page=BustiaAction";
			document.compraCandidat.submit();
			
			
			//var compra_t=document.compraCandidat["compra[]"];
			
			//var url=document.compraTpv["Ds_Merchant_MerchantURL"].value;
			//xajax_salidaTpv(preuTotal,url);
			//alert(document.compraTpv["Ds_Merchant_MerchantSignature"].value);
			//var salida=xajax_CompraTpvTotal(preuTotal,document.compraTpv["Ds_Merchant_MerchantURL"].value);
			//document.compraTpv["Ds_Merchant_MerchantSignature"].value=salida;
			//alert(document.compraTpv["Ds_Merchant_MerchantSignature"].value);
			//document.compraTpv["Ds_Merchant_Amount"].value=preuTotal;
			//document.compraTpv.submit();
			//x.action="http://www.cv10.es/cv10_new/controller.php?page=CercaCvAction";
		}
	}
	if(tipo==2)
	{
		if(total_candidats>0)
		{
			document.getElementById("enviar").value ="afegeixFactura";
			x.action=url_compra+"controller.php?page=CercaCvAction";
			document.compraCandidat.submit();
		}
	}
	if(tipo==3)
	{
		if(total_candidats>0)
		{
		document.getElementById("enviar").value ="compraGratis";
		x.action=url_compra+"controller.php?page=CercaCvAction";
		document.compraCandidat.submit();
		}
		else
			alert(texto_salida);
	}
	if(tipo==6)
	{
		document.getElementById("enviar").value ="curriculumGratis";
		document.compraCandidat.curr_gratis.value=id;
		x.action=url_compra+"controller.php?page=CercaCvAction";
		document.compraCandidat.submit();
	}
	
	if(tipo==4)
	{
		if(total_candidats>0)
		{
		document.getElementById("enviar").value ="afegeixFactura";
		x.action=url_compra+"controller.php?page=OfertesAction";
		document.compraCandidat.submit();
		}
	}
	if(tipo==5)
	{
		
		if(total_candidats>0)
		{
		document.getElementById("enviar").value ="compraGratis";
		x.action=url_compra+"controller.php?page=OfertesAction";
		document.compraCandidat.submit();
		}
		else
			alert(texto_salida);
	}
	
	if(tipo==11)
	{
		if(total_candidats>0)
		{
		document.getElementById("enviar").value ="afegeixFactura";
		x.action=url_compra+"controller.php?page=BustiaAction";
		document.compraCandidat.submit();
		}
	}
	if(tipo==12)
	{
		
		if(total_candidats>0)
		{
		document.getElementById("enviar").value ="compraGratis";
		x.action=url_compra+"controller.php?page=BustiaAction";
		document.compraCandidat.submit();
		}
		else
			alert(texto_salida);
	}
	if(tipo==7)
	{
		document.getElementById("enviar").value ="curriculumGratis";
		document.compraCandidat.curr_gratis.value=id;
		x.action=url_compra+"controller.php?page=OfertesAction";
		document.compraCandidat.submit();
	}
	}
}
function sendTpv(tipo)
{
	if(tipo==1)
		document.compraTpv.submit();
}
function confirmProvincia(message)
{

	var index = document.dadesOferta.provincia.selectedIndex;
	var Provincia=document.dadesOferta.provincia[index].value;
	if(Provincia !="")
		document.dadesOferta.submit();
	else
		alert(message);
}
function confirmSubmit(idborrar)
{

if(confirm("Vols donar-te de baixa de l'oferta?"))
	window.location=document.URL+"&idb="+idborrar;
}
function confirmSubmit2(idborrar)
{

if(confirm("Vols eliminar l'oferta de feina?"))
	window.location=document.URL+"&idb="+idborrar;
}
function confirmSubmitBustia(idborrar)
{

if(confirm("Vols eliminar aquest currículum?"))
	window.location=document.URL+"&idb="+idborrar;
}
function confirmSubmitUser(idborrar,idoferta)
{

if(confirm("Vols eliminar aquest currículum?"))
	window.location=document.URL+"&idcb="+idborrar+"&ido="+idoferta;
}
function confirmSubmitForo(idborrar)
{

if(confirm("Vols eliminar el tema i tots els seus missatges?"))
	window.location=document.URL+"&idbf="+idborrar;
}
function modificarIdioma(id,idiomes,nivells,titol,altres)
{
	//var nodeMod = document.getElementById(id);
	
	var tt=document.getElementById('idiomes');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==idiomes)
			tt[i].selected=true;
	}
	//document.entraCv.programes.onchange();
	
	var tt=document.getElementById('nivells');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==nivells)
			tt[i].selected=true;
	}
	document.getElementById('titol').value=titol;
	var aEsborrar = document.getElementById(id);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);
	if(altres!="")
	{
		var salida_altres="<input type='text' name='AltresIdiomes' id='AltresIdiomes' value='" + altres + "'\>";
		document.getElementById('AltresIdiomesSpan').innerHTML=salida_altres;
	}
	else
	{
		document.getElementById('AltresIdiomesSpan').innerHTML="";
	}
}
function afegirIdioma()
{
	var index = document.getElementById('idiomes').selectedIndex;
	var idIdioma = document.getElementById('idiomes').options[index].value;
	var nomIdioma = document.getElementById('idiomes').options[index].firstChild.nodeValue;
	
	if(nomIdioma =="Altres" || nomIdioma =="Otros")
		var nomAlt = document.getElementById('AltresIdiomes').value;
	else
		var nomAlt="";
	
	var index = document.getElementById('nivells').selectedIndex;
	var idNivell = document.getElementById('nivells').options[index].value;
	var nomNivell = document.getElementById('nivells').options[index].firstChild.nodeValue;
	if(usuari == 'candidat')
	{
		var titol = document.getElementById('titol').value;
		//if(titol == '') titol = "Cap";
	}


var att_modificar="idio,"+"idioma"+idIdioma+","+idIdioma+","+idNivell+","+titol+","+nomAlt;

	var existeix = document.getElementById('idioma'+idIdioma);
	if(existeix == null)
	{
		if(usuari == 'candidat')
		{
			nomsHidden = new Array("idioma[]","nivell[]","titol[]","AltresIdiomes[]","ex_idioma");
			valorsHidden = new Array(idIdioma,idNivell,titol,nomAlt,idIdioma);
			if(nomIdioma =='Altres' || nomIdioma =="Otros")
			{	
				var div = crearElementDiv2('idioma'+idIdioma, att_modificar,nomAlt+" - "+nomNivell+" - "+titol+" ", nomsHidden, valorsHidden);
			}
			else
			{	
				var div = crearElementDiv2('idioma'+idIdioma, att_modificar,nomIdioma+" - "+nomNivell+" - "+titol+" ", nomsHidden,valorsHidden);
			}
			
		}
		else
		{
			nomsHidden = new Array("idioma[]","nivell[]");
			valorsHidden = new Array(idIdioma,idNivell);
			var div = crearElementDiv('idioma'+idIdioma, nomIdioma+" - "+nomNivell+" ", nomsHidden, valorsHidden)
		}
		
		var root = document.getElementById('idiomesUser');
		root.appendChild(div);
	}
}

function afegirIdiomaOfertes()
{
	var index = document.getElementById('idiomes').selectedIndex;
	var idIdioma = document.getElementById('idiomes').options[index].value;
	var nomIdioma = document.getElementById('idiomes').options[index].firstChild.nodeValue;

	var index = document.getElementById('nivells').selectedIndex;
	var idNivell = document.getElementById('nivells').options[index].value;
	var nomNivell = document.getElementById('nivells').options[index].firstChild.nodeValue;
	if(document.getElementById('idiomes_requisit').checked==true)
		var idIdiomaRequisit=1;
	else
		var idIdiomaRequisit=0;

	if(usuari == 'candidat')
	{
		var titol = document.getElementById('titol').value;
		if(titol == '') titol = "Cap";
	}

	var existeix = document.getElementById('idioma'+idIdioma);
	if(existeix == null)
	{
		nomsHidden = new Array("idioma[]","nivell[]","idioma_requisit[]","ex_idiomes");
		valorsHidden = new Array(idIdioma,idNivell,idIdiomaRequisit,idIdioma);
		if(document.getElementById('idiomes_requisit').checked==true)
			var div = crearElementDiv('idioma'+idIdioma, nomIdioma+" - "+nomNivell+" - requisit", nomsHidden, valorsHidden)
		else
			var div = crearElementDiv('idioma'+idIdioma, nomIdioma+" - "+nomNivell+" ", nomsHidden, valorsHidden)
		var root = document.getElementById('idiomesUser');
		root.appendChild(div);
	}
}

function afegirVehicle()
{
	var index = document.getElementById('vehicles').selectedIndex;
	var idVehicle = document.getElementById('vehicles').options[index].value;
	var nomVehicle = document.getElementById('vehicles').options[index].firstChild.nodeValue;
	var existeix = document.getElementById('vehicle'+idVehicle);
	if(document.getElementById('vehicles_requisit').checked==true)
		var idVehicleRequisit=1;
	else
		var idVehicleRequisit=0;
	if(existeix == null)
	{
		nomsHidden = new Array("vehicle[]","vehicle_requisit[]","ex_vehicle");
		valorsHidden = new Array(idVehicle,idVehicleRequisit,idVehicle);
		if(document.getElementById('vehicles_requisit').checked==true)
			var div = crearElementDiv('vehicle'+idVehicle, nomVehicle+" - requisit", nomsHidden, valorsHidden)
		else
			var div = crearElementDiv('vehicle'+idVehicle, nomVehicle, nomsHidden, valorsHidden)
		var root = document.getElementById('vehiclesUser');
		root.appendChild(div);
	}
}
function afegirCarnet()
{
	var index = document.getElementById('carnets').selectedIndex;
	var idCarnet = document.getElementById('carnets').options[index].value;
	var nomCarnet = document.getElementById('carnets').options[index].firstChild.nodeValue;
	var existeix = document.getElementById('carnet'+idCarnet);
	if(document.getElementById('carnets_requisit').checked==true)
		var idCarnetRequisit=1;
	else
		var idCarnetRequisit=0;
	if(existeix == null)
	{
		nomsHidden = new Array("carnet[]","carnet_requisit[]");
		valorsHidden = new Array(idCarnet,idCarnetRequisit);
		if(document.getElementById('carnets_requisit').checked==true)
			var div = crearElementDiv('carnet'+idCarnet, nomCarnet+" - requisit", nomsHidden, valorsHidden);
		else
			var div = crearElementDiv('carnet'+idCarnet, nomCarnet, nomsHidden, valorsHidden);
		var root = document.getElementById('carnetsUser');
		root.appendChild(div);
	}
}
function afegirEstudisEmpresa()
{
	var index = document.getElementById('nivellsEstudis').selectedIndex;
	var idNe = document.getElementById('nivellsEstudis').options[index].value;
	var nomNe = document.getElementById('nivellsEstudis').options[index].firstChild.nodeValue;
	if(idNe!=-1)
	{
		index = document.getElementById('titulacions').selectedIndex;
		var idTitol = document.getElementById('titulacions').options[index].value;
		var nomTitol = document.getElementById('titulacions').options[index].firstChild.nodeValue;
	}
	if(idNe!=-1)
		var existeix = document.getElementById('nivellEstudis'+idNe+idTitol);
	else
		var existeix = document.getElementById('nivellEstudis'+idNe);
	if(existeix == null)
	{
		if(idNe!=-1)
		{	
			nomsHidden = new Array("nivellEstudis[]","titulacio[]");
			valorsHidden = new Array(idNe,idTitol);
			var div = crearElementDiv('nivellEstudis'+idNe+idTitol, nomNe+" - "+nomTitol+" ", nomsHidden, valorsHidden)
		}
		else
		{
			nomsHidden = new Array("nivellEstudis[]");
			valorsHidden = new Array(idNe);
			var div = crearElementDiv('nivellEstudis'+idNe, nomNe+" ", nomsHidden, valorsHidden)
		}
		var root = document.getElementById('estudisSpan');
		root.appendChild(div);
	}
}
function afegirExperienciaEmpresa()
{
	var index = document.getElementById('categoria').selectedIndex;
	var idCategoria = document.getElementById('categoria').options[index].value;
	var nomCategoria = document.getElementById('categoria').options[index].firstChild.nodeValue;
	
	if(idCategoria!=-1)
	{
		index = document.getElementById('llocDeTreball').selectedIndex;
		var idLdt = document.getElementById('llocDeTreball').options[index].value;
		var nomLdt = document.getElementById('llocDeTreball').options[index].firstChild.nodeValue;
	
		index = document.getElementById('anys').selectedIndex;
		var idAnys = document.getElementById('anys').options[index].value;
		var nomAnys = document.getElementById('anys').options[index].firstChild.nodeValue;
	
	if(usuari == 'candidat')
		var coment = document.getElementById('expComentari').value;
	}
	if(idCategoria!=-1)
		var existeix = document.getElementById('categoria'+idCategoria+idLdt);
	else
		var existeix = document.getElementById('categoria'+idCategoria);
	if(existeix == null)
	{
		if(usuari == 'candidat')
		{
			if(idCategoria!=-1)
			{
				nomsHidden = new Array("categoria[]","llocDeTreball[]","anys[]","expComentari[]");
				valorsHidden = new Array(idCategoria,idLdt,idAnys,coment);
				var div = crearElementDiv('categoria'+idCategoria+idLdt, nomCategoria+" - "+nomLdt+" - "+nomAnys, nomsHidden, valorsHidden);
				var comentari = document.createElement('div');
				var texte = document.createTextNode(coment);
				comentari.appendChild(texte);
				div.appendChild(comentari);
			}
			else
			{
				nomsHidden = new Array("categoria[]");
				valorsHidden = new Array(idCategoria);
				var div = crearElementDiv('categoria'+idCategoria, nomCategoria, nomsHidden, valorsHidden);
				var comentari = document.createElement('div');
				var texte = document.createTextNode(coment);
				comentari.appendChild(texte);
				div.appendChild(comentari);
			}
		}
		else
		{
			if(idCategoria!=-1)
			{
				nomsHidden = new Array("categoria[]","llocDeTreball[]","anys[]");
				valorsHidden = new Array(idCategoria,idLdt,idAnys);
				var div = crearElementDiv('categoria'+idCategoria+idLdt, nomCategoria+" - "+nomLdt+" - "+nomAnys, nomsHidden, valorsHidden);
			}
			else
			{
				nomsHidden = new Array("categoria[]");
				valorsHidden = new Array(idCategoria);
				var div = crearElementDiv('categoria'+idCategoria, nomCategoria, nomsHidden, valorsHidden);
			}
		}
		
		var root = document.getElementById('experienciaUser');
		root.appendChild(div);
	}
}
function cargar_datos(texto)
{

	var salida=texto.split(',');
	if(salida[0]=="exp")
	{
			modificarExperiencia(salida[1],salida[2],salida[3],salida[4],salida[5],salida[6],salida[7],salida[8],salida[9],salida[10],salida[11],salida[12],salida[13]);
	}
	if(salida[0]=="est")
	{
			modificarEstudi(salida[1],salida[2],salida[3],salida[4],salida[5],salida[6],salida[7],salida[8],salida[9]);
	}
	if(salida[0]=="mas")
	{
			modificarMaster(salida[1],salida[2],salida[3],salida[4],salida[5]);
	}
	if(salida[0]=="cur")
	{
			modificarCurs(salida[1],salida[2],salida[3],salida[4],salida[5]);
	}
	if(salida[0]=="prg")
	{
			modificarPrograma(salida[1],salida[2],salida[3],salida[4]);
	}
	if(salida[0]=="prg2")
	{
			modificarProgOferta(salida[1],salida[2],salida[3],salida[4]);
	}
	if(salida[0]=="idio")
	{
			modificarIdioma(salida[1],salida[2],salida[3],salida[4],salida[5]);
	}

}
function modificarExperiencia(node,id,categoria,llocDeTreball,anys,mesIni,anyIni,mesFin,anyFin,expEmpresa,expSecEmp,expFuncions,AltresllocDeTreball)
{
	var aEsborrar = document.getElementById(node);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);

	
	
	
	var tt=document.getElementById('categoria');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==categoria)
			tt[i].selected=true;
	}
	//document.entraCv.categoria.onchange();
	//xajax_canviaLlocDeTreball(id,"$usuari");
	xajax_canviaModLlocDeTreball(id,categoria,llocDeTreball,anys,mesIni,anyIni,mesFin,anyFin,expEmpresa,expSecEmp,expFuncions,AltresllocDeTreball);
	
}
function afegirExperiencia()
{
	
	var index = document.getElementById('categoria').selectedIndex;
	var idCategoria = document.getElementById('categoria').options[index].value;
	var nomCategoria = document.getElementById('categoria').options[index].firstChild.nodeValue;
	
	index = document.getElementById('llocDeTreball').selectedIndex;
	var idLdt = document.getElementById('llocDeTreball').options[index].value;
	var nomLdt = document.getElementById('llocDeTreball').options[index].firstChild.nodeValue;
	
	if(nomLdt =="Altres" || nomLdt=="Otros")
		var nomAlt = document.getElementById('AltresllocDeTreball').value;
	else
		var nomAlt="";

	index = document.getElementById('anys').selectedIndex;
	var idAnys = document.getElementById('anys').options[index].value;
	var nomAnys = document.getElementById('anys').options[index].firstChild.nodeValue;
	
	index = document.getElementById('mesIni').selectedIndex;
	var idmesIni = document.getElementById('mesIni').options[index].value;
	var nommesIni = document.getElementById('mesIni').options[index].firstChild.nodeValue;
	
	index = document.getElementById('anyIni').selectedIndex;
	var idanyIni = document.getElementById('anyIni').options[index].value;
	var nomanyIni = document.getElementById('anyIni').options[index].firstChild.nodeValue;
	
	index = document.getElementById('mesFin').selectedIndex;
	var idmesFin = document.getElementById('mesFin').options[index].value;
	var nommesFin = document.getElementById('mesFin').options[index].firstChild.nodeValue;
	
	index = document.getElementById('anyFin').selectedIndex;
	var idanyFin = document.getElementById('anyFin').options[index].value;
	var nomanyFin = document.getElementById('anyFin').options[index].firstChild.nodeValue;
	
	if(usuari == 'candidat')
	{
		//var coment = document.getElementById('expComentari').value;
		var empresa = document.getElementById('expEmpresa').value;
		var sector = document.getElementById('expSectEmp').value;
		var funcions = document.getElementById('expFuncions').value;
	
	}

var att_modificar="exp,"+"categoria"+idCategoria+idLdt+","+idCategoria+","+idCategoria+","+idLdt+","+idAnys+","+idmesIni+","+idanyIni+","+idmesFin+","+idanyFin+","+empresa+","+sector+","+funcions+","+nomAlt;
	
	//var existeix = document.getElementById('categoria'+idCategoria+idLdt);
	//if(existeix == null)
	//{
		if(usuari == 'candidat')
		{
			nomsHidden = new Array("categoria[]","llocDeTreball[]","anys[]","mesIni[]","anyIni[]","mesFin[]","anyFin[]","expEmpresa[]","expSectEmp[]","expFuncions[]","AltresllocDeTreball[]","ex_experiencia");
			valorsHidden = new Array(idCategoria,idLdt,idAnys,idmesIni,idanyIni,idmesFin,idanyFin, empresa, sector, funcions,nomAlt,idCategoria);
			if(nomLdt =='Altres' || nomLdt=="Otros")
			{	var div = crearElementDiv2('categoria'+idCategoria+idLdt+idmesIni+idanyIni+idmesFin+idanyFin,att_modificar,nomAlt+" - "+nomAnys+" - "+nommesIni+" - "+nomanyIni+" - "+nommesFin+" - "+nomanyFin, nomsHidden, valorsHidden);}
			else
			{	var div = crearElementDiv2('categoria'+idCategoria+idLdt+idmesIni+idanyIni+idmesFin+idanyFin,att_modificar,nomLdt+" - "+nomAnys+" - "+nommesIni+" - "+nomanyIni+" - "+nommesFin+" - "+nomanyFin, nomsHidden, valorsHidden);}
			//var comentari = document.createElement('div');
			//var texte = document.createTextNode(coment);
			//comentari.appendChild(texte);
			//div.appendChild(comentari);
			
			var empre = document.createElement('div');
			var texte = document.createTextNode(empresa);
			empre.appendChild(texte);
			div.appendChild(empre);
			
			var sect = document.createElement('div');
			var texte = document.createTextNode(sector);
			sect.appendChild(texte);
			div.appendChild(sect);
			
			var func = document.createElement('div');
			var texte = document.createTextNode(funcions);
			func.appendChild(texte);
			div.appendChild(func);
		}
		else
		{
			nomsHidden = new Array("categoria[]","llocDeTreball[]","anys[]");
			valorsHidden = new Array(idCategoria,idLdt,idAnys);
			var div = crearElementDiv('categoria'+idCategoria+idLdt, nomCategoria+" - "+nomLdt+" - "+nomAnys, nomsHidden, valorsHidden);
		}
		
		var root = document.getElementById('experienciaUser');
		root.appendChild(div);
	//}
}
function afegirExperienciaOfertes()
{
	var index = document.getElementById('categoria').selectedIndex;
	var idCategoria = document.getElementById('categoria').options[index].value;
	var nomCategoria = document.getElementById('categoria').options[index].firstChild.nodeValue;
	if(document.getElementById('treballs_requisit').checked==true)
		var idExperienciaRequisit=1;
	else
		var idExperienciaRequisit=0;
	index = document.getElementById('llocDeTreball').selectedIndex;
	var idLdt = document.getElementById('llocDeTreball').options[index].value;
	var nomLdt = document.getElementById('llocDeTreball').options[index].firstChild.nodeValue;
	
	index = document.getElementById('anys').selectedIndex;
	var idAnys = document.getElementById('anys').options[index].value;
	var nomAnys = document.getElementById('anys').options[index].firstChild.nodeValue;
	
	if(usuari == 'candidat')
		var coment = document.getElementById('expComentari').value;
	
	var existeix = document.getElementById('categoria'+idCategoria+idLdt);
	if(existeix == null)
	{
		nomsHidden = new Array("categoria[]","llocDeTreball[]","anys[]","treball_requisit[]");
		valorsHidden = new Array(idCategoria,idLdt,idAnys,idExperienciaRequisit);
		if(document.getElementById('treballs_requisit').checked==true)
			var div = crearElementDiv('categoria'+idCategoria+idLdt, nomCategoria+" - "+nomLdt+" - "+nomAnys+ " - requisit", nomsHidden, valorsHidden)
		else
			var div = crearElementDiv('categoria'+idCategoria+idLdt, nomCategoria+" - "+nomLdt+" - "+nomAnys, nomsHidden, valorsHidden)
		var root = document.getElementById('experienciaUser');
		root.appendChild(div);
	}
}

function afegirAreaLaboral()
{
	var index = document.getElementById('categoria_laboral').selectedIndex;
	var idLaboral = document.getElementById('categoria_laboral').options[index].value;
	var nomLaboral = document.getElementById('categoria_laboral').options[index].firstChild.nodeValue;
	
	//index = document.getElementById('AreaLaboral').selectedIndex;
	//var idLdt = document.getElementById('AreaLaboral').options[index].value;
	//var nomLdt = document.getElementById('AreaLaboral').options[index].firstChild.nodeValue;
	
	//index = document.getElementById('anys').selectedIndex;
	//var idAnys = document.getElementById('anys').options[index].value;
	//var nomAnys = document.getElementById('anys').options[index].firstChild.nodeValue;
	
	//if(usuari == 'candidat')
		//var coment = document.getElementById('expComentari').value;
	
	var existeix = document.getElementById('categoria_laboral'+idLaboral);
	if(existeix == null)
	{
			nomsHidden = new Array("categoria_laboral[]","ex_arealaboral");
			valorsHidden = new Array(idLaboral,idLaboral);
			var div = crearElementDiv('categoria_laboral'+idLaboral, nomLaboral,nomsHidden, valorsHidden);
		
		var root = document.getElementById('area_laboralUser');
		root.appendChild(div);
	}
}

function afegirLloc()
{
	var element = document.getElementById('qualsevolProvincia');
	if(element != null)
	{
		alert("L'opció de qualsevol provincia engloba totes les altres opcions")
		return 0;
	}
	var indexProvincia = document.getElementById('provincia').selectedIndex;
	if (indexProvincia != 0)
	{
		var idProvincia = document.getElementById('provincia').options[indexProvincia].value;
		var nomProvincia = document.getElementById('provincia').options[indexProvincia].firstChild.nodeValue;
		// Mirem que no existeixi la provincia només
		var element = document.getElementById('provincia'+idProvincia);
		if(element != null)
		{
			alert("Ja tens sel·leccionada la provincia, això engloba totes les seves comarques i poblacions");
			return 0;
		}
		
					var indexPoblacio = document.getElementById('poblacio').selectedIndex;
					var idPoblacio = document.getElementById('poblacio').options[indexPoblacio].value;
					var nomPoblacio = document.getElementById('poblacio').options[indexPoblacio].firstChild.nodeValue;
					var idTmp = 'provincia'+idProvincia+idPoblacio;
					var element = document.getElementById(idTmp);
					if(element == null)
					{
						var nomsHidden = new Array("provincia[]","poblacio[]","ex_poblacio");
						var valorsHidden = new Array(idProvincia,idPoblacio,idProvincia);
						nom = nomProvincia + " - " + nomPoblacio;
						var div = crearElementDiv(idTmp,nom,nomsHidden,valorsHidden);
					}
					else
					{
						alert("Ja tens sel·leccionada aquesta població.");
						return 0;
					}
		
	}
	else
	{
		var existeix = document.getElementById('qualsevolProvincia');
		if(existeix == null)
		{
			var nomsHidden = new Array("provincia[]","poblacio[]","ex_poblacio");
			var valorsHidden = new Array("-1","-1","-1");
			var div = crearElementDiv('qualsevolProvincia',"Qualsevol provincia",nomsHidden,valorsHidden);
		}
	}
	
	var root = document.getElementById('poblacioUser');
	root.appendChild(div);
}
function afegirLlocResident()
{
	if(document.getElementById('llocs_resident_requisit').checked==true)
		var idLlocResidentRequisit=1;
	else
		var idLlocResidentRequisit=0;
	var element = document.getElementById('qualsevolProvincia_resident');
	if(element != null)
	{
		alert("L'opció de qualsevol provincia engloba totes les altres opcions")
		return 0;
	}
	var indexProvinciaResident = document.getElementById('provincia_resident').selectedIndex;
	if (indexProvinciaResident != 0)
	{
		var idProvincia_resident = document.getElementById('provincia_resident').options[indexProvinciaResident].value;
		var nomProvincia_resident = document.getElementById('provincia_resident').options[indexProvinciaResident].firstChild.nodeValue;
		// Mirem que no existeixi la provincia només
		var element = document.getElementById('provincia_resident'+idProvincia_resident);
		if(element != null)
		{
			alert("Ja tens sel·leccionada la provincia, això engloba totes les seves comarques i poblacions");
			return 0;
		}
	
			var idTmp = 'provincia_resident'+idProvincia_resident;
			var element = document.getElementById(idTmp);
			if(element == null)
			{
				var indexPoblacioResident = document.getElementById('poblacio_resident').selectedIndex;
				if(indexPoblacioResident == 0)
				{
					var nomsHidden = new Array("provincia_resident[]","poblacio_resident[]","lloc_resident_requisit[]","ex_resident");
					var valorsHidden = new Array(idProvincia_resident,"-1",idLlocResidentRequisit,idProvincia_resident);
					if(document.getElementById('llocs_resident_requisit').checked==true)
						nom = nomProvincia_resident +" - requisit";
					else
						nom = nomProvincia_resident;
					
					var div = crearElementDiv(idTmp,nom,nomsHidden,valorsHidden);
				}
				else
				{
					var idPoblacio_resident = document.getElementById('poblacio_resident').options[indexPoblacioResident].value;
					var nomPoblacio_resident = document.getElementById('poblacio_resident').options[indexPoblacioResident].firstChild.nodeValue;
					var idTmp = 'provincia_resident'+idProvincia_resident+idPoblacio_resident;
					var element = document.getElementById(idTmp);
					if(element == null)
					{
						var nomsHidden = new Array("provincia_resident[]","poblacio_resident[]","lloc_resident_requisit[]","ex_resident");
						var valorsHidden = new Array(idProvincia_resident,idPoblacio_resident,idLlocResidentRequisit,idProvincia_resident);
						if(document.getElementById('llocs_resident_requisit').checked==true)
							nom = nomProvincia_resident + " - " + nomPoblacio_resident+" - requisit";
						else
							nom = nomProvincia_resident + " - " + nomPoblacio_resident;
						var div = crearElementDiv(idTmp,nom,nomsHidden,valorsHidden);
					}
					else
					{
						alert("Ja tens sel·leccionada aquesta població.");
						return 0;
					}
				}
				
			}
			else
			{
				alert("Ja tens sel·leccionada la comarca, això engloba totes les seves poblacions.");
				return 0;
			}
		
	}
	else
	{
		var existeix = document.getElementById('qualsevolProvincia_resident');
			
		if(existeix == null)
		{
			var nomsHidden = new Array("provincia_resident[]","poblacio_resident[]","lloc_resident_requisit[]");
			var valorsHidden = new Array("-1","-1",id_LlocResidentRequisit);
			if(document.getElementById('llocs_resident_requisit').checked==true)
				var div = crearElementDiv('qualsevolProvincia_resident',"Qualsevol provincia - requisit ",nomsHidden,valorsHidden);
			else
				var div = crearElementDiv('qualsevolProvincia_resident',"Qualsevol provincia",nomsHidden,valorsHidden);
		}
	}
	
	var root = document.getElementById('poblacioUser_resident');
	root.appendChild(div);
}
function modificarEstudi(node,id,nivellsEstudis,titulacions,centre,mesIniestudi,anyIniestudi,mesFinestudi,anyFinestudi)
{
	var aEsborrar = document.getElementById(node);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);

	
	//document.entraCv.nivellsEstudis.onchange();
	var tt=document.getElementById('nivellsEstudis');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==nivellsEstudis)
			tt[i].selected=true;
	}
	
	xajax_canviaModEstudis(id,nivellsEstudis,titulacions,centre,mesIniestudi,anyIniestudi,mesFinestudi,anyFinestudi);
	
}
function afegirEstudis()
{
	var index = document.getElementById('nivellsEstudis').selectedIndex;
	var idNe = document.getElementById('nivellsEstudis').options[index].value;
	var nomNe = document.getElementById('nivellsEstudis').options[index].firstChild.nodeValue;
	
	index = document.getElementById('titulacions').selectedIndex;
	var idTitol = document.getElementById('titulacions').options[index].value;
	var nomTitol = document.getElementById('titulacions').options[index].firstChild.nodeValue;

	var centre = document.getElementById('centre').value;
	
	
	index = document.getElementById('mesIniestudi').selectedIndex;

	var idMesIni = document.getElementById('mesIniestudi').options[index].value;
	
	var nomMesIni = document.getElementById('mesIniestudi').options[index].firstChild.nodeValue;
	
	
	index = document.getElementById('anyIniestudi').selectedIndex;

	var idAnyIni = document.getElementById('anyIniestudi').options[index].value;
	
	var nomAnyIni = document.getElementById('anyIniestudi').options[index].firstChild.nodeValue;
	
	
	index = document.getElementById('mesFinestudi').selectedIndex;

	var idMesFin = document.getElementById('mesFinestudi').options[index].value;
	
	var nomMesFin = document.getElementById('mesFinestudi').options[index].firstChild.nodeValue;
	
	
	index = document.getElementById('anyFinestudi').selectedIndex;

	var idAnyFin = document.getElementById('anyFinestudi').options[index].value;
	
	var nomAnyFin = document.getElementById('anyFinestudi').options[index].firstChild.nodeValue;
	
	var att_modificar="est,"+"nivellEstudis"+idNe+idTitol+","+idNe+","+idNe+","+idTitol+","+centre+","+idMesIni+","+idAnyIni+","+idMesFin+","+idAnyFin;
	
	var existeix = document.getElementById('nivellEstudis'+idNe+idTitol);
	if(existeix == null)
	{
		nomsHidden = new Array("nivellEstudis[]","titulacio[]","centre[]","mesIniestudi[]","anyIniestudi[]","mesFinestudi[]","anyFinestudi[]","ex_estudi");
		valorsHidden = new Array(idNe,idTitol,centre,idMesIni,idAnyIni,idMesFin,idAnyFin,idNe);

		var div = crearElementDiv2('nivellEstudis'+idNe+idTitol, att_modificar,nomNe+" - "+nomTitol+" - "+centre+" - Desde "+nomMesIni+" de "+nomAnyIni+" fins "+nomMesFin+" de "+nomAnyFin, nomsHidden, valorsHidden)
		
		var root = document.getElementById('estudisSpan');
		root.appendChild(div);
	}
}

function modificarCurs(id,cursos_titol,cursos_centre,cursos_mes,cursos_any)
{
	//var nodeMod = document.getElementById(id);
	
	var tt=document.getElementById('cursos_mes');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==cursos_mes)
			tt[i].selected=true;
	}
	//document.entraCv.programes.onchange();
	
	var tt=document.getElementById('cursos_any');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==cursos_any)
			tt[i].selected=true;
	}
	document.getElementById('cursos_titol').value=cursos_titol;
	document.getElementById('cursos_centre').value=cursos_centre;
	var aEsborrar = document.getElementById(id);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);
	
}
function afegirCursos()

{

	var titol_cursos = document.getElementById('cursos_titol').value;
	
	var centre_cursos = document.getElementById('cursos_centre').value;
	
	
	
	var index = document.getElementById('cursos_mes').selectedIndex;

	var idcursos_mes = document.getElementById('cursos_mes').options[index].value;

	var nomcursos_mes = document.getElementById('cursos_mes').options[index].firstChild.nodeValue;

	

	index = document.getElementById('cursos_any').selectedIndex;

	var idcursos_any = document.getElementById('cursos_any').options[index].value;

	var nomcursos_any = document.getElementById('cursos_any').options[index].firstChild.nodeValue;
	
var att_modificar="cur,"+"cursos"+titol_cursos+centre_cursos+","+titol_cursos+","+centre_cursos+","+idcursos_mes+","+idcursos_any;


	var existeix = document.getElementById('cursos'+titol_cursos+centre_cursos);

	if(existeix == null)

	{

		nomsHidden = new Array("cursos_titol[]","cursos_centre[]","cursos_mes[]","cursos_any[]");

		valorsHidden = new Array(titol_cursos, centre_cursos,idcursos_mes,idcursos_any);

//	titol_cursos,centre_cursos,

		var div = crearElementDiv2('cursos'+titol_cursos+centre_cursos, att_modificar,titol_cursos+" - "+centre_cursos+" - "+" En "+nomcursos_mes+" de "+nomcursos_any, nomsHidden, valorsHidden);

		

		var root = document.getElementById('cursosUser');

		root.appendChild(div);

	}

}

function modificarPrograma(id,programa,nivell,altres)
{
	//var nodeMod = document.getElementById(id);
	
	var tt=document.getElementById('programes');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==programa)
			tt[i].selected=true;
	}
	//document.entraCv.programes.onchange();
	
	var tt=document.getElementById('nivell_programa');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==nivell)
			tt[i].selected=true;
	}
	var aEsborrar = document.getElementById(id);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);
	if(altres!="")
	{
		var salida_altres="<input type='text' name='AltresProgrames' id='AltresProgrames' value='" + altres + "'\>";
		document.getElementById('AltresProgramesSpan').innerHTML=salida_altres;
	}
	else
	{
		document.getElementById('AltresProgramesSpan').innerHTML="";
	}
}
function modificarProgOferta(id,programa,nivell,altres,requisit)
{
	//var nodeMod = document.getElementById(id);
	
	var tt=document.getElementById('programes');

	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==programa)
			tt[i].selected=true;
	}
	//document.entraCv.programes.onchange();
	
	var tt=document.getElementById('nivells_programes');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==nivell)
			tt[i].selected=true;
	}
	var aEsborrar = document.getElementById(id);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);
	if(altres!="")
	{
		var salida_altres="<input type='text' name='AltresProgramesOferta' id='AltresProgramesOferta' value='" + altres + "'\>";
		document.getElementById('AltresProgramesOfertaSpan').innerHTML=salida_altres;
	}
	else
	{
		document.getElementById('AltresProgramesOfertaSpan').innerHTML="";
	}
}
function afegirPrograma()

{

	var index = document.getElementById('programes').selectedIndex;

	var idprograma = document.getElementById('programes').options[index].value;

	var nomprograma = document.getElementById('programes').options[index].firstChild.nodeValue;

	if(nomprograma =="Altres" || nomprograma =="Otros")
		var nomAlt = document.getElementById('AltresProgrames').value;
	else
		var nomAlt="";

	var index = document.getElementById('nivell_programa').selectedIndex;

	var idnivel_prog = document.getElementById('nivell_programa').options[index].value;

	var nomnivel_prog = document.getElementById('nivell_programa').options[index].firstChild.nodeValue;

var att_modificar="prg,"+"programa"+idprograma+","+idprograma+","+idnivel_prog+","+nomAlt;

	var existeix=null;
	//var existeix = document.getElementById('programa'+idprograma+);

	if(existeix == null)

	{



			nomsHidden = new Array("programes[]","nivell_programa[]","AltresProgrames[]");

			valorsHidden = new Array(idprograma,idnivel_prog,nomAlt);

			if(nomprograma =='Altres' || nomprograma =="Otros")
			{	var div = crearElementDiv2('programa'+idprograma, att_modificar,nomAlt+" - "+nomnivel_prog, nomsHidden, valorsHidden);}
			else
			{	var div = crearElementDiv2('programa'+idprograma, att_modificar,nomprograma+" - "+nomnivel_prog, nomsHidden, valorsHidden);}
			//var comentari = document.createElement('div');
			var root = document.getElementById('programesUser');
			root.appendChild(div);

	}

}
function afegirProgOferta()
{
	
	if(document.getElementById('programes_requisit').checked==true)
		var idRequisit=1;
	else
		var idRequisit=0;
		
	var index = document.getElementById('programes').selectedIndex;

	var idprograma = document.getElementById('programes').options[index].value;

	var nomprograma = document.getElementById('programes').options[index].firstChild.nodeValue;

	if(nomprograma =="Altres" || nomprograma =="Otros")
		var nomAlt = document.getElementById('AltresProgramesOferta').value;
	else
		var nomAlt="";

	var index = document.getElementById('nivells_programes').selectedIndex;

	var idnivel_prog = document.getElementById('nivells_programes').options[index].value;

	var nomnivel_prog = document.getElementById('nivells_programes').options[index].firstChild.nodeValue;

var att_modificar="prg2,"+"programa"+idprograma+idnivel_prog+","+idprograma+","+idnivel_prog+","+nomAlt;


	var existeix = document.getElementById('programa'+idprograma+idnivel_prog);

	if(existeix == null)

	{



			nomsHidden = new Array("programa[]","nivell_programa[]","AltresProgramaOferta[]","programa_requisit[]","ex_programes");

			valorsHidden = new Array(idprograma,idnivel_prog,nomAlt,idRequisit,idprograma);
			if(idRequisit==1)
				var nomRequisit=" -requisit";
			else
				var nomRequisit="";
			if(nomprograma =='Altres' || nomprograma =="Otros")
			{	
				var div = crearElementDiv('programa'+idprograma+idnivel_prog,nomAlt+" - "+nomnivel_prog+nomRequisit, nomsHidden, valorsHidden);
					
			}
			else
			{	var div = crearElementDiv('programa'+idprograma+idnivel_prog,nomprograma+" - "+nomnivel_prog+nomRequisit, nomsHidden, valorsHidden);}
			//var comentari = document.createElement('div');
			var root = document.getElementById('programesUser');
			root.appendChild(div);

	}
}
function modificarMaster(id,masters_titol,masters_centre,mesMaster,anyMaster)
{
	//var nodeMod = document.getElementById(id);
	
	var tt=document.getElementById('mesMaster');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==mesMaster)
			tt[i].selected=true;
	}
	//document.entraCv.programes.onchange();
	
	var tt=document.getElementById('anyMaster');
	for (i=0; i<tt.length; i++)
	{
		if(tt[i].value==anyMaster)
			tt[i].selected=true;
	}
	document.getElementById('masters_titol').value=masters_titol;
	document.getElementById('masters_centre').value=masters_centre;
	var aEsborrar = document.getElementById(id);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);
	
}
function afegirMasters()

{

	var titol_masters = document.getElementById('masters_titol').value;
	
	var centre_masters = document.getElementById('masters_centre').value;
	
	
	
	var index = document.getElementById('mesMaster').selectedIndex;

	var idmaster_mes = document.getElementById('mesMaster').options[index].value;

	var nommaster_mes = document.getElementById('mesMaster').options[index].firstChild.nodeValue;

	

	var index = document.getElementById('anyMaster').selectedIndex;

	var idmaster_any = document.getElementById('anyMaster').options[index].value;

	var nommaster_any = document.getElementById('anyMaster').options[index].firstChild.nodeValue;
	
var att_modificar="mas,"+"masters"+titol_masters+centre_masters+","+titol_masters+","+centre_masters+","+idmaster_mes+","+idmaster_any;

	var existeix = document.getElementById('masters'+titol_masters+centre_masters);

	if(existeix == null)

	{

		nomsHidden = new Array("masters_titol[]","masters_centre[]","mesMaster[]","anyMaster[]");

		valorsHidden = new Array(titol_masters, centre_masters,idmaster_mes,idmaster_any);

//	titol_cursos,centre_cursos,

		var div = crearElementDiv2('masters'+titol_masters+centre_masters,att_modificar, titol_masters+" - "+centre_masters+" - "+" En "+nommaster_mes+" de "+nommaster_any, nomsHidden, valorsHidden);

		

		var root = document.getElementById('mastersUser');

		root.appendChild(div);

	}

}

function afegirEstudisOfertes()
{
	var index = document.getElementById('nivellsEstudis').selectedIndex;
	var idNe = document.getElementById('nivellsEstudis').options[index].value;
	var nomNe = document.getElementById('nivellsEstudis').options[index].firstChild.nodeValue;
	if(document.getElementById('estudis_requisit').checked==true)
		var idEstudisRequisit=1;
	else
		var idEstudisRequisit=0;
	if(idNe>=0)
	{
		index = document.getElementById('titulacions').selectedIndex;
		var idTitol = document.getElementById('titulacions').options[index].value;
		var nomTitol = document.getElementById('titulacions').options[index].firstChild.nodeValue;
	}
	else
	{
		idTitol="";	
		nomTitol="";
	}
	var existeix = document.getElementById('nivellEstudis'+idNe+idTitol);
	if(existeix == null)
	{
		nomsHidden = new Array("nivellEstudis[]","titulacio[]","estudi_requisit[]","ex_estudis");
		valorsHidden = new Array(idNe,idTitol,idEstudisRequisit,idNe);
		if(document.getElementById('estudis_requisit').checked==true)
			var div = crearElementDiv('nivellEstudis'+idNe+idTitol, nomNe+" - "+nomTitol+" - requisit", nomsHidden, valorsHidden)	;
		else
			var div = crearElementDiv('nivellEstudis'+idNe+idTitol, nomNe+" - "+nomTitol+" ", nomsHidden, valorsHidden)	;
		
		var root = document.getElementById('estudisSpan');
		root.appendChild(div);
	}
}
function esborrar(id)
{
	var aEsborrar = document.getElementById(id);
	var pare = aEsborrar.parentNode;
	pare.removeChild(aEsborrar);
}

function crearElementDiv(id, text, nomsHidden, valorsHidden)
{
	var div = document.createElement('div');
	div.setAttribute("id",id);
	
	var texte = document.createTextNode(text);
	div.appendChild(texte);
	var span = document.createElement('span');
	span.setAttribute("onclick","esborrar(\""+id+"\")");
	span.setAttribute("onclick","esborrar(\""+id+"\")");
	span.onclick = function(){
		esborrar(id)
	};
	var img = document.createElement('img');
	img.setAttribute('src','templates/default/images/img/desconectar.png');
	img.setAttribute('alt','Esborrar');
	span.appendChild(img);
	div.appendChild(span);
	
	for ( var i=0;i<nomsHidden.length;i++)
	{
		var hidden = document.createElement('input');
		hidden.setAttribute("name",nomsHidden[i]);
		hidden.setAttribute("id",nomsHidden[i]);
		hidden.setAttribute("value",valorsHidden[i]);
		hidden.setAttribute("type","hidden");
		div.appendChild(hidden);
	}
	
	return div;
}
function crearElementDiv2(id,att_modificar,text, nomsHidden, valorsHidden)
{
	
	var div = document.createElement('div');
	div.setAttribute("id",id);
	// boto modificar
	var texte = document.createTextNode(text);
	div.appendChild(texte);
	var span = document.createElement('span');
	span.setAttribute("class","pointer");
	span.setAttribute("onclick","cargar_datos(\""+att_modificar+"\")");
	//span.setAttribute("onclick","modificarExperiencia('"+att_modificar+"')");
	span.onclick = function(){
		cargar_datos(att_modificar)
	};
	var img = document.createElement('img');
	img.setAttribute('src','templates/default/images/icons/modificar.png');
	img.setAttribute('width','16');
	img.setAttribute('height','16');
	img.setAttribute('alt','Modificar');
	span.appendChild(img);
	div.appendChild(span);
	// botor esborrar
	var span2 = document.createElement('span');
	span2.setAttribute("onclick","esborrar(\""+id+"\")");
	span2.setAttribute("onclick","esborrar(\""+id+"\")");
	span2.setAttribute("class","pointer");
	span2.onclick = function(){
		esborrar(id)
	};
	var img = document.createElement('img');
	img.setAttribute('src','templates/default/images/img/desconectar.png');
	img.setAttribute('alt','Esborrar');
	span2.appendChild(img);
	div.appendChild(span2);
	
	for ( var i=0;i<nomsHidden.length;i++)
	{
		var hidden = document.createElement('input');
		hidden.setAttribute("name",nomsHidden[i]);
		hidden.setAttribute("id",nomsHidden[i]);
		hidden.setAttribute("value",valorsHidden[i]);
		hidden.setAttribute("type","hidden");
		div.appendChild(hidden);
	}
	
	return div;
	
}
function obreFinestra(url, nom)
{
	var opcions = "left=20,top=20,width=840,height=600,directories=NO,scrollbars=YES,location=NO,menubar=NO,toolbar=NO";
	url += "&notp=1";
	window.open(url,nom,opcions);
}
function obreConegut()
{
	xpos=(screen.width/2)-(270/2);
	ypos=(screen.height/2)-(280/2);
	var opcions = "width=270,height=280,left="+xpos + ",top="+ypos + ",directories=NO,scrollbars=NO,location=NO,menubar=NO,toolbar=NO,resizable=0,status=no";
	window.open("controller.php?page=ViewConegutcv10Action&notp=1","CV10",opcions);
}
function obreRecomanaOferta(id_oferta)
{
	xpos=(screen.width/2)-(270/2);
	ypos=(screen.height/2)-(280/2);
	var opcions = "width=270,height=280,left="+xpos + ",top="+ypos + ",directories=NO,scrollbars=NO,location=NO,menubar=NO,toolbar=NO,resizable=0,status=no";
	window.open("controller.php?page=ViewRecomanaOfertaAction&notp=1&id="+id_oferta,"CV10",opcions);
}
function obrePdfPortada(fichero,ancho,alto)
{
	xpos=(screen.width/2)-(ancho/2);
	ypos=(screen.height/2)-(alto/2);
	var opcions = "width="+ ancho +",height="+alto+",left="+xpos + ",top="+ypos + ",directories=no,scrollbars=yes,location=no,menubar=no,toolbar=no,resizable=no,status=no";
	window.open("pdf.php?f="+fichero,"CV10",opcions);
}
function guardarAlDirectori(id)
{
	var resposta = confirm("Segur que vols guardar aquest candidat al teu directori?");
	if(resposta)
	{
		//alert(id);
		xajax_guardarCurriculum(id);	
	}
}

function comprarGratis(id)
{
	var resposta = confirm("Segur que vols guardar aquest candidat al teu directori?");
	if(resposta)
	{
		xajax_guardarCurriculum(id);
		var url_compra=location.pathname;
		var total_url=url_compra.substr(1,8);
		if(total_url=="cv10_new")
			url_compra="http://www.cv10.es/cv10_new/";
		else
			url_compra="http://www.cv10.es/";
		var url=url_compra+"controller.php?page=DirectoriAction";
		document.location = url;
	}
}

function posaTaronja(taronja,colorNormal)
{
	var element = document.getElementById(taronja);
	element.style.background = "#FE8929"; 
	var element = document.getElementById(colorNormal);
	element.style.background = "#9AB2B6";
	
}

function mirarSiNul(id)
{
	if(id=='')
		document.getElementById('poblacions').innerHTML = '';
} 

function mirarSiNulResident(id)
{
	if(id=='')
		document.getElementById('poblacions_resident').innerHTML = '';
}

function donarseDeBaixa(texte)
{
	var resposta = confirm(texte);
	if(resposta)
	{
		window.location.href = 'controller.php?page=EsborrarseAction';
	}
	
}
/*function tots(form,marcar){
	for (i = 0; i < form.elements.length; i++){
		if(form.elements[i].type=="checkbox")
		{
			form.elements[i].checked = marcar;
		}
	}
}


function ConfirmarEliminar(missatge, url) {
  if (confirm(missatge)) 
  {
    document.location = url;
  }
  
}

function canviarPestanya(mostrar,amagar)
{
	document.getElementById(amagar).style.display = "none";
	document.getElementById(mostrar).style.display = "block";
}

/*function iluminar(element)
{
	document.getElementById(element).bgColor = "#000000";
}*/

/*function mostrar(element)
{
	document.getElementById(element).style.display = "block";
}

function obreTancaDiv(id)
{
	var element = document.getElementById(id);
	if(element.style.display == "none")
		element.style.display = "block";
	else
		element.style.display = "none";
}*/

/***********************************************
* Show Hint script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function getposOffset(what, offsettype)
{
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null)
	{
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function iecompattest()
{
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge)
{
	var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
	if (whichedge=="rightedge"){
	var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
	dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
		edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
	}
	else
	{
		var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
		if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
	}
	return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth)
{
	if ((ie||ns6) && document.getElementById("hintbox"))
	{

		dropmenuobj=document.getElementById("hintbox")
		menucontents = '<span style="float: right;cursor: pointer" id="tancar">[x]</span>'+menucontents
		dropmenuobj.innerHTML=menucontents
		dropmenuobj.style.left=dropmenuobj.style.top=-500
		if (tipwidth!="")
		{
			dropmenuobj.widthobj=dropmenuobj.style
			dropmenuobj.widthobj.width=tipwidth
		}
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
		dropmenuobj.style.visibility="visible"
		//obj.onmouseout=hidetip
		if (navigator.product != 'Gecko' )
		{
			tancar.onclick=hidetip;
		}
		else
		{
			tancar=document.getElementById('tancar')
			tancar.onclick=hidetip;
		}
	}
}
function showhint_ie6(menucontents, obj, e, tipwidth,ie6)
{
	if ((ie||ns6) && document.getElementById("hintbox"))
	{
		if(ie6!="")
		{
			var is_ie6 = (window.external && typeof window.XMLHttpRequest == "undefined");
			if(is_ie6)
			{
				var selects=ie6.split(",");
				var index_ie6=0;
				while(index_ie6 < selects.length) {
				if(document.getElementById(selects[index_ie6]))
				{ 
					document.getElementById(selects[index_ie6]).style.visibility="hidden";
				}
				index_ie6++;
				}
			}
		}
		dropmenuobj=document.getElementById("hintbox")
		menucontents = '<span style="float: right;cursor: pointer" id="tancar">[x]</span>'+menucontents
		dropmenuobj.innerHTML=menucontents
		dropmenuobj.style.left=dropmenuobj.style.top=-500
		if (tipwidth!="")
		{
			dropmenuobj.widthobj=dropmenuobj.style
			dropmenuobj.widthobj.width=tipwidth
		}
		dropmenuobj.x=getposOffset(obj, "left")
		dropmenuobj.y=getposOffset(obj, "top")
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
		dropmenuobj.style.visibility="visible"
		//obj.onmouseout=hidetip
		if (navigator.product != 'Gecko' )
		{
			tancar.onclick=hidetip;
		}
		else
		{
			tancar=document.getElementById('tancar')
			tancar.onclick=hidetip;
		}
	}
}

function hidetip(e)
{
	dropmenuobj.style.visibility="hidden"
	dropmenuobj.style.left="-500px"

}
function hidetip_ie6(e,ie6)
{
	dropmenuobj.style.visibility="hidden"
	dropmenuobj.style.left="-500px"
	if(ie6!="")
	{
		var is_ie6 = (window.external && typeof window.XMLHttpRequest == "undefined");
			if(is_ie6)
			{
			var selects=ie6.split(",");
			var index_ie6=0;
			while(index_ie6 < selects.length) {
			if(document.getElementById(selects[index_ie6])){ 
				document.getElementById(selects[index_ie6]).style.visibility="visible";
			}
			index_ie6++;
			}
		}
	}
}
function createhintbox()
{
	var divblock=document.createElement("div")
	divblock.setAttribute("id", "hintbox")
	document.body.appendChild(divblock)
}


function abrir(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){
     var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
     var ventana = window.open(direccion,"venta",opciones,sustituir);
}  

function verErrores(txt_experiencia,txt_estudi,txt_idioma){
var error_salida=0;
var texto="";
var kk=document.getElementsByName("ex_experiencia");
 var total=kk.length;

if(total==0)
 {	
	error_salida=1;
	texto+=txt_experiencia;
 }
var rr=document.getElementsByName("ex_estudi");
 var totale=rr.length;
 if(totale==0)
 {	
	error_salida=2;
	texto+=txt_estudi;
 }
var ss=document.getElementsByName("ex_idioma");
 var total3=ss.length;
 if(total3==0)
{
	error_salida=3;
	texto+=txt_idioma;
}
 if(error_salida==0)
 {
	 return true;
 }
 else
 {
 	alert(texto);
	return false;
 }
}
function verErrores_2(txt_nomfiscal,txt_funcions,txt_poblacio,txt_arealaboral,txt_estudis,txt_idiomes,txt_informatica,txt_resident,txt_vehicle,txt_contracte,txt_durada,txt_horari,txt_salari){

var error_salida=0;
var texto="";
var aa=document.getElementById("activitat").value;
if(aa=="")
 {	
	error_salida=1;
	texto+=txt_nomfiscal;
 }
 var kk=document.getElementById("lloc_treball").value;
var oo=kk.substr(0,3);
if(oo=="ex:" || oo=="ej:")
	kk="";
//var total=kk.value;
if(kk=="")
 {	
	error_salida=4;
	texto+=txt_funcions;
 }
var bb=document.getElementsByName("ex_arealaboral");
 var totale=bb.length;
 if(totale==0)
 {	
	error_salida=2;
	texto+=txt_arealaboral;
 }
 var rr=document.getElementsByName("ex_poblacio");
 var totale=rr.length;
 if(totale==0)
 {	
	error_salida=5;
	texto+=txt_poblacio;
 }

 var cc=document.getElementsByName("ex_estudis");
 var totale=cc.length;
 if(totale==0)
 {	
	error_salida=3;
	texto+=txt_estudis;
 }

 var dd=document.getElementsByName("ex_idiomes");
 var totale=dd.length;
 if(totale==0)
 {	
	error_salida=6;
	texto+=txt_idiomes;
 }
 var oo=document.getElementsByName("ex_programes");
 var totale=oo.length;
 if(totale==0)
 {	
	error_salida=8;
	texto+=txt_informatica;
 }
 var ee=document.getElementsByName("ex_resident");
 var totale=ee.length;
 if(totale==0)
 {	
	error_salida=7;
	texto+=txt_resident;
 }
 var ff=document.getElementsByName("ex_vehicle");
 var totale=ff.length;
 if(totale==0)
 {	
	error_salida=8;
	texto+=txt_vehicle;
 }
  var gg=document.getElementById("contracte").value;
var oo=gg.substr(0,3);
if(oo=="ex:" || oo=="ej:")
	gg="";
if(gg=="")
 {	
	error_salida=9;
	texto+=txt_contracte;
 }
/*
 var hh=document.getElementById("durada").value;
if(hh=="")
 {	
	error_salida=10;
	texto+=txt_durada;
 }
*/
var ii=document.getElementById("horari").value;
var oo=ii.substr(0,3);
if(oo=="ex:" || oo=="ej:")
	ii="";
if(ii=="")
 {	
	error_salida=11;
	texto+=txt_horari;
 }
  var jj=document.getElementById("salari").value;
var oo=jj.substr(0,3);
if(oo=="ex:" || oo=="ej:")
	jj="";
if(jj=="")
 {	
	error_salida=12;
	texto+=txt_salari;
 }
 if(error_salida==0)
 {
	 return true;
 }
 else
 {
 	alert(texto);
	return false;
 }
}
