	function teclaPresionada(e){
	    if(window.event){
	        keynum = e.keyCode
	    }else if(e.which){
	        keynum = e.which
	    }
	    return keynum;
	}
	
	function sendSearch(search_input){
		var search=document.getElementById(search_input).value;
		self.location='search.html?search='+search;
	}
	
	function changeCountry(_country) {
			var data = {country: _country};			
			$.ajax({
		           url: "changeCountry.php",
		           type: "POST",
		           dataType: "text",
		           data: data,	           		
		           error: function(req, err, obj) {
		           	alert('error :: ' + err + req.status);
		           },
		           success: function(txt) {
					//alert(' txt : ' + txt);
			           	if (txt=="OK"){
			           		//alert(' txt : ' + window.location.href);
			           		self.location.reload(true);	
			           		//self.location = window.location.href;
			           		//self.location = self.location.href+'?Xch';
			           		//self.location = "index.html";
			           		return true;
			           	}else{
			       			alert("Se produjo un error al cambiar el pa�s.");
			       			self.location = self.location.href;
			       			//f.usuario.value=_usuario;
			       			return false;
			           	}
		       
		        	}            
				});
	}
	function changeTypeClient(_TypeClient) {
			var data = {TypeClient: _TypeClient};			
			$.ajax({
		           url: "changeTypeClient.php",
		           type: "POST",
		           dataType: "text",
		           data: data,	           		
		           error: function(req, err, obj) {
		           	alert('error :: ' + err + req.status);
		           },
		           success: function(txt) {          	
			           	if (txt=="OK"){
			           		self.location.reload(true);	
			           		return true;
			           	}else{
			       			alert("Se produjo un error al cambiar el de tipo de cliente");
			       			self.location = self.location.href;
			       			return false;
			           	}
		       
		        	}            
				});
	}	

	function send_ContactForm(){
	    document.getElementById('formulario').style.display="block";               	
	    document.getElementById('send_ok').style.display="none";	
	    document.getElementById('send_error').style.display="none";   
		document.getElementById('resp_captcha_error_2').style.display="none";   	       
	    var _name = document.getElementById('name').value;
	    var _surname_1 = document.getElementById('surname_a').value;
	    var _surname_2 = document.getElementById('surname_b').value;
	    var _mail = document.getElementById('mail').value;
	    var _pref_phone = document.getElementById('pref_phone').value;
	    var _phone = document.getElementById('phone').value;
	    var _comment = document.getElementById('asunto').value;
	    var _city = document.getElementById('city').value;
	    var _country = document.getElementById('country').value;
	    var _how_know = document.getElementById('how_know').value;
	    var _captcha = document.getElementById('resp_captcha').value;
	    var _type = document.getElementById('type').value;
	    //var _phone = document.getElementById('phone').value;
	    var ok = true;
	    if(cw_esta_vacio(document.getElementById('name'))){
	        ok=false;
	    	document.getElementById('name_error').style.display="block";	        
	    }else{
	    	document.getElementById('name_error').style.display="none";	    	
	    }
	    if(cw_esta_vacio(document.getElementById('surname_a'))){
	        ok=false;
	        document.getElementById('surname_a_error').style.display="block";	
	    }else{
	     	document.getElementById('surname_a_error').style.display="none";	   	
	    }
	    if(cw_esta_vacio(document.getElementById('asunto'))){
	        ok=false;
	        document.getElementById('asunto_error').style.display="block";	
	    }else{
	     	document.getElementById('asunto_error').style.display="none";	   	
	    }   
	    if(cw_esta_vacio(document.getElementById('mail'))){
	        ok=false;
	        document.getElementById('mail_1_error').style.display="block";	
	    }else{
	     	document.getElementById('mail_1_error').style.display="none";	   	
	    	if(!cw_es_email(document.getElementById('mail'))){
	        	ok=false;    		
	        	document.getElementById('mail_2_error').style.display="block";	
	    	}else{
	     		document.getElementById('mail_2_error').style.display="none";	   	
	    	}
	    }
	    if(cw_esta_vacio(document.getElementById('country'))){
	        ok=false;
	        document.getElementById('country_error').style.display="block";	
	    }else{
	     	document.getElementById('country_error').style.display="none";	   	
	    }    
	    if(cw_esta_vacio(document.getElementById('pref_phone'))){
	        ok=false;
	        document.getElementById('pref_phone_error').style.display="block";	
	    }else{
	     	document.getElementById('pref_phone_error').style.display="none";	   	
	    } 
	    if(cw_esta_vacio(document.getElementById('phone'))){
	        ok=false;
	        document.getElementById('phone_error').style.display="block";	
	    }else{
	     	document.getElementById('phone_error').style.display="none";	   	
	    }
	    if(cw_esta_vacio(document.getElementById('city'))){
	        ok=false;
	        document.getElementById('city_error').style.display="block";	
	    }else{
	     	document.getElementById('city_error').style.display="none";	   	
	    }           
	    if(cw_esta_vacio(document.getElementById('resp_captcha'))){
	        ok=false;
	        document.getElementById('resp_captcha_error').style.display="block";	
	    }else{
	     	document.getElementById('resp_captcha_error').style.display="none";	
	    }                           
	    if(ok){
			var _res_capcha = document.getElementById('resp_captcha').value;//id_txt_capcha
			var _id_capcha = document.getElementById('id_capcha').value;//msg_err_capcha
			var _id_txt_capcha = document.getElementById('id_txt_capcha').value;//
			//alert("1"); 	
	        $.ajax({
	           url: "checkCaptcha.php",
	           type: "POST",
	           dataType: "text",
	           data: {res_capcha: _res_capcha, id_capcha: _id_capcha, id_txt_capcha: _id_txt_capcha},	           		
	           error: function(req, err, obj) {
	           	alert('error_captcha');
	            alert(err);
	           },
	           success: function(txt) {
	           	if (txt == 'OK') {
			        $.ajax({
			           url: "send_ContactForm.php",
			           type: "POST",
			           dataType: "text",
			           data: {
			                name: _name,
			                surname_1: _surname_1,
			                surname_2: _surname_2,
			                mail: _mail,
			                pref_phone: _pref_phone,
			                type: _type,
			                phone: _phone,
			                comment: _comment,
			                country: _country,
			                how_know: _how_know,
			                captcha: _captcha,
			                city: _city
			           },
			           error: function(req, err, obj) {
			            alert(err);
			           },
			           success: function(txt) {
			               if(txt == "OK"){
			                document.getElementById('formulario').style.display="none";               	
			                document.getElementById('principal').style.display="none";
			                document.getElementById('send_ok').style.display="block";
			               }else if (txt == "ERROR"){
			                  document.getElementById('formulario').style.display="none";
			                  document.getElementById('principal').style.display="none";
			                  document.getElementById('send_error').style.display="block";                 	
			               }else{
			                  document.getElementById('formulario').style.display="none";                	
			                  document.getElementById('principal').style.display="none";
			                  document.getElementById('send_error').style.display="block";              	
			               }
			           }
			        });
		    	}else{
					document.getElementById('resp_captcha_error_2').style.display="block";	   		    		
		    	}
	           }
	        });
	    }else{
	    	//alert("error, campos incompletos"); 	
	    }
	    return false;
	}
   function cw_es_email (address) {   
       if(cw_tiene_espacios(address)) return false;
       
       var i = 1;
       var addressLength = address.value.length;
       var fuera = false;
       var car = "";

       // Mirando por la @
       while (!fuera) {
         if(i < addressLength) {
         car =  address.value.substring (i, i+1);
             if(car == "@") fuera=true;
         } else { fuera = true }
         i++;
       } 

       if (i >= addressLength) { return false; } 
       if (car != "@") { return false; } 
       i++;

       // Mirando por el .
       fuera = false;
       car = "";
       while (!fuera) {
         if(i < addressLength) {
             car =  address.value.substring (i, i+1);
             if(car == ".") fuera=true;
         } else { fuera = true }
         i++;
       } 
       if (i >= addressLength) { return false; } 
       if (car != ".") { return false; } 
       return true;
   }
   
 function cw_esta_vacio(variable) { 
        if((variable == null) || (variable.length == 0) || (variable.value == "")) { 
          return true; 
        }
        return false;
    }
    
 function cw_tiene_espacios (variable) {   
       var espacio = " \n\t\r";
       var i;
       for (i = 0; i < variable.value.length; i++) {   
           var car = variable.value.substring (i, i+1);
           if (espacio.indexOf(car) != -1) return true;
       }
       return false;
   }       
   
function checkUser(_form) {
	var _ok = wbValidateFormL(document.getElementById(_form),'es');				
	if (_ok){
		var f = document.getElementById(_form);
		var _usuario = f.user.value;
		var _clave = f.clave.value;
		var data = {usuario: _usuario, 
					clave: _clave};				
		$.ajax({
	           url: "checkLogin.php",
	           type: "POST",
	           dataType: "text",
	           data: data,	           		
	           error: function(req, err, obj) {
	           	alert('error :: ' + err + req.status);
	           },
	           success: function(txt) {           	
		           	if (txt=="OK"){
		           		self.location = "../PPP/Index";
		           		return true;
		           	}else{
		       			alert("El usuario/contrase�a no es v�lido.");
		       			f.usuario.value=_usuario;
		       			return false;
		           	}
	       
	        	}            
	        
	        
			});
		
		
	}
}   

function subscribeNewsletter() {
		var _mail = document.getElementById('mail').value;
		var _country = document.getElementById('country').value;
		var _cp = document.getElementById('cp').value;
		var ok=true;
		document.getElementById('mail_1_error').style.display="none";
		document.getElementById('mail_2_error').style.display="none";
		document.getElementById('mail_3_error').style.display="none";
		document.getElementById('mail_ok').style.display="none";
		
	    if(cw_esta_vacio(document.getElementById('mail')) || document.getElementById('mail').value==name_mail){
	        ok=false;
	        document.getElementById('mail_1_error').style.display="block";	
	    }else{
	     	document.getElementById('mail_1_error').style.display="none";	   	
	    	if(!cw_es_email(document.getElementById('mail'))){
	        	ok=false;    		
	        	document.getElementById('mail_2_error').style.display="block";	
	    	}else{
	     		document.getElementById('mail_2_error').style.display="none";	   	
	    	}
	    }
	    if(cw_esta_vacio(document.getElementById('country'))){
	        ok=false;
	        document.getElementById('country_error').style.display="block";		    		
	    }else{
	        document.getElementById('country_error').style.display="none";		    	
	    }
	    if(cw_esta_vacio(document.getElementById('cp')) || document.getElementById('cp').value==name_cp){
	        ok=false;
	        document.getElementById('cp_error').style.display="block";		    		
	    }else{
	        document.getElementById('cp_error').style.display="none";		    	
	    }	    
	    	    		
	    if(ok){
		var data = {
			mail: _mail,
			country: _country,
			cp: _cp
		};				
		$.ajax({
	           url: "subscribeNewsletter.php",
	           type: "POST",
	           dataType: "text",
	           data: data,	           		
	           error: function(req, err, obj) {
	           	alert('error :: ' + err + req.status);
	           },
	           success: function(txt) {           	
		           	if (txt=="OK"){
		           		document.getElementById('mail_ok').style.display="block";
		           		return true;
		           	}else if (txt=="MAIL_EXIST"){
		           		document.getElementById('mail_3_error').style.display="block";
		       			return false;
		           	}else{
		           		alert("Se produjo un error al procesar su petici�n. Por favor, vuelta a intentarlo tras pasado unos minutos. Gracias.");
		           	}
	       
	        	}            
	        
	        
			});
		
		
	}
}
function addAcademicData(){
	var n_academic_data=document.getElementById('n_academic_data').value;	
	var site = document.getElementById('academic_Block');
	var content_academic_data;
	
	content_academic_data=dic_academic_data+' '+ (parseFloat(n_academic_data) + 1 ) +
				   ' <div class="fila_tab">'+
                   '	<label for="titulacion_'+n_academic_data+'">'+nivel_estudios+':</label>'+
                   '	<select id="titulacion_'+n_academic_data+'" name="titulacion_'+n_academic_data+'" onchange="SelectTitulacion(this.value, \'especialidad_'+n_academic_data+'\',\'colegiacion_'+n_academic_data+'\',\'otros_'+n_academic_data+'\')">'+
                   '		<option value="" >'+seleccione+'</option>'+  
                   titulaciones +       	
                   '     </select>'+
                   ' </div>'+
                   ' <div class="fila_tab">'+
                   ' 	<label for="career_'+n_academic_data+'">'+career+':</label>'+
                   '     <input id="career_'+n_academic_data+'" name="career_'+n_academic_data+'" type="text" />'+
                   ' </div>'+
                   //' <br />'+
                   ' <div class="fila_tab">'+
                   ' 	<label for="especialidad_'+n_academic_data+'">'+especialidad+':</label>'+
                   '     <input id="especialidad_'+n_academic_data+'" name="especialidad_'+n_academic_data+'" type="text" />'+
                   ' </div>'+
                   /*' <div class="fila_tab">'+
                   ' <label for="especialidad_otras_'+n_academic_data+'">'+otra_especialidades+':</label>'+
                   '     <input id="especialidad_otras_'+n_academic_data+'" name="especialidad_otras_'+n_academic_data+'" type="text" />'+
                   ' </div>'+*/
                   '<div class="fila_tab">'+
                   ' 	<label for="day_form_start_date_'+n_academic_data+'">'+dic_start_date+':</label>'+
                   '     <select class="select_b" id="day_form_start_date_'+n_academic_data+'" name="day_form_start_date_'+n_academic_data+'">'+
                   '     	<option value="0">'+dic_day+'</option>';
                   for(ii=1;ii<=31;ii++){
                   		content_academic_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_academic_data += '     </select>'+
                   '     <label class="none" for="month_form_start_date_'+n_academic_data+'"></label>'+
                   '     <select class="select_b" id="month_form_start_date_'+n_academic_data+'" name="month_form_start_date_'+n_academic_data+'">'+
                   '     	<option value="0">'+dic_month+'</option>'+
                   '     	<option value="1">'+enero+'</option>'+
                   '     	<option value="2">'+febrero+'</option>'+
                   '     	<option value="3">'+marzo+'</option>'+
                   '     	<option value="4">'+abril+'</option>'+
                   '     	<option value="5">'+mayo+'</option>'+
                   '     	<option value="6">'+junio+'</option>'+
                   '     	<option value="7">'+julio+'</option>'+
                   '     	<option value="8">'+agosto+'</option>'+
                   '     	<option value="9">'+septiembre+'</option>'+
                   '     	<option value="10">'+octubre+'</option>'+
                   '     	<option value="11">'+noviembre+'</option>'+
                   '     	<option value="12">'+diciembre+'</option>'+
                   '     </select>'+
                   '     <label class="none" for="year_form_start_date_'+n_academic_data+'"></label>'+
                   '     <select class="select_b" id="year_form_start_date_'+n_academic_data+'" name="year_form_start_date_'+n_academic_data+'">'+
                   '    	<option value="0">'+dic_year+'</option>';
                   var fecha = new Date ();
					var year_select = 1900 + fecha.getYear();
                   for(ii=1950;ii<=year_select+1;ii++){
                   		content_academic_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_academic_data += '     </select>'+
                   ' </div>'+
                    
                    '<div class="fila_tab">'+
                   ' 	<label for="day_form_end_date_'+n_academic_data+'">'+dic_end_date+':</label>'+
                   '     <select class="select_b" id="day_form_end_date_'+n_academic_data+'" name="day_form_end_date_'+n_academic_data+'">'+
                   '     	<option value="0">'+dic_day+'</option>';
                   for(ii=1;ii<=31;ii++){
                   		content_academic_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_academic_data += '     </select>'+
                   '     <label class="none" for="month_form_end_date_'+n_academic_data+'"></label>'+
                   '     <select class="select_b" id="month_form_end_date_'+n_academic_data+'" name="month_form_end_date_'+n_academic_data+'">'+
                   '     	<option value="0">'+dic_month+'</option>'+
                   '     	<option value="1">'+enero+'</option>'+
                   '     	<option value="2">'+febrero+'</option>'+
                   '     	<option value="3">'+marzo+'</option>'+
                   '     	<option value="4">'+abril+'</option>'+
                   '     	<option value="5">'+mayo+'</option>'+
                   '     	<option value="6">'+junio+'</option>'+
                   '     	<option value="7">'+julio+'</option>'+
                   '     	<option value="8">'+agosto+'</option>'+
                   '     	<option value="9">'+septiembre+'</option>'+
                   '     	<option value="10">'+octubre+'</option>'+
                   '     	<option value="11">'+noviembre+'</option>'+
                   '     	<option value="12">'+diciembre+'</option>'+
                   '     </select>'+
                   '     <label class="none" for="year_form_end_date_'+n_academic_data+'"></label>'+
                   '     <select class="select_b" id="year_form_end_date_'+n_academic_data+'" name="year_form_end_date_'+n_academic_data+'">'+
                   '    	<option value="0">'+dic_year+'</option>';
					var fecha = new Date ();
					var year_select = 1900 + fecha.getYear();
                   for(ii=1950;ii<=year_select+1;ii++){
                   		content_academic_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_academic_data += '     </select>'+
                   '<div class="add_datos">'+
				   '  	<input class="checkbox" id="form_end_date_actual_'+n_academic_data+'" name="form_end_date_actual_'+n_academic_data+'" type="checkbox" value="si" /> <label class="lab_normal" for="form_end_date_actual_'+n_academic_data+'">'+cursando+'</label>'+
                   '  </div>'+
                   ' </div>';
                  	
	    div = document.createElement("div");
	    site.appendChild(div);
	    div.setAttribute('id','academic_data_'+n_academic_data);
	    $("#academic_data_"+n_academic_data).html(content_academic_data);
		document.getElementById('n_academic_data').value=parseFloat(document.getElementById('n_academic_data').value)+1;
} 
function removeAcademicData(){
	if(document.getElementById('n_academic_data').value>1){
		document.getElementById('n_academic_data').value=parseFloat(document.getElementById('n_academic_data').value)-1;	
		var n_academic_data=document.getElementById('n_academic_data').value;	
		var site = document.getElementById('academic_Block');	
		var div_remove;	
		div_remove = document.getElementById('academic_data_'+n_academic_data);
		div_remove.parentNode.removeChild(div_remove);		
	}else{
		alert("No existen registros que borrar");
	}
}

function addExperienceData(){
	var n_experience_data=document.getElementById('n_experience_data').value;	
	var site = document.getElementById('experience_Block');
	var content_experience_data;
	
	content_experience_data=dic_dato_experiencia+' '+ (parseFloat(n_experience_data) + 1 ) +
				   ' <div class="fila_tab">'+
                   ' 	<label for="exp_company_'+n_experience_data+'">'+company+':</label>'+
                   '     <input id="exp_company_'+n_experience_data+'" name="exp_company_'+n_experience_data+'" type="text" />'+
                   ' </div>'+
                   ' <div class="fila_tab">'+
                   '	<label for="company_area_'+n_experience_data+'">'+company_area+':</label>'+
                   '	<select id="company_area_'+n_experience_data+'" name="company_area_'+n_experience_data+'" onchange="SelectTitulacion(this.value, \'especialidad_'+n_experience_data+'\',\'colegiacion_'+n_experience_data+'\',\'otros_'+n_experience_data+'\')">'+
                   '		<option value="" >'+seleccione+'</option>'+  
                   areas +       	
                   '     </select>'+
                   ' </div>'+
                   '<div class="fila_tab">'+
                   ' 	<label for="day_exp_start_date_'+n_experience_data+'">'+dic_start_date+':</label>'+
                   '     <select class="select_b" id="day_exp_start_date_'+n_experience_data+'" name="day_exp_start_date_'+n_experience_data+'">'+
                   '     	<option value="0">'+dic_day+'</option>';
                   for(ii=1;ii<=31;ii++){
                   		content_experience_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_experience_data += '     </select>'+
                   '     <label class="none" for="month_exp_start_date_'+n_experience_data+'"></label>'+
                   '     <select class="select_b" id="month_exp_start_date_'+n_experience_data+'" name="month_exp_start_date_'+n_experience_data+'">'+
                   '     	<option value="0">'+dic_month+'</option>'+
                   '     	<option value="1">'+enero+'</option>'+
                   '     	<option value="2">'+febrero+'</option>'+
                   '     	<option value="3">'+marzo+'</option>'+
                   '     	<option value="4">'+abril+'</option>'+
                   '     	<option value="5">'+mayo+'</option>'+
                   '     	<option value="6">'+junio+'</option>'+
                   '     	<option value="7">'+julio+'</option>'+
                   '     	<option value="8">'+agosto+'</option>'+
                   '     	<option value="9">'+septiembre+'</option>'+
                   '     	<option value="10">'+octubre+'</option>'+
                   '     	<option value="11">'+noviembre+'</option>'+
                   '     	<option value="12">'+diciembre+'</option>'+
                   '     </select>'+
                   '     <label class="none" for="year_exp_start_date_'+n_experience_data+'"></label>'+
                   '     <select class="select_b" id="year_exp_start_date_'+n_experience_data+'" name="year_exp_start_date_'+n_experience_data+'">'+
                   '    	<option value="0">'+dic_year+'</option>';
                   var fecha = new Date ();
					var year_select = 1900 + fecha.getYear();
                   for(ii=1950;ii<=year_select+1;ii++){
                   		content_experience_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_experience_data += '     </select>'+
                   ' </div>'+
                    
                    '<div class="fila_tab">'+
                   ' 	<label for="day_exp_end_date_'+n_experience_data+'">'+dic_end_date+':</label>'+
                   '     <select class="select_b" id="day_exp_end_date_'+n_experience_data+'" name="day_exp_end_date_'+n_experience_data+'">'+
                   '     	<option value="0">'+dic_day+'</option>';
                   for(ii=1;ii<=31;ii++){
                   		content_experience_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_experience_data += '     </select>'+
                   '     <label class="none" for="month_exp_end_date_'+n_experience_data+'"></label>'+
                   '     <select class="select_b" id="month_exp_end_date_'+n_experience_data+'" name="month_exp_end_date_'+n_experience_data+'">'+
                   '     	<option value="0">'+dic_month+'</option>'+
                   '     	<option value="1">'+enero+'</option>'+
                   '     	<option value="2">'+febrero+'</option>'+
                   '     	<option value="3">'+marzo+'</option>'+
                   '     	<option value="4">'+abril+'</option>'+
                   '     	<option value="5">'+mayo+'</option>'+
                   '     	<option value="6">'+junio+'</option>'+
                   '     	<option value="7">'+julio+'</option>'+
                   '     	<option value="8">'+agosto+'</option>'+
                   '     	<option value="9">'+septiembre+'</option>'+
                   '     	<option value="10">'+octubre+'</option>'+
                   '     	<option value="11">'+noviembre+'</option>'+
                   '     	<option value="12">'+diciembre+'</option>'+
                   '     </select>'+
                   '     <label class="none" for="year_exp_end_date_'+n_experience_data+'"></label>'+
                   '     <select class="select_b" id="year_exp_end_date_'+n_experience_data+'" name="year_exp_end_date_'+n_experience_data+'">'+
                   '    	<option value="0">'+dic_year+'</option>';
                   var fecha = new Date ();
					var year_select = 1900 + fecha.getYear();
                   for(ii=1950;ii<=year_select+1;ii++){
                   		content_experience_data += '     	<option value="'+ii+'">'+ii+'</option>';
                   }
                   content_experience_data += '     </select>'+
                   '<div class="add_datos">'+
                   '  	<input class="checkbox" id="exp_end_date_actual_'+n_experience_data+'" name="exp_end_date_actual_'+n_experience_data+'" type="checkbox" value="si" /> <label class="lab_normal" for="exp_end_date_actual_'+n_experience_data+'">'+actual+'</label>'+
                   '  </div>'+
                   ' </div>' +
                   //' <br />'+
                   ' <div class="fila_tab">'+
                   ' 	<label for="exp_position_'+n_experience_data+'">'+position+':</label>'+
                   '     <input id="exp_position_'+n_experience_data+'" name="exp_position_'+n_experience_data+'" type="text" />'+
                   ' </div>'+
                   ' <div class="fila_tab">'+
                   ' <label for="exp_activities_'+n_experience_data+'">'+activities+':</label>'+
                   '     <input id="exp_activities_'+n_experience_data+'" name="exp_activities_'+n_experience_data+'" type="text" />'+
                   ' </div>';
                  	
	    div = document.createElement("div");
	    site.appendChild(div);
	    div.setAttribute('id','experience_data_'+n_experience_data);
	    $("#experience_data_"+n_experience_data).html(content_experience_data);
		document.getElementById('n_experience_data').value=parseFloat(document.getElementById('n_experience_data').value)+1;
} 
function removeExperienceData(){
	if(document.getElementById('n_experience_data').value>1){
		document.getElementById('n_experience_data').value=parseFloat(document.getElementById('n_experience_data').value)-1;	
		var n_experience_data=document.getElementById('n_experience_data').value;	
		var site = document.getElementById('experience_Block');	
		var div_remove;	
		div_remove = document.getElementById('experience_data_'+n_experience_data);
		div_remove.parentNode.removeChild(div_remove);		
	}else{
		alert("No existen registros que borrar");
	}
}

function SelectTitulacion(id_titulacion,id_select_especialidad,id_select_colegio,id_input_otros_estudios){
	if (id_titulacion != '') {
		    $.ajax({
		        url: "getEspecialidadesByTitulacion.php",
		        type: "POST",
		        dataType: "xml",		        
		        data: {id_titulacion: id_titulacion},
		        error: function(req, err, obj) {
		            alert('Error: ' + req.status + err);
		        },
		        success: function(xml) {
		        	
		        	
		        	
		            var res = $("res",xml).text();
		            var text = $("text",xml).text();		            
		            var num_ramas = $("num_ramas",xml).text();		            
		            if (res == "OK") {
			        	
		            	$("#"+id_select_especialidad).text('');
		            	$("#"+id_select_especialidad).append('<option></option>');
		            	$("#"+id_select_especialidad).append('<option value="OTROS">Otros</option>');
		            	
		            	var id = '';
						var name = '';
						var colegio = '';
						var position = 1;
		            	
			        	$("especialidad", xml).each(function() {

							id = $("id",this).text();
							name = $("name",this).text(); 
							colegio = $("colegio",this).text(); 
							

							$("#"+id_select_especialidad).append('<option value="'+id+'">'+name+'</option>');
							
							
							if((colegio == '1')&&(position == num_ramas)){
								alert(name+ l_dic_oblig_rama);
							}
							position ++ ;
			        	})
			        	
			        	$('#'+id_select_especialidad).removeAttr('disabled');
			        	$('#'+id_select_colegio).removeAttr('disabled');
			        		
		            } else 
		            	alert (text);
		        }
		    });
		    /*
   			if (id_titulacion == 'OTROS') {
				//Añadimos los campos extra para el validateforms
				document.form_cv.elements['wbRequired_' + id_input_otros_estudios].value = "true";
				document.form_cv.elements['wbRequired_' + id_select_especialidad].value = "false";
				$('#'+id_input_otros_estudios).removeAttr('disabled');
   			} else {
				document.form_cv.elements['wbRequired_' + id_input_otros_estudios].value = "false";
				document.form_cv.elements['wbRequired_' + id_select_especialidad].value = "true";
				$('#'+id_input_otros_estudios).attr('disabled');
   			}
 			*/
	}
	
}

function SelectRama(id_colegio,id_select_especialidad,id_select_colegio,id_otros_especialidades){
	//Miramos el valor del select de la especialidad
	var especialidad = $("#"+id_select_especialidad+" option:selected").val();        
	var especialidad_text = $("#"+id_select_especialidad+" option:selected").text();        
	
    $.ajax({
        url: "getColegiacionByEspecialidad.php",
        type: "POST",
        dataType: "xml",		        
        data: {id_especialidad: especialidad},
        error: function(req, err, obj) {
            alert('Error: ' + req.status + err);
        },
        success: function(xml) {
            var res = $("res",xml).text();
            var text = $("text",xml).text();		            
            if (res == "OK") {		            	
            	$("colegio", xml).each(function() {
					var value = $("value",this).text();
					
					/*if((value != id_colegio)&&(value == '1')){
						alert(l_dic_debes_colegio);									
						document.getElementById(id_select_colegio).selectedIndex = 0;
					}*/
					if(value == 1)
						alert(especialidad_text+ l_dic_oblig_cole);
										
	        	})					
            }
            	

            
        }
    });
}      
function addIdiomas(){
	var n_idiomas=document.getElementById('n_idiomas').value;	
	var site = document.getElementById('idiomas_Block');
	var content_idiomas;
	content_idiomas ='' +
				  dic_dato_idiomas+' '+ (parseFloat(n_idiomas) + 1 ) +              
				  '  	<div class="fila_tab">' +
                  '  	<label for="lang_'+n_idiomas+'"> '+idioma+':</label>' +
                  '      <select id="lang_'+n_idiomas+'" name="lang_'+n_idiomas+'">' +
                  '      	<option value="" >'+seleccione+'</option>' +
                  '      	<option value="0">Spanish</option>' +
                  '      	<option value="1">German</option>' +
                  '      	<option value="2">English</option>' +
                  '      	<option value="3">French</option>' +
                  '      	<option value="4">Italian</option>' +
                  '      	<option value="5">Japanese</option>' +
                  '      	<option value="6">Chinese</option>' +
                  '      </select>' +
                  '  </div>' +
                  '  <div class="fila_tab">' +
                  '  	<label for="level_hablado_'+n_idiomas+'"> '+nivel_hablado+':</label>' +
                  '      <select id="level_hablado_'+n_idiomas+'" name="level_hablado_'+n_idiomas+'">' +
                  '      	<option value="" >'+seleccione+'</option>' +
                  '      	<option value="0">'+low+'</option>' +
                  '      	<option value="1">'+medium+'</option>' +
                  '      	<option value="2">'+high+'</option>' +
                  '      </select>' +
                  '  </div>' +
                  '  <div class="fila_tab">' +
                  '  	<label for="level_escrito_'+n_idiomas+'"> '+nivel_escrito+':</label>' +
                  '      <select id="level_escrito_'+n_idiomas+'" name="level_escrito_'+n_idiomas+'">' +
                  '      	<option value="" >'+seleccione+'</option>' +
                  '      	<option value="0">'+low+'</option>' +
                  '      	<option value="1">'+medium+'</option>' +
                  '      	<option value="2">'+high+'</option>' +
                  '      </select>' +
                  '  </div>' +	
                  '  <div class="fila_tab">' +
                  '  	<label for="level_traduccion_'+n_idiomas+'"> '+nivel_traduccion+':</label>' +
                  '      <select id="level_traduccion_'+n_idiomas+'" name="level_traduccion_'+n_idiomas+'">' +
                  '      	<option value="" >'+seleccione+'</option>' +
                  '      	<option value="0">'+low+'</option>' +
                  '      	<option value="1">'+medium+'</option>' +
                  '      	<option value="2">'+high+'</option>' +
                  '      </select>' +
                  '  </div>';	
	    div = document.createElement("div");
	    site.appendChild(div);
	    div.setAttribute('id','idiomas_'+n_idiomas);
	    $("#idiomas_"+n_idiomas).html(content_idiomas);
		document.getElementById('n_idiomas').value=parseFloat(document.getElementById('n_idiomas').value)+1;
} 
function removeIdiomas(){
	if(document.getElementById('n_idiomas').value>1){
		document.getElementById('n_idiomas').value=parseFloat(document.getElementById('n_idiomas').value)-1;	
		var n_idiomas=document.getElementById('n_idiomas').value;	
		var site = document.getElementById('idiomas_Block');	
		var div_remove;	
		div_remove = document.getElementById('idiomas_'+n_idiomas);
		div_remove.parentNode.removeChild(div_remove);		
	}else{
		alert("No existen registros que borrar");
	}
}
function addOfimatica(){
	var n_ofimatica=document.getElementById('n_ofimatica').value;	
	var site = document.getElementById('ofimatica_Block');
	var content_ofimatica;
	content_ofimatica ='' +
				  dic_dato_ofimatica +' '+ (parseFloat(n_ofimatica) + 1 ) +              
				  '  	<div class="fila_tab">' +
                  '  	<label for="ofimatica_programa_'+n_ofimatica+'"> '+program+':</label>' +
                  '      <input id="ofimatica_programa_'+n_ofimatica+'" name="ofimatica_programa_'+n_ofimatica+'" type="text" />' +
                  '  </div>' +
                  '  <div class="fila_tab">' +
                  '  	<label for="level_ofimatica_'+n_ofimatica+'"> '+nivel+':</label>' +
                  '      <select id="level_ofimatica_'+n_ofimatica+'" name="level_ofimatica_'+n_ofimatica+'">' +
                  '      	<option value="" >'+seleccione+'</option>' +
                  '      	<option value="0">'+low+'</option>' +
                  '      	<option value="1">'+medium+'</option>' +
                  '      	<option value="2">'+high+'</option>' +
                  '      </select>' +
                  '  </div>';	
	    div = document.createElement("div");
	    site.appendChild(div);
	    div.setAttribute('id','ofimatica_'+n_ofimatica);
	    $("#ofimatica_"+n_ofimatica).html(content_ofimatica);
		document.getElementById('n_ofimatica').value=parseFloat(document.getElementById('n_ofimatica').value)+1;
} 
function removeOfimatica(){
	if(document.getElementById('n_ofimatica').value>1){
		document.getElementById('n_ofimatica').value=parseFloat(document.getElementById('n_ofimatica').value)-1;	
		var n_ofimatica=document.getElementById('n_ofimatica').value;	
		var site = document.getElementById('ofimatica_Block');	
		var div_remove;	
		div_remove = document.getElementById('ofimatica_'+n_ofimatica);
		div_remove.parentNode.removeChild(div_remove);		
	}else{
		alert("No existen registros que borrar");
	}
}
function checkForm() {
		document.getElementById('resp_captcha_error_2').style.display="none";		
		var _res_capcha = document.getElementById('resp_captcha').value;//id_txt_capcha
		var _id_capcha = document.getElementById('id_capcha').value;//msg_err_capcha
		var _id_txt_capcha = document.getElementById('id_txt_capcha').value;//
	    var ok = true;
	    
	    
	    if(cw_esta_vacio(document.getElementById('name'))){
	        ok=false;
	    	document.getElementById('name_error').style.display="block";	        
	    }else{
	    	document.getElementById('name_error').style.display="none";	    	
	    }
	    
	    
	    if(cw_esta_vacio(document.getElementById('surname'))){
	        ok=false;
	        document.getElementById('surname_a_error').style.display="block";	
	    }else{
	     	document.getElementById('surname_a_error').style.display="none";	   	
	    } 
	    
	    ////birthday
	    
	    if(cw_esta_vacio(document.getElementById('email'))){
	        ok=false;
	        document.getElementById('mail_1_error').style.display="block";	
	    }else{
	     	document.getElementById('mail_1_error').style.display="none";	   	
	    	if(!cw_es_email(document.getElementById('email'))){
	        	ok=false;    		
	        	document.getElementById('mail_2_error').style.display="block";	
	    	}else{
	     		document.getElementById('mail_2_error').style.display="none";	   	
	    	}
	    }
	    
	    if(cw_esta_vacio(document.getElementById('country'))){
	        ok=false;
	        document.getElementById('country_error').style.display="block";	
	    }else{
	     	document.getElementById('country_error').style.display="none";	   	
	    }   
	     
	    /*if(cw_esta_vacio(document.getElementById('pref_phone'))){
	        ok=false;
	        document.getElementById('pref_phone_error').style.display="block";	
	    }else{
	     	document.getElementById('pref_phone_error').style.display="none";	   	
	    } */
	    
	    
	    /*if(cw_esta_vacio(document.getElementById('phone'))){
	        ok=false;
	        document.getElementById('phone_error').style.display="block";	
	    }else{
	     	document.getElementById('phone_error').style.display="none";	   	
	    }*/
	    
	    if(cw_esta_vacio(document.getElementById('town'))){
	        ok=false;
	        document.getElementById('city_error').style.display="block";	
	    }else{
	     	document.getElementById('city_error').style.display="none";	   	
	    }  

	    if(cw_esta_vacio(document.getElementById('resp_captcha'))){
	        ok=false;
	        document.getElementById('resp_captcha_error').style.display="block";	
	    }else{
	     	document.getElementById('resp_captcha_error').style.display="none";	
	    }     

	    if(cw_esta_vacio(document.getElementById('address'))){
	        ok=false;
	        document.getElementById('address_error').style.display="block";	
	    }else{
	     	document.getElementById('address_error').style.display="none";	   	
	    }	
	    
	    if(cw_esta_vacio(document.getElementById('prov'))){
	        ok=false;
	        document.getElementById('prov_error').style.display="block";	
	    }else{
	     	document.getElementById('prov_error').style.display="none";	   	
	    }
	    
	    /*if(cw_esta_vacio(document.getElementById('age'))){
	        ok=false;
	        document.getElementById('age_error').style.display="block";	
	    }else{
	     	document.getElementById('age_error').style.display="none";	   	
	    }	*/	    		        
	    
	    /*if(cw_esta_vacio(document.getElementById('nacionalidad'))){
	        ok=false;
	        document.getElementById('nacionalidad_error').style.display="block";	
	    }else{
	     	document.getElementById('nacionalidad_error').style.display="none";	   	
	    }*/		    		        
	    
	    ////
	    if(cw_esta_vacio(document.getElementById('titulacion_0'))){
	        ok=false;
	    	document.getElementById('titulacion_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('titulacion_0_error').style.display="none";	    	
	    }
	    
	    if(cw_esta_vacio(document.getElementById('career_0'))){
	        ok=false;
	    	document.getElementById('career_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('career_0_error').style.display="none";	    	
	    }
	    
	    if(cw_esta_vacio(document.getElementById('exp_company_0'))){
	        ok=false;
	    	document.getElementById('exp_company_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('exp_company_0_error').style.display="none";	    	
	    }
	    
	    if((cw_esta_vacio(document.getElementById('day_exp_start_date_0'))) || (cw_esta_vacio(document.getElementById('month_exp_start_date_0'))) || (cw_esta_vacio(document.getElementById('year_exp_start_date_0')))){
	        ok=false;
	    	document.getElementById('exp_start_date_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('exp_start_date_0_error').style.display="none";	    	
	    }
	    
	    if(((cw_esta_vacio(document.getElementById('day_exp_end_date_0'))) || (cw_esta_vacio(document.getElementById('month_exp_end_date_0'))) || (cw_esta_vacio(document.getElementById('year_exp_end_date_0')))) && (!(document.getElementById('exp_end_date_actual_0').checked))){
	        ok=false;
	    	document.getElementById('exp_end_date_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('exp_end_date_0_error').style.display="none";	    	
	    }
	    
	    if((cw_esta_vacio(document.getElementById('day_form_start_date_0'))) || (cw_esta_vacio(document.getElementById('month_form_start_date_0'))) || (cw_esta_vacio(document.getElementById('year_form_start_date_0')))){
	        ok=false;
	    	document.getElementById('form_start_date_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('form_start_date_0_error').style.display="none";	    	
	    }
	    
	    if(((cw_esta_vacio(document.getElementById('day_form_end_date_0'))) || (cw_esta_vacio(document.getElementById('month_form_end_date_0'))) || (cw_esta_vacio(document.getElementById('year_form_end_date_0')))) && (!(document.getElementById('form_end_date_actual_0').checked))){
	        ok=false;
	    	document.getElementById('form_end_date_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('form_end_date_0_error').style.display="none";	    	
	    }
	    
	    if((cw_esta_vacio(document.getElementById('day_form_start_date_0'))) || (cw_esta_vacio(document.getElementById('month_form_start_date_0'))) || (cw_esta_vacio(document.getElementById('year_form_start_date_0')))){
	        ok=false;
	    	document.getElementById('form_start_date_0_error').style.display="block";	        
	    }else{
	    	document.getElementById('form_start_date_0_error').style.display="none";	    	
	    }
	    
	    if((cw_esta_vacio(document.getElementById('day_birth'))) || (cw_esta_vacio(document.getElementById('month_birth'))) || (cw_esta_vacio(document.getElementById('year_birth')))){
	        ok=false;
	    	document.getElementById('birth_error').style.display="block";	        
	    }else{
	    	document.getElementById('birth_error').style.display="none";	    	
	    }
	    
	    if(document.getElementById('disclaimer').checked != true){
	        ok=false;
	    	document.getElementById('disclaimer_error').style.display="block";	        
	    }else{
	    	document.getElementById('disclaimer_error').style.display="none";	    	
	    }
	    
	    /*if(document.getElementById('disclaimer_lopd').checked != true){
	        ok=false;
	    	document.getElementById('disclaimer_lopd_error').style.display="block";	        
	    }else{
	    	document.getElementById('disclaimer_lopd_error').style.display="none";	    	
	    }*/
	    ////
	    if(document.getElementById('cv_file').value.length < 4){
	        ok=false;
	    	document.getElementById('cv_file_error').style.display="block";	        
	    }else{
	    	document.getElementById('cv_file_error').style.display="none";	    	
	    }
	    //alert('123'+document.getElementById('cv_file').value.length);
	    
	    if(ok){		
			//alert("1"); 	
	        $.ajax({
	           url: "checkCaptcha.php",
	           type: "POST",
	           dataType: "text",
	           data: {res_capcha: _res_capcha, id_capcha: _id_capcha, id_txt_capcha: _id_txt_capcha},	           		
	           error: function(req, err, obj) {
	           	alert('error_captcha');
	            alert(err);
	           },
	           success: function(txt) {
	           	if (txt == 'OK') { 
					document.form_cv.submit();
	           	} else {
					document.getElementById('resp_captcha_error_2').style.display="block";	           		
	           	}  
	           	return ok;        	
	           }          
	        }); 
	    }       
}

function getProyect(){
	var txt;
	//txt=$(".current").text();
	txt=$(".current").find("#id_proyect").text();
	$("li#"+txt).addClass("li_active");
	//alert("ENTRA: "+txt);
}
