﻿// JavaScript Document
var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {
   browserType= "gecko"
}


function del_image(p_image_id,p_user_id,p_tipo,pn)
{
	if(confirm('¿Esta seguro que desea borrar su foto nº '+pn+'?')) 
	{
	  $.ajax({
		   type: "POST",
		   url: "eliminar_imagen.asp",
		   data: "p_foto_id="+p_image_id,
			   success: function(msg){
				 window.parent.location="arc_add_foto.asp?section=1&p_user_id="+p_user_id+"&p_type_user="+p_tipo;
				  
				  
			   }
	});			
	}
}
function reset_form_buscador()
{
	document.ar_form_datos.p_city.selectedIndex=0;
	document.getElementById("p_cadena").value="";
	
	 

}

function show_alert_foto(p_user_id)
{
	 
}

function check_messages(p_user_id,p_tipo)
{
	//primero aparece a los 5 segundos
ID=window.setTimeout("check_alertas_dinamicos();",5000);
	
}
function check_alertas_dinamicos()
{
	ID=window.setTimeout("check_alertas_dinamicos();",1800000);
 	document.getElementById("arc_update_reclamo").style.visibility="visible"; 
	document.getElementById("arc_update_foto").style.visibility="visible"; 
	
				
    
}
function arc_close_buscador_folder(p_folder_id,p_accion_id,p_user_id,p_tipo)
{
 
	if(p_accion_id==0){
	 document.getElementById("arc_bus_"+p_folder_id).innerHTML="<img src=images/hspacer.gif width=1 height=1>";
	 document.getElementById("arc_cerrar_"+p_folder_id).innerHTML="<a href='javascript:arc_close_buscador_folder("+p_folder_id+",1,"+p_user_id+","+p_tipo+");'><img src='images/b_arrow_down.jpg' width='13' height='13'  border=0/></a>"
	}
	else{
	 document.getElementById("arc_bus_"+p_folder_id).innerHTML="Cargando...";
	 document.getElementById("arc_cerrar_"+p_folder_id).innerHTML="<a href='javascript:arc_close_buscador_folder("+p_folder_id+",0,"+p_user_id+","+p_tipo+");'><img src='images/b_arrow_up.jpg' width='13' height='13'  border=0/></a>"	
	 	  $.ajax({
		   type: "POST",
		   url: "acr_busca_opcion.asp",
		   data: "p_id="+p_folder_id+"&p_user_id="+p_user_id+"&p_type_user="+p_tipo,
			   success: function(msg){
				 document.getElementById("arc_bus_"+p_folder_id).innerHTML=msg;
				  
				  
			   }
			});	
	 }
 }

function init_banners()
{
	document.getElementById("banner_text").innerHTML="Cargando...";
	 $.ajax({
		   type: "POST",
		   url: "arc_textos_banner_home.asp",
		   data: "p_id="+parseInt(document.getElementById("banner_id").value),
			   success: function(msg){
				 //  $("div:hidden:home_text_main").fadeIn("slow");
				   $('#banner_text').fadeIn('200', function() {
        // Animation complete
		
      });
				  document.getElementById("banner_text").innerHTML=msg;		
				  if (parseInt(document.getElementById("banner_id").value)==1)
				  document.getElementById("banner_id").value=2;
				  else  document.getElementById("banner_id").value=1;
				  
				  
			   }
	});	 	
	/*
ID=window.setTimeout("init_banners();",15000);

 document.getElementById("banner_text").innerHTML="Cargando...";
 
// 
 
	 $.ajax({
		   type: "POST",
		   url: "arc_textos_banner_home.asp",
		   data: "p_id="+parseInt(document.getElementById("banner_id").value),
			   success: function(msg){
				 //  $("div:hidden:home_text_main").fadeIn("slow");
				   $('#banner_text').fadeIn('200', function() {
        // Animation complete
		
      });
				  document.getElementById("banner_text").innerHTML=msg;		
				  if (parseInt(document.getElementById("banner_id").value)==1)
				  document.getElementById("banner_id").value=2;
				  else  document.getElementById("banner_id").value=1;
				  
				  
			   }
	});	 	 
 			
	*/		   			      
 
}

function set_user_foto(p_foto_id,p_user_id)
{
	document.getElementById("usr_foto").innerHTML="Cargando...";
	  $.ajax({
		   type: "POST",
		   url: "get_user_foto_activa.asp",
		   data: "p_foto_id="+p_foto_id+"&p_user_id="+p_user_id,
			   success: function(msg){
				   //alert("<img src='upload_docs/"+p_user_id+"/"+msg+" border=0>");
				  document.getElementById("usr_foto").innerHTML="<img src='upload_docs/"+p_user_id+"/"+msg+"' border=0>";
				  
				  
			   }
	});	 	
}

function set_es_user(p_reclamo_id,p_user_id,ptotal)
{
	
	$.ajax({
		   type: "POST",
		   url: "check_recomendar.asp",
		   data: "p_reclamo_id="+p_reclamo_id+"&p_user_id="+p_user_id,
			   success: function(msg){
		 			if(msg==0)
					{
							 document.getElementById("recomendar_"+p_reclamo_id+"_"+ptotal).innerHTML="Cargando...";
						  $.ajax({
					   type: "POST",
					   url: "arc_es_recomendado.asp",
					   data: "p_reclamo_id="+p_reclamo_id+"&p_user_id="+p_user_id,
						   success: function(msg){
							  //document.getElementById(pcont+"_recomendar_"+p_reclamo_id).innerHTML="Elevator Speech recomendado";
							  document.getElementById("recomendar_"+p_reclamo_id+"_"+ptotal).innerHTML="Reclamo recomendado";
							  document.getElementById("visits_"+p_reclamo_id).innerHTML="";
				  
				  
			   }
	});	 
					}
					else alert("Ya ha recomendado este reclamo anteriormente.");
			   }
	});
	/*
	

 */
}


 
function close_div_contacto_cp(p_div)
{
		document.getElementById(p_div).innerHTML='<img src=images/hspacer.gif width=1 height=1>';
}



function change_c(p_id,p_perfil_id,p_user_id,p_total)
{
    //document.getElementById("numero_perfil").value=p_id;
	 for(i=1;i<=p_total;i++)
	{
		$('#perfil_'+i).attr('class', 'texto_formularios_registro_titulares');
	} 
	$('#perfil_'+p_id).attr('class', 'texto_plano_orange_box');
	
	document.getElementById("perfil_ver").innerHTML='<a href="arc_reenviar_perfil_c.asp?p_user_id='+p_user_id+'&p_type_user=2&p_perfil_id='+p_perfil_id+'">Reenviar mi perfil a un contacto ARCjob</a>';
// <a href="arc_view_perfil.asp?p_typeuser=2&p_perfil_id='+p_perfil_id+'&p_user_id='+p_user_id+'&p_id=

	document.getElementById("perfil_ver_demas").innerHTML='<a href="arc_view_perfil.asp?p_typeuser=2&p_perfil_id='+p_perfil_id+'&p_user_id='+p_user_id+'&p_id='+p_user_id+'" target="_blank">Ver mi perfil como lo ven los demás</A>';
	
	
	document.getElementById("perfil_borrar").innerHTML='<a href="javascript:del_perfil('+p_perfil_id+','+p_user_id+','+p_id+');">Borrar mi perfil</a>';
	
	
	document.getElementById("ver_mi_perfil").innerHTML='<a href="arc_view_perfil.asp?p_typeuser=2&p_perfil_id='+p_perfil_id+'&p_user_id='+p_user_id+'&p_id='+p_user_id+'" target="_blank">Ver perfil</a>';
	
	//
	
	
	
}

function ver_contactos_de(p_id,p_own_id,p_div)
{
	
	document.getElementById(p_div+p_id).innerHTML='Cargando contactos...';
	$.ajax({
		   type: "POST",
		   url: "arc_get_contactos_de.asp",
		   data: "p_de_user_id="+p_id+"&p_user_id="+p_own_id+"&p_divname="+p_div,
			   success: function(msg){
				  document.getElementById(p_div+p_id).innerHTML=msg;
			   }
	});		
}


function set_video(p_video_id)
{
	document.getElementById("embedvideo").innerHTML='Cargando...';
	$.ajax({
		   type: "POST",
		   url: "arc_get_embed.asp",
		   data: "p_video_id="+p_video_id,
			   success: function(msg){
				  document.getElementById("embedvideo").innerHTML=msg;
			   }
	});		
}


function show_related_tools(p_span_id,p_categoria_id)
{
	for(i=1;i<=document.getElementById("v_total_unique").value-1;i++)
	{
		document.getElementById("spanid_"+i).innerHTML='<img src=images/hspacer.gif width=1 height=1>';
	}
	document.getElementById("spanid_"+p_span_id).innerHTML='Cargando...';
	$.ajax({
		   type: "POST",
		   url: "arc_load_tools.asp",
		   data: "p_categoria_id="+p_categoria_id,
			   success: function(msg){
				  document.getElementById("spanid_"+p_span_id).innerHTML=msg;
			   }
	});	
	   	

}

function set_trans(pbg_id,p)
{
  	if(p>0)	$('#bg_'+pbg_id).toggleClass("even",true);
	else $('#bg_'+pbg_id).toggleClass("even",false);
}


function show_menu_arcop(p_div_id)
{
  
	 for(i=1;i<=3;i++)
	{
	  document.getElementById("arc_menu_"+i).style.visibility="hidden";
	}
	if(p_div_id>0)
	{
	 
		document.getElementById("arc_menu_"+p_div_id).style.visibility="visible";
		var v_table;
	 
		v_table="";
		switch(p_div_id)
		{
			case 1:
			//v_table+='<div style="height:150px"    >';
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"   onclick=window.parent.location="arc_presentacion_c.asp"  ><a href="arc_presentacion_c.asp">Presentación</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';	
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"   onclick=window.parent.location="arc_como_funciona_c.asp" ><a href="arc_como_funciona_c.asp">Como funciona</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"  onclick=window.parent.location="arc_porque_arcjob_c.asp"  ><a href="arc_porque_arcjob_c.asp">Porqué ARCjob</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"  onclick=window.parent.location="arc_solutions_c.asp"  ><a href="arc_solutions_c.asp">ARC Solutions</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';	
			/*v_table+='<div class="arc_opcion_menu_i"><a href="arc_seleccion_c.asp">Selección</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			v_table+='<div class="arc_opcion_menu_i"><a href="arc_consultoria_c.asp">Consultoría</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';*/
	//		v_table+='<div class="arc_opcion_menu_i"><a href="arc_jornadas_c.asp">Jornadas ARCjob</A></div>';
		//	v_table+='<div class="arc_menu_sep"  ></div>';				
				//		v_table+='</div>';
			break;
		/*	case 3:
			v_table+='<div class="arc_opcion_menu_i"><a href="arc_empresa_c.asp">Empresas</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';	
			v_table+='<div class="arc_opcion_menu_i"><a href="arc_profesionales_c.asp">Profesionales</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>'; 
			break;*/
			case 3:
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"  onclick=window.parent.location="arc_cap_aprendizaje_c.asp"  ><a href="arc_cap_aprendizaje_c.asp">Aprendizaje y cambio</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';	
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"  onclick=window.parent.location="arc_cap_ingenio_c.asp"  ><a href="arc_cap_ingenio_c.asp">Ingenio</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"  onclick=window.parent.location="arc_cap_creatividad_c.asp"  ><a href="arc_cap_creatividad_c.asp">Creatividad</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			v_table+='<div class="arc_opcion_menu_i" style="cursor:pointer"  onclick=window.parent.location="arc_cap_catorze_c.asp"  ><a href="arc_cap_catorze_c.asp">Los 14 puntos</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			
			break;
			case 5:
			v_table+='<div class="arc_opcion_menu_i"><a href="arc_formacion_c.asp">Formación</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';	
			v_table+='<div class="arc_opcion_menu_i"><a href="arc_seleccion_c.asp">Selección</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			v_table+='<div class="arc_opcion_menu_i"><a href="arc_consultoria_c.asp">Consultoría</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';
			v_table+='<div class="arc_opcion_menu_i"><a href="arc_jornadas_c.asp">Jornadas ARCjob</A></div>';
			v_table+='<div class="arc_menu_sep"  ></div>';		
			break;		
		}
		document.getElementById("arc_menu_"+p_div_id).innerHTML=v_table;
	
	}
}

function set_trans_articulos(pbg_id,p)
{
  	if(p>0)	$('#bg_'+pbg_id).toggleClass("even_art",true);
	else $('#bg_'+pbg_id).toggleClass("even_art",false);
}


function showfolder(p_id,elementSelector, sourceUrl)
{
  
//	$(""+elementSelector+"").load(sourceUrl);
	$('#'+elementSelector).load(sourceUrl);
}


function f_citylougarotros()
{
	var v_puesto_id=document.f_registro.f_ciudad[document.f_registro.f_ciudad.selectedIndex].text;
	if(v_puesto_id.indexOf("Otros")>=0) 
	document.getElementById("cityotros").innerHTML='<input type="text" size=12 id="f_otroscity" name="f_otroscity" />';
	else document.getElementById("cityotros").innerHTML='<input value="" type="hidden" id="f_otroscity" name="f_otroscity" />';
}

function f_citylougarotrosdos()
{
 
	var v_puesto_id=document.f_empresa.e_ciudad[document.f_empresa.e_ciudad.selectedIndex].text;

	if(v_puesto_id.indexOf("Otros")>=0) 
	document.getElementById("cityotros").innerHTML='<input type="text" size=12 id="f_otroscity" name="f_otroscity" />';
	else document.getElementById("cityotros").innerHTML='<input value="" type="hidden" id="f_otroscity" name="f_otroscity" />';

}

function set_foto_error(p_user_id)
{
	alert("AVISO PARA LAS FOTOS:El archivo seleccionado es demasiado grande. Intenta reducir el tamaño a menos de 150 pixeles de ancho y 100 de alto. Le recomendamos el tamaño de 80 pixeles x 100.");
}


function check_register_form_empresa_1()
{
	var v_msg_error;
	v_msg_error="";
	if(document.getElementById('v_mail').value=="") v_msg_error+="\nEl campo E-MAIL es obligatorio";
	if(document.getElementById('v_mail').value.indexOf("@")<0) v_msg_error+="\nEl campo E-MAIL no es un mail valido"
	if(document.getElementById('v_nombre').value=="") v_msg_error+="\nEl campo NOMBRE SOCIAL DE LA EMPRESA es obligatorio";
	
	
	if(v_msg_error=="")	//document.register1.submit();
	{
		$.ajax({
		   type: "POST",
		   url: "get_mail_user_check.asp",
		   data: "p_mail="+document.getElementById('v_mail').value,
			   success: function(msg){
				   if(msg==0)  document.register1.submit();
				   else alert("\nEl E-mail: "+document.getElementById('v_mail').value+"  ya existe.");
			   }
		   });	
	   
	}
	else alert(v_msg_error);
	
}


function check_register_form_1()
{
	var v_msg_error;
	v_msg_error="";
	if(document.getElementById('v_mail').value=="") v_msg_error+="\nEl campo E-MAIL es obligatorio";
	if(document.getElementById('v_mail').value.indexOf("@")<0) v_msg_error+="\nEl campo E-MAIL no es un mail valido"
	if(document.getElementById('v_prof').value==0) v_msg_error+="\nEl campo PROFESION es obligatorio"
	
	
	if(v_msg_error=="")	//document.register1.submit();
	{
		$.ajax({
		   type: "POST",
		   url: "get_mail_user_check.asp",
		   data: "p_mail="+document.getElementById('v_mail').value,
			   success: function(msg){
				   

				   if(msg==0)  document.register1.submit();
				   else alert("\nEl E-mail: "+document.getElementById('v_mail').value+"  ya existe.");
			   }
		   });	
	   
	}
	else alert(v_msg_error);
	
}

function set_user(p_posicion,p_id,p_user_id)
{	
	//alert(document.getElementById('auxname'+p_posicion).value);
	document.getElementById('f_search').value=document.getElementById('auxname'+p_posicion).value;
	document.getElementById("quizir").style.visibility="hidden";
	document.getElementById("quizir_results").innerHTML="<img src=images/hspacer.gif width=1 height=1>";
 
	arc_search_contactos_forid(p_user_id,p_id);
}


function set_ciudad_form(p_posicion, p_id_city)
{
 
	document.getElementById('v_ciudad').value=escape(document.getElementById('auxname'+p_posicion).value);
	//document.getElementById("quizir").style.visibility="hidden";
	document.getElementById("ciudades_results").innerHTML="<img src=images/hspacer.gif width=1 height=1>";
	
}

function set_user_favorito(p_posicion,p_id,p_user_id)
{	
	//alert(document.getElementById('auxname'+p_posicion).value);
	document.getElementById('f_search').value=document.getElementById('auxname'+p_posicion).value;
	document.getElementById("quizir").style.visibility="hidden";
	document.getElementById("quizir_results").innerHTML="<img src=images/hspacer.gif width=1 height=1>";
	arc_search_contactos_forid_f(p_user_id,p_id);
}

function del_perfil(p_perfil_id,p_user_id,pn)
{
	
			$.ajax({
			   type: "POST",
			   url: "get_del_allow.asp",
			   data: "p_perfil_id="+p_perfil_id+"&p_user_id="+p_user_id,
			   success: function(msg){
						 if(msg==0)
						 {		
						 			if(confirm('¿Esta seguro que desea borrar su perfil nº '+pn+'?')) 
									{
										 
									$.ajax({
									   type: "POST",
									   url: "delete_perfil.asp",
									   data: "p_perfil_id="+p_perfil_id+"&p_user_id="+p_user_id,
									   success: function(msg){
											//alert("Perfil borrado");
											//load_perfiles(p_user_id);
											window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0";
									   }
									 });
									
									}
						 }
						 else alert("Este perfil no puedo borrarlo; es el perfil principal.");
						}
									 });

			 
}


 function set_allow_candidato(p_empresa_id)
{
	var v_allow="";
	if(document.getElementById("alowbox").value=="on") v_allow="True"
	else v_allow="False";
	
	if(v_allow=="True")
	{
		if(confirm('Si continua con esta operación no podrá recibir ningún mensaje de usuarios que no pertenezcan a sus contactos. ¿Desea continuar?')) 
			{
			$.ajax({
			   type: "POST",
			   url: "set_allow_msg.asp",
			   data: "p_user_id="+p_empresa_id+"&p_cadena="+v_allow,
			   success: function(msg){
				document.getElementById("d_alow_msg").innerHTML="";
			   }
			 });
			
			}
			else document.getElementById("d_alow_msg").innerHTML="";
	
	}
	else
	{
		if(confirm('Si continua con esta operación podrá recibir ningún mensaje de usuarios que no pertenezcan a sus contactos. ¿Desea continuar?')) 
			{
			$.ajax({
			   type: "POST",
			   url: "set_allow_msg.asp",
			   data: "p_user_id="+p_empresa_id+"&p_cadena="+v_allow,
			   success: function(msg){
				document.getElementById("d_alow_msg").innerHTML="";
			   }
			 });
			
			}
			else document.getElementById("d_alow_msg").innerHTML="";
	}
	

			 
 
}


function set_allow(p_empresa_id)
{
	var v_allow="";
	if(document.getElementById("alowbox").value=="on") v_allow="True"
	else v_allow="False";
	
	if(v_allow=="True")
	{
		if(confirm('Si continua con esta operación no podrá recibir ningún mensaje de usuarios que no sean sus favoritos. ¿Desea  continuar?')) 
			{
			$.ajax({
			   type: "POST",
			   url: "set_allow_msg.asp",
			   data: "p_user_id="+p_empresa_id+"&p_cadena="+v_allow,
			   success: function(msg){
				document.getElementById("d_alow_msg").innerHTML="";
			   }
			 });
			
			}
			else document.getElementById("d_alow_msg").innerHTML="";
	
	}
	else
	{
		if(confirm('Si continua con esta operación podrá recibir mensajes de usuarios que no sean sus favoritos. ¿Desea  continuar?')) 
			{
			$.ajax({
			   type: "POST",
			   url: "set_allow_msg.asp",
			   data: "p_user_id="+p_empresa_id+"&p_cadena="+v_allow,
			   success: function(msg){
				document.getElementById("d_alow_msg").innerHTML="";
			   }
			 });
			
			}
			else document.getElementById("d_alow_msg").innerHTML="";
	}
	

			 
 
}
function close_allow()
{
	document.getElementById("d_alow_msg").innerHTML="";
 
}




function close_pck()
{
	document.getElementById("show_pack_info").innerHTML="";
				 	var b_buton_pos = document.getElementById('marcaaltura');
  	    			var v_pos_y=findPosY(b_buton_pos);
					var v_pos_x=findPosX(b_buton_pos);
 
	   				document.getElementById('oferta_waring_error').style.top=v_pos_y+40+ 'px';	
}
function add_favorito_pages(p_user_origen,p_user_destino,count)
{
	    document.getElementById("d_favorito_msg").innerHTML="Enviando petición...";
 
    $.ajax({
			   type: "POST",
			   url: "set_favorito.asp",
			   data: "p_user_id="+p_user_origen+"&p_user_d="+p_user_destino,
			   success: function(msg){
				 document.getElementById("d_favorito_msg").innerHTML="Favorito añadido.";
			   }
			 });
}


function add_favorito_buscador(p_user_origen,p_user_destino,count)
{
	 
	    document.getElementById("contacto"+count).innerHTML="Enviando petición...";
 
    $.ajax({
			   type: "POST",
			   url: "set_favorito.asp",
			   data: "p_user_id="+p_user_origen+"&p_user_d="+p_user_destino,
			   success: function(msg){
				 document.getElementById("contacto"+count).innerHTML="Favorito añadido.";
			 
			   }
			 });		
}

function set_all_var_true(p_user_id)
{
    $.ajax({
			   type: "POST",
			   url: "set__all_true_favorito.asp",
			   data: "p_user_id="+p_user_id,
			   success: function(msg){
				  
				 //arc_misfavoritos_c
			   }
			 });	
}



function add_favorito(p_user_origen,p_user_destino,count,p_tipo)
{  
	    document.getElementById("contacto"+count).innerHTML="Enviando petición...";
 
    $.ajax({
			   type: "POST",
			   url: "set_favorito.asp",
			   data: "p_user_id="+p_user_origen+"&p_user_d="+p_user_destino,//p_user_origen=quien hace la peticion
			   success: function(msg){
				 document.getElementById("contacto"+count).innerHTML="Favorito añadido.";
				 window.parent.location="arc_contactos_c.asp?p_user_id="+p_user_origen+"&p_type_user=1&sec=0";
				 //arc_misfavoritos_c
			   }
			 });		
}

function set_desactivar_opcion(p_id)
{
			$.ajax({
			   type: "POST",
			   url: "set_allow_msg.asp",
			   data: "p_user_id="+p_id+"&p_cadena=false",
			   success: function(msg){
				document.getElementById("d_alow_msg").innerHTML="";
			   }
			 });
}

function show_allow_msg(p_empresa_id)
{
	document.getElementById("d_alow_msg").innerHTML="Cargando..."
	$.ajax({
			   type: "POST",
			   url: "get_allow_msg.asp",
			   data: "p_user_id="+p_empresa_id,
			   success: function(msg){
				document.getElementById("d_alow_msg").innerHTML=msg;
			   }
			 });		
}

function show_allow_msg_candidato(p_candidato_id)
{
	document.getElementById("d_alow_msg").innerHTML="Cargando..."
	$.ajax({
			   type: "POST",
			   url: "get_allow_msg_candidato.asp",
			   data: "p_user_id="+p_candidato_id,
			   success: function(msg){
				document.getElementById("d_alow_msg").innerHTML=msg;
			   }
			 });		
}

function show_pack_info(p_tipo,p_user_id,p_pack_dias)
{
	document.getElementById("show_pack_info").innerHTML="Cargando..."
    $.ajax({
			   type: "POST",
			   url: "get_info_pack.asp",
			   data: "p_pack_dias="+p_pack_dias,
			   success: function(msg){
				 document.getElementById("show_pack_info").innerHTML=msg;
				 	var b_buton_pos = document.getElementById('marcaaltura');
  	    			var v_pos_y=findPosY(b_buton_pos);
					var v_pos_x=findPosX(b_buton_pos);
 
	   				document.getElementById('oferta_waring_error').style.top=v_pos_y+40+ 'px';
			   }
			 });	
}

function c_sjornada_form_2l()
{
 
 if(document.getElementById('n_jornada').options[document.getElementById('n_jornada').value].text=="Otros")
	document.getElementById("jor_otros").innerHTML='Otros:&nbsp;<input type=text value="" id="jornada_otros" name="jornada_otros" />'
 else document.getElementById("jor_otros").innerHTML='<input type=hidden value="" id="jornada_otros" name="jornada_otros" />'
}

function c_sjornada_form_22()
{
 
 if(document.getElementById('n_disponibilidad').options[document.getElementById('n_disponibilidad').value].text=="Otros")
	document.getElementById("dis_otros").innerHTML='Otros:&nbsp;<input type=text value="" id="disponibilidad_otros" name="disponibilidad_otros" />'
 else document.getElementById("dis_otros").innerHTML='<input type=hidden value="" id="disponibilidad_otros" name="disponibilidad_otros" />'
}
 

function s_otros_disp()
{
  
 if(document.getElementById('v_sit').value==4)
	document.getElementById("dis_otros").innerHTML='Otros:&nbsp;<input type=text value="" id="disponible_otros" name="disponible_otros" />'
 else document.getElementById("dis_otros").innerHTML='<input type=hidden value="" id="disponible_otros" name="disponible_otros" />'
}


function c_sjornada_form_25()
{
 // alert(document.getElementById('n_categorias').value);
 if(document.getElementById('n_categorias').options[document.getElementById('n_categorias').value].text=="Otros")
	document.getElementById("cat_otros").innerHTML='Otros:&nbsp;<input type=text value="" id="categoria_otros" name="categoria_otros" />'
 else document.getElementById("cat_otros").innerHTML='<input type=hidden value="" id="categoria_otros" name="categoria_otros" />'

}


function check_perfil_fields(p_step_id,p_perfil_if,p_user_id,p_redirect)
{
	
	var v_msg="Para continuar, revise los siguientes campos:\nLos siguientes campos deben estar cumplimentados\n";
	var v_msg_error ="";
	
	switch(p_step_id)
	{
		case 1:

				if(document.getElementById('v_nombre').value=="") v_msg_error+="\nEl campo Nombre es obligatorio";
				v_nombre = escape(document.getElementById('v_nombre').value);
				if(document.getElementById('v_apellido1').value=="") v_msg_error+="\nEl campo 1er. Apellido es obligatorio";
				v_apellido1=escape(document.getElementById('v_apellido1').value);
				//if(document.getElementById('v_apellido2').value=="") v_msg_error+="\nEl campo 2on.. Apellido es obligatorio";
				v_apellido2=escape(document.getElementById('v_apellido2').value);
				if(document.getElementById('v_nick').value=="") v_msg_error+="\nEl campo Nombre público es obligatorio";
				v_nick=escape(document.getElementById('v_nick').value);
				if(document.getElementById('v_ciudad').value=="") v_msg_error+="\nEl campo CIUDAD es obligatorio";
				v_ciudad=escape(document.getElementById('v_ciudad').value);
				if(document.getElementById('v_dia').value<=0) v_msg_error+="\nEl campo Día es obligatorio";	
				if(document.getElementById('v_mes').value<=0) v_msg_error+="\nEl campo MES es obligatorio";	
				if(document.getElementById('v_year').value<=0) v_msg_error+="\nEl campo AÑO es obligatorio";
				v_dia = document.getElementById('v_dia').value;
				v_mes = document.getElementById('v_mes').value;
				v_year = document.getElementById('v_year').value;
				
				v_provincia_sp=document.getElementById('v_provincia_sp').value;
				
				if(document.getElementById('v_telf').value!="") {
					
					if(document.getElementById('v_telf').value.length<9){
						v_msg_error+="\nEl campo TELÉFONO tiene que tener un mínimo de 9 dígitos";
					}
					if(isNaN(parseInt(document.getElementById('v_telf').value) ))
					{
						v_msg_error+="\nEl campo TELÉFONO tiene que tener un valor numérico";	
					}
				} 
				v_telf = document.getElementById('v_telf').value;
			 
				valor = parseInt(document.getElementById('v_postal').value) 
			
				if (isNaN(valor)) { 
					v_msg_error+="\nEl campo CÓDIGO POSTAL debe ser un valor numérico";	
				}
				
				if(document.getElementById('v_nacionalidad').value=="") v_msg_error+="\nEl campo NACIONALIDAD es obligatorio";		
				if(document.getElementById('v_postal').value=="") v_msg_error+="\nEl campo CÓDIGO POSTAL es obligatorio";
				if(document.getElementById('v_permiso').value<0) v_msg_error+="\nEl campo PERMISO DE CONDOCIR es obligatorio";	
				if(document.getElementById('v_sit').value<=0) v_msg_error+="\nEl campo SITUACIÓN ACTUAL es obligatorio";	
 

				if(v_msg_error=="") {
					 
						$.ajax({
					   type: "POST",
					   url: "arc_update_perfil_s1.asp",
					   data: "p_perfil_id="+p_perfil_if+"&p_user_id="+p_user_id+"&p_nombre="+v_nombre+"&p_apellidouno="+v_apellido1+"&p_apellido_dos="+v_apellido2+"&p_nick="+v_nick+"&p_dia="+v_dia+"&p_mes="+v_mes+"&p_year="+v_year+"&p_telf="+v_telf+"&p_ciudad="+v_ciudad+"&p_postal="+document.getElementById('v_postal').value+"&p_direccion="+escape(document.getElementById('v_direccion').value)+"&p_nacionalidad="+document.getElementById('v_nacionalidad').value+"&p_permiso="+document.getElementById('v_permiso').value+"&p_sit="+document.getElementById('v_sit').value+"&p_otrosdisponible="+escape(document.getElementById('disponible_otros').value)+"&p_provincia="+v_provincia_sp,
					   success: function(msg){
						  
						    if(p_redirect==1)
							window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0&p_perfil_id="+p_perfil_if;
							else window.parent.location="lobby.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0";
					   }
					 });	
						
				}
				else {
					v_msg+=v_msg_error;
					alert(v_msg);
				} 
		
		break;
		
		
		
		
		case 2:
		
				if(document.getElementById('n_profesiones').value<=0) v_msg_error+="\nEl campo Profesión es obligatorio";

	
				if(document.getElementById('v_descripcion').value.length<150) v_msg_error+="\nEl campo DESCRIPCIÓN es demasiado corto";
				if(document.getElementById('v_descripcion').value>2000) v_msg_error+="\nEl campo DESCRIPCIÓN es demasiado largo";				
				 
				
				v_profesiones = escape(document.getElementById('n_profesiones').value);
				 
				 
				if(document.getElementById('n_profesiones').value>0) {
					 
					 
					/* 	v_opcion= document.getElementById("n_profesiones").value;
	alert(v_opcion);
						if(v_opcion!=12 && v_opcion!=16){
						 
						v_msg_error+="\nEl campo Puesto de trabajo es obligatorio";
						}*/
				}
					 			 
				v_categorias = escape(document.getElementById('n_categorias').value);
				
				if(document.getElementById('v_descripcion').value=="") v_msg_error+="\nEl campo DESCRIPCIÓN es obligatorio";
				v_descripcion = escape(document.getElementById('v_descripcion').value);	
				 
				v_otrospuesto=escape(document.getElementById('n_puestotrabajo').value);	
				 
				if(v_msg_error=="") {
					
					$.ajax({
					   type: "POST",
					   url: "arc_update_perfil_s2.asp",
					   data: "p_perfil_id="+p_perfil_if+"&p_user_id="+p_user_id+"&p_profesiones="+v_profesiones+"&p_categoria="+v_categorias+"&p_descripcion="+v_descripcion+"&p_puestootrosdos="+v_otrospuesto,
					   success: function(msg){
						     window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0&p_perfil_id="+p_perfil_if;
					   }
					 });	
						
				}
				else {
					v_msg+=v_msg_error;
					alert(v_msg);
				} 
		
		break;
		
		
		case 3:
		
			if(document.getElementById('v_titulos').value<=0) v_msg_error+="\nEl campo Titulación es obligatorio";
			if(document.getElementById('v_espec').value<0) v_msg_error+="\nEl campo Especialidad es obligatorio";
			var v_esp=document.getElementById('v_espec').value;
			if(document.getElementById('n_idiomas').selectedIndex<0) v_msg_error+="\nEl campo Idiomas es obligatorio";
			if(document.getElementById('n_conocimientos').value<=0) v_msg_error+="\nEl campo Conocimientos informáticos es obligatorio";
			var v_cadena="";
				for(i=0;i<document.getElementById('n_idiomas').length;i++)
				{
					if(document.getElementById('n_idiomas').options[i].selected==true)
					{ 
						v_cadena+=document.getElementById('n_idiomas').options[i].value+ ",";
					}
				}
				
				 
				if(v_msg_error=="") {
				
					$.ajax({
					   type: "POST",
					   url: "arc_update_perfil_s3.asp",
					   data: "p_perfil_id="+p_perfil_if+"&p_user_id="+p_user_id+"&p_titulacion="+document.getElementById('v_titulos').value+"&p_especialidad="+v_esp+"&p_idiomas="+v_cadena+"&p_conocimientos="+document.getElementById('n_conocimientos').value,
					   success: function(msg){
						      window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0&p_perfil_id="+p_perfil_if;
					   }
					 });
						
				}
				else {
					v_msg+=v_msg_error;
					alert(v_msg);
				}  
		
		break;
		
		
		case 4:
		
				var v_salario;
				var v_rango;
		
				if(document.getElementById('n_jornada').value<=0) v_msg_error+="\nEl campo Jornada laboral es obligatorio";
				v_jornada = document.getElementById('n_jornada').value;
				if(document.getElementById('v_exp').value<=0) v_msg_error+="\nEl campo Número de años trabajados es obligatorio";
				v_exp = document.getElementById('v_exp').value;				
				if(document.getElementById('n_disponibilidad').value<=0) v_msg_error+="\nEl campo Disponibiidad de incorporación es obligatorio";
				v_disponibilidad = document.getElementById('n_disponibilidad').value;				
				if(document.getElementById('n_salario').value<=0) v_salario=0;
				else  v_salario = document.getElementById('n_salario').value;
				if(document.getElementById('n_rangosalario').value<=0) v_rango=0;
				else v_rango = document.getElementById('n_rangosalario').value;
								
				v_otros1=document.getElementById('jornada_otros').value; 
				v_otros2=document.getElementById('disponibilidad_otros').value;
				 
				if(v_msg_error=="") {
					$.ajax({
					   type: "POST",
					   url: "arc_update_perfil_s4.asp",
					   data: "p_perfil_id="+p_perfil_if+"&p_user_id="+p_user_id+"&p_jornada="+v_jornada+"&p_exp="+v_exp+"&p_disp="+v_disponibilidad+"&p_salario="+v_salario+"&p_rando="+v_rango+"&p_otros1="+escape(v_otros1)+"&p_otros2="+escape(v_otros2),
					   success: function(msg){
						     window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0&p_perfil_id="+p_perfil_if;
					   }
					 });
						
				}
				else {
					v_msg+=v_msg_error;
					alert(v_msg);
				} 
				
				
		break;
		case 5:
				 
				//if(document.getElementById('n_obersva').value.length>0) {
					var v_texto = escape(document.getElementById('n_obersva').value);
					$.ajax({
					   type: "POST",
					   url: "arc_update_perfil_s5.asp",
					   data: "p_perfil_id="+p_perfil_if+"&p_user_id="+p_user_id+"&p_texto="+v_texto,
					   success: function(msg){
						     window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0";
					   }
					 });
				//}
		 
		
		
		break;		
		
		case 6:
				 
					if(document.getElementById('n_reclamo').value=="") v_msg_error+="\nEl campo RECLAMO es obligatorio";
					if(document.getElementById('n_reclamo').value.length>500) v_msg_error+="\nEl campo RECLAMO es demasiado largo";
					if(document.getElementById('n_reclamo').value.length<=150) v_msg_error+="\nEl campo RECLAMO es demasiado corto";
						
 					var v_reclamo_id=document.getElementById('n_rec_id').value;
					
					
					if(v_msg_error=="") {
						             var v_texto =escape(document.getElementById('n_reclamo').value);
									 $.ajax({
									   type: "POST",
									   url: "arc_update_perfil_s6.asp",
									   data: "p_perfil_id="+p_perfil_if+"&p_user_id="+p_user_id+"&p_reclamo_id="+v_reclamo_id+"&p_texto="+v_texto,
									   success: function(msg){
											 window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0&p_perfil_id="+p_perfil_if;
									   }
									 });
										
								}
								else {
									v_msg+=v_msg_error;
									alert(v_msg);
								} 					
		break;
	}


	
}

function update_reclamo_c(p_reclamo_id,p_user_id,p_type)
{
	 var v_msg_error="";
	 if (document.getElementById('rec_updated_'+p_reclamo_id).value=="TRUE")
	 {
		 v_msg_error+="\nSolo puede actualizar el reclamo una vez al día.";	
	 }
	 
	 
	 if(v_msg_error==""){
		  
		$.ajax({
		   type: "POST",
		   url: "arc_actualizar_reclamo.asp",
		   data: "p_reclamo_id="+p_reclamo_id,
		   success: function(msg){
				   alert("Reclamo actualizado correctamente");
				   window.parent.location="arc_gestion_reclamos_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=1";
		   
		   }
		 });
	 }
	 else alert(v_msg_error);	
}

function delete_reclamo_c(p_reclamo_id,p_user_id,p_type)
{
	if(confirm("Esta seguro que desea borrar el reclamo?")){
		 
 
		$.ajax({
		   type: "POST",
		   url: "arc_borrar_reclamo.asp",
		   data: "p_reclamo_id="+p_reclamo_id,
		   success: function(msg){

				   window.parent.location="arc_gestion_reclamos_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=1";
		   
		   }
		 });
	}
}

function arc_search_contactos_forid(p_user_id,p_busca_id)
{
	

		document.getElementById("quizir_results_buscados").innerHTML="Buscando..."
	    $.ajax({
			   type: "POST",
			   url: "get_contactos_buscar_for_id.asp",
			   data: "p_buscar_id="+p_busca_id+"&p_user_id="+p_user_id+"&p_query="+document.getElementById("f_search").value,
			   success: function(msg){
				 document.getElementById("quizir_results_buscados").innerHTML=msg;
				   //document.getElementById("texto_menu").innerHTML =msg;
			   }
			 });		

}


function arc_search_contactos_forid_f(p_user_id,p_busca_id)
{
	

		document.getElementById("quizir_results_buscados").innerHTML="Buscando..."
	    $.ajax({
			   type: "POST",
			   url: "get_contactos_buscar_for_id_f.asp",
			   data: "p_buscar_id="+p_busca_id+"&p_user_id="+p_user_id+"&p_query="+document.getElementById("f_search").value,
			   success: function(msg){
				 document.getElementById("quizir_results_buscados").innerHTML=msg;
				   //document.getElementById("texto_menu").innerHTML =msg;
			   }
			 });		

}


function quizir(e,p_user_id,p_type)
{
	 
 	v_cadena=document.getElementById('f_search').value ;
 	tecla=(document.all) ? e.keyCode : e.which; 
/*	if(v_cadena.length<3)
	{
		document.getElementById("quizir_results").innerHTML="";
	}*/

	if(tecla==13)
	{
		document.getElementById("quizir_results_buscados").innerHTML="";
		if(v_cadena.length>=2)
		{
		 	if(p_type==2)
			{
			 arc_search_contactos(p_user_id);
			}
			else{
				arc_search_favoritos(p_user_id);
			} 
			// arc_search_contactos(p_user_id);
			
		}
		else alert("Debe escribir un nombre de contacto");
	}
	
	else{
		document.getElementById("quizir_results_buscados").innerHTML="";
	 
				 if(v_cadena.length>=2)
				{
					
					document.getElementById("quizir_results").innerHTML="Cargando...";
					$.ajax({
							   type: "POST",
							   url: "get_quizir.asp",
							   data: "p_cadena="+v_cadena+"&p_user_id="+p_user_id+"&p_type="+p_type,
							   success: function(msg){		
									document.getElementById("quizir_results").innerHTML=msg;					
							   }
					});		
				} 
				else{
					document.getElementById("quizir_results").innerHTML="";
				}
	}
}


function desplegables_t()
{
	 
  v_opcion=(document.oferta.n_profesiones[document.oferta.n_profesiones.selectedIndex].value);
	 
 document.getElementById("puestotrabajootros").style.visibility="hidden";
   var v_array1=document.oferta.f_cadena.value.split("###");
   var v_aux=0;
   for (i=1;i<v_array1.length;i++){
	   if(v_array1[i].indexOf("("+v_opcion+")",0)>=0)
	   {
		   v_aux=i;
	   } 
    }
 
  v_cadena_main = v_array1[v_aux].substr(v_array1[v_aux].indexOf(")")+1,v_array1[v_aux].length);

  var v_array2=v_cadena_main.split("#$#");
  
 
  for (var i=document.oferta.n_categorias.options.length-1; i>=0; i--){
    document.oferta.n_categorias.options[i] = null;
  }
  document.oferta.n_categorias.selectedIndex = -1;
	
	       	  var newOpt = document.oferta.n_categorias.appendChild(document.createElement('option'));			  
			  newOpt.text = "-- Seleccionar --"
			  newOpt.value = 0
	
   for(i=1;i< (v_array2.length-1);i++)
   {
 
       		  var newOpt = document.oferta.n_categorias.appendChild(document.createElement('option'));
			  v_puesto_ok = v_array2[i].split("<-->");
			  newOpt.text = v_puesto_ok[0]
			  newOpt.value = v_puesto_ok[1]			  
			// newOpt.value = i
   }
    var spans = document.getElementById('cambiotros'); 
   if(v_opcion==16 )
   {
       		  var newOpt = document.oferta.n_categorias.appendChild(document.createElement('option'));
			  newOpt.text = "Otros"
			  newOpt.value = 0	
			  spans.innerHTML="Otros&nbsp;";
			  document.getElementById("puestotrabajo").style.visibility='hidden'; 
			  document.getElementById("puestotrabajootros").style.visibility='visible';   
	  			  
   }  
   if(v_opcion==12 )//profesiones liberales
   {
       		  var newOpt = document.oferta.n_categorias.appendChild(document.createElement('option'));
			  newOpt.text = "Otros"
			  newOpt.value = 0	
			  spans.innerHTML="";
			  document.getElementById("puestotrabajo").style.visibility='hidden'; 
			//  document.getElementById("puestotrabajootrosliberal").style.visibility='visible';   
			  document.getElementById("puestotrabajootros").style.visibility='visible';   
			  
   }     
   if(v_opcion==0)
   {
       		  var newOpt = document.oferta.n_categorias.appendChild(document.createElement('option'));
			  newOpt.text = "-- Seleccionar antes un categoria --"
			  newOpt.value = 0	
			  spans.innerHTML="";
			  document.getElementById("puestotrabajo").style.visibility='hidden'; 
			//  document.getElementById("puestotrabajootrosliberal").style.visibility='visible';   
			  document.getElementById("puestotrabajootros").style.visibility='visible'; 	   
   }
}


 function evalform_oferta()
{
var v_msg_error ='';
 

//perfil.submit()
	if (document.oferta.f_titulo.value=='') {
	    v_msg_error+="El campo TÍTULO es obligatorio\n";
		
	}
	if (document.oferta.n_lugardetrabajo[document.oferta.n_lugardetrabajo.selectedIndex].value==0) {//
	    v_msg_error+="El campo LUGAR DE TRABAJO es obligatorio\n";
	} 
	 
	
	
	if (document.oferta.n_profesiones[document.oferta.n_profesiones.selectedIndex].value==0) {//
	    v_msg_error+="El campo CATEGORIA es obligatorio\n";
	}
	
	if(document.getElementById("puestotrabajootros").style.visibility=="visible")
	{
			if (document.oferta.puestotrabajootros.value=='') {
	    v_msg_error+="Debe detallar un puesto de trabajo\n";
		
			}
	}
	else{
		if (document.oferta.n_categorias[document.oferta.n_categorias.selectedIndex].value==0) {//
			v_msg_error+="El campo PUESTO DE TRABAJO es obligatorio\n";
		}
	}
	 
	
/*
document.getElementById("puestotrabajootros").style.visibility
*/
	
	if (document.oferta.n_sector[document.oferta.n_sector.selectedIndex].value==0) {//
	    v_msg_error+="El campo SECTOR es obligatorio\n";
	}
 	v_cadena=document.oferta.n_serequiere.value;
	if (v_cadena.length>500) {
	    v_msg_error+="El campo SE REQUIERE es demasiado largo\n";
	}
	if (v_cadena.length<100) {
	    v_msg_error+="El campo SE REQUIERE es demasiado corto\n";
	}	
	if (document.oferta.n_serequiere.value=='') {
	    v_msg_error+="El campo SE REQUIERE es obligatorio\n";
	}
 	v_cadena=document.oferta.n_seofrece.value;
	if (v_cadena.length>500) {
	    v_msg_error+="El campo SE OFRECE es demasiado largo\n";
	}	
	/*
	if (document.oferta.n_seofrece.value=='') {
	    v_msg_error+="El campo SE OFRECE es obligatorio\n";
	}*/
	if (document.oferta.n_tipo[document.oferta.n_tipo.selectedIndex].value==0) {
	    v_msg_error+="El campo TIPO DE CONTRATO es obligatorio\n";
	}
	if (document.oferta.n_horario[document.oferta.n_horario.selectedIndex].value==0) {
	    v_msg_error+="El campo HORARIO es obligatorio\n";
	}  
	
 	v_cadena=document.oferta.n_descripcion.value;
	 
	if (document.oferta.n_descripcion.value=='') {
	    v_msg_error+="El campo DESCRIPCIÓN es obligatorio\n";
	}		
	if (v_cadena.length>1200) {
	    v_msg_error+="El campo DESCRIPCIÓN es demasiado largo\n";
	} 
	if (v_cadena.length<150 ) {
	    v_msg_error+="El campo DESCRIPCIÓN es demasiado corto\n";
	} 	

	/*v_cadena=document.oferta.n_reclamooferta.value;
	if (v_cadena.length>500) {
	    v_msg_error+="El campo RECLAMO es demasiado largo\n";
	}		
	if (document.oferta.n_reclamooferta.value=='') {
	    v_msg_error+="El campo RECLAMO es obligatorio\n";
	}*/	
	
	
	
	if(v_msg_error=='')  document.oferta.submit();	
	
	else  alert(v_msg_error);	
}

function evalopcion_lugar()
{
            
			if(document.oferta.n_lugardetrabajo.value=="Otros")
			{
				document.getElementById("otrolugar").style.visibility='visible'; 
			}
			else  {
				document.getElementById("otrolugar").style.visibility='hidden'; 
			}
}

function msg_no_action()
{
	alert("Si quieres disfrutar de los servicios y opciones que ARCjob te propone solo tienes que registrarte y empezar a enviar mensajes, ver perfiles, ofertas, recomendar a usuarios");
}

function mirarotros()
{
	v_cadena=document.oferta.n_categorias[document.oferta.n_categorias.selectedIndex].text;
	 
    v_cadena=document.oferta.n_categorias[document.oferta.n_categorias.selectedIndex].text;
 
	if(v_cadena.indexOf("Otros")>=0)
	{  
		//document.getElementById("puestotrabajo").style.visibility='hidden';
		document.getElementById("puestotrabajootros").style.visibility='visible';
	}
	else
	{   
		document.getElementById("puestotrabajo").style.visibility='visible';		
		//document.getElementById("puestotrabajootros").style.visibility='hidden';
	} 
}

function set_oculto(p_valor)
{
    if(p_valor==1) {
		document.getElementById("nombreoculto").style.visibility='visible'; 
	}
	else  {
		document.getElementById("nombreoculto").style.visibility='hidden'; 
	}
}

 
function form_c(e)
{
	 
	 var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
	 
}


function get_ciudades(e,p_user_id,p_type)
{
	 
 	v_cadena=document.getElementById('v_ciudad').value ;

 	tecla=(document.all) ? e.keyCode : e.which; 
/*	if(v_cadena.length<3)
	{
		document.getElementById("quizir_results").innerHTML="";
	}*/
	if(tecla==13)
	{
		//document.getElementById("ciudades_results_buscados").innerHTML="";
		if(v_cadena.length>=2)
		{
		 	//alert("buscamos");
		}
		else alert("Debe escribir un nombre de ciudad");
		 
	}
	
	else{
		//document.getElementById("quizir_results_buscados").innerHTML="";
	 
				 if(v_cadena.length>=2)
				{
					document.getElementById("ciudades_results").innerHTML="Cargando...";
					$.ajax({
							   type: "POST",
							   url: "get_quizir_ciudades.asp",
							   data: "p_cadena="+v_cadena,
							   success: function(msg){		
									document.getElementById("ciudades_results").innerHTML=msg;					
							   }
					});		
				} 
				else{
					document.getElementById("ciudades_results").innerHTML="";
				}
	}
	
}



 function contacto_send_msg_contacto(p_to_id,p_user_id)
{
	document.getElementById("contendio_oferta"+p_to_id).innerHTML="Cargando...";
 	 
	 
	$.ajax({
			   type: "POST",
			   url: "get_msg_pe_contacto.asp",
			   data: "p_parauser_id="+p_to_id+"&p_user_id="+p_user_id+"&p_pos="+p_to_id,
			   success: function(msg){		
		 			document.getElementById("contendio_oferta"+p_to_id).innerHTML=msg;					
			   }
	});
}

function contacto_send_msg(p_to_id,p_user_id)
{
	document.getElementById("contendio_oferta"+p_to_id).innerHTML="Cargando...";
 	 
	 
	$.ajax({
			   type: "POST",
			   url: "get_msg_pe.asp",
			   data: "p_parauser_id="+p_to_id+"&p_user_id="+p_user_id+"&p_pos="+p_to_id,
			   success: function(msg){		
		 			document.getElementById("contendio_oferta"+p_to_id).innerHTML=msg;					
			   }
	});
}

function contacto_recomendar(p_to_id,p_user_id)
{
	 
		document.getElementById("contacto_recomendar"+p_to_id).innerHTML="Cargando...";	
	$.ajax({
			   type: "POST",
			   url: "add_recomendar.asp",
			   data: "p_usr_recomendado="+p_to_id+"&p_user_id="+p_user_id,
			   success: function(msg){		
		 			document.getElementById("contacto_recomendar"+p_to_id).innerHTML="Contacto recomendado";					
			   }
	});
 
}

function close_ofertas(p_total)
{
		 alert(p_total);
		document.getElementById("contendio_oferta"+p_total).innerHTML="";
 
}
function ver_ofertas_user(p_user_id,p_pos,p_id,p_total)
{
	 
 	for(i=1;i<parseInt(document.getElementById("t_tal").value);i++)
	{
		document.getElementById("contendio_oferta"+i).innerHTML="";
	} 
	 
	document.getElementById("contendio_oferta"+p_pos).innerHTML="<table width='100%'><tr><td align=center><img src=images/bigrotation.gif></td></tr></table>";
	$.ajax({
			   type: "POST",
			   url: "get_ofertas_pe.asp",
			   data: "p_empresa_id="+p_user_id+"&p_user_id="+p_id+"&p_pos="+p_pos,
			   success: function(msg){		
		 			document.getElementById("contendio_oferta"+p_pos).innerHTML=msg;					
			   }
	});
	
}

function ver_ofertas_user_buscador(p_user_id,p_pos,p_id,p_total,p_cadena,p_city)
{
	 
 	for(i=1;i<parseInt(document.getElementById("t_tal").value);i++)
	{
		document.getElementById("contendio_oferta"+i).innerHTML="";
	} 
	 
	document.getElementById("contendio_oferta"+p_pos).innerHTML="<table width='100%'><tr><td align=center><img src=images/bigrotation.gif></td></tr></table>";
	$.ajax({
			   type: "POST",
			   url: "get_ofertas_pe_search.asp",
			   data: "p_empresa_id="+p_user_id+"&p_user_id="+p_id+"&p_pos="+p_pos+"&p_cadena="+p_cadena+"&p_city="+p_city,
			   success: function(msg){		
		 			document.getElementById("contendio_oferta"+p_pos).innerHTML=msg;					
			   }
	});
	
}


function arc_enviarpagina(p,p)
{

	var msg_error ="";
	v_nombre1=convert_acentos(document.getElementById("v_nombre1").value);
	v_mail1=document.getElementById("v_mail1").value;	
	v_nombre2=convert_acentos(document.getElementById("v_nombre2").value);
	v_mail2=document.getElementById("v_mail2").value;	
	v_texto=convert_acentos(document.getElementById("v_comentarios").value);
	
	if (v_nombre1=="") msg_error+="\nEl campo DE nombre es obligatorio";
	if (v_mail1=="") msg_error+="\nEl campo DE E-mail es obligatorio";
	if (v_nombre2=="") msg_error+="\nEl campo PARA nombre es obligatorio";
	if (v_mail2=="") msg_error+="\nEl campo PARA E-mail es obligatorio";
	 
	if(msg_error=="") {
		$.ajax({
	   type: "POST",
	   url: "arc_send_pagina.asp",
	   data: "v_de="+v_nombre1+"&v_para="+v_nombre2+"&v_comentario="+v_texto+"&v_paramail="+v_mail2+"&v_demail="+v_mail1,
	   success: function(msg){			 
			alert("Enviado correctamente");
			window.parent.location="arc_envia_estapagina_c.asp";
	   }
	 });
	}
	else alert(msg_error);
		/*  	$.ajax({
	   type: "POST",
	   url: "arc_send_pagina.asp",
	   data: "p_user_id="+p_user_id,
	   success: function(msg){			 
			 alert("jjj");
	   }
	 }); */
}


function add_new_res_acertijo(p_user_id,p_cat_id,p_acer_id)
{
	//v_texto=convert_acentos(document.getElementById("v_new_commtenr").value);
	var v_texto="";
	 
 	if (document.getElementById("v_new_commtenr").value=="") v_texto+="\nEl campo RESPUESTA es obligatorio";
	if (document.getElementById("v_nombre").value=="") v_texto+="\nEl campo NOMBRE es obligatorio";
	
	
	if(v_texto.length==0)
	{

	$.ajax({
	   type: "POST",
	   url: "insert_acertijo_respuesta.asp",
	   data: "p_user_id="+p_user_id+"&p_texto="+convert_acentos(document.getElementById("v_new_commtenr").value)+"&p_acertijo_id="+p_acer_id+"&p_cat_id="+p_cat_id+"&p_nombreuser="+escape(document.getElementById("v_nombre").value),
	   success: function(msg){			 
			//document.getElementById("comentario").innerHTML="";	
			window.parent.location="arc_cap_ingenio_acert_view_c.asp?p_categoria="+p_cat_id;
 
		
	   }
	 });	
	}
	else alert(v_texto);
}

function arc_cap_ingenio_respuesta(p_acertijo_id,p_categoria,p_user_id)
{
	//if(p_user_id>0){
	 document.getElementById("arc_respuesta").innerHTML="Cargando...";
	  	$.ajax({
	   type: "POST",
	   url: "add_resp_acertijo.asp",
	   data: "p_user_id="+p_user_id+"&p_cat_id="+p_categoria+"&p_acertijo_id="+p_acertijo_id,
	   success: function(msg){			 
			document.getElementById("arc_respuesta").innerHTML=msg;
	   }
	 }); 	
//	}
//	else  window.parent.location="arc_arclogin_www.asp"
}

function set_video_cpuntos(p_user_id,p_total)
{
 
	  	$.ajax({
	   type: "POST",
	   url: "arc_add_puntos_file.asp",
	   data: "p_user_id="+p_user_id+"&p_total="+p_total,
	   success: function(msg){			 
			 window.parent.location="arc_cap_puntos.asp?p_send=1"
	   }
	 }); 
}

function sec_life_log(p_user_id, p_video_id)
{
 
	  	$.ajax({
	   type: "POST",
	   url: "arc_add_seclife_log.asp",
	   data: "p_user_id="+p_user_id+"&p_video_id="+p_video_id,
	   success: function(msg){			 
			// window.parent.location="arc_cap_puntos.asp"
	   }
	 }); 
}

function catorze_puntos(p_usr_id)
{
	 
	if(p_usr_id>0){
	document.getElementById("comentario").innerHTML="Cargando...";
	$.ajax({
	   type: "POST",
	   url: "catorze_comentario.asp",
	   data: "p_user_id="+p_usr_id,
	   success: function(msg){			 
			document.getElementById("comentario").innerHTML=msg;	
	   }
	 });
	}
	else   window.parent.location="arc_arclogin_www.asp"
	
}

function catorze_close()
{
		 
			document.getElementById("comentario").innerHTML="";	

	
}

function acertijo_close()
{
		 
			document.getElementById("arc_respuesta").innerHTML="";	

	
}

function catorze_new_coment(p_usr_id)
{

	v_texto=convert_acentos(document.getElementById("v_new_commtenr").value);
	if(v_texto!="")
	{
	$.ajax({
	   type: "POST",
	   url: "insert_catorze_comentario.asp",
	   data: "p_user_id="+p_usr_id+"&p_texto="+escape(v_texto),
	   success: function(msg){			 
			//document.getElementById("comentario").innerHTML="";	
			window.parent.location="arc_cap_puntos.asp";
		
	   }
	 });	
	}
	else alert("El campo COMENTARIO es obligatorio");
	
}

function set_ciudad()
{
	var v_puesto_id=document.registrocandidato.v_ciudad[document.registrocandidato.v_ciudad.selectedIndex].value;
	if(v_puesto_id==1000) document.getElementById("ciudadotros").innerHTML="<input name='v_ciudadotras' type='text' id='v_ciudadotras' size='15' />"
	else document.getElementById("ciudadotros").innerHTML="";
}

function e_eval_form()
{
	
	v_puesto_id=document.registrocandidato.v_prof2[document.registrocandidato.v_prof2.selectedIndex].text;
	
	if(v_puesto_id.indexOf("Otros")>=0)
	{
		document.getElementById("sel_puestotrabajo_otros").innerHTML="<input type='text' size=10 id='puestootros' name='puestootros'>";
	}
	else{
		document.getElementById("sel_puestotrabajo_otros").innerHTML="<input type='hidden' size=10 id='puestootros' name='puestootros' value=''>";		
	}
}



function c_jornada()
{
	var v_puesto_id=document.registrocandidato.v_jordnada[document.registrocandidato.v_jordnada.selectedIndex].text;
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sjornada_otros").innerHTML='<input type=text id="f_jornada_otros" name="f_jornada_otros" />';
		
	}
	else document.getElementById("sjornada_otros").innerHTML='<input type=hidden id="f_jornada_otros" name="f_jornada_otros" />';

}

function c_disponibilidad()
{
 
	var v_puesto_id=document.registrocandidato.v_disponibilidad[document.registrocandidato.v_disponibilidad.selectedIndex].text;
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sdisponible_otros").innerHTML='<input type=text id="f_disponible_otros" name="f_disponible_otros" />';
		
	}
	else document.getElementById("sdisponible_otros").innerHTML='<input type=hidden id="f_disponible_otros" name="f_disponible_otros" />';
	
}


function f_sectores_emp()
{
 
	var v_puesto_id=document.f_empresa.e_sector[document.f_empresa.e_sector.selectedIndex].text;
	 
	if(v_puesto_id=="Otros")
	{
		 
		document.getElementById("s_sectorotros").innerHTML='<input type=text id="f_sectorotros" name="f_sectorotros" />';
		
	}
	else document.getElementById("s_sectorotros").innerHTML='<input type=hidden id="f_sectorotros" name="f_sectorotros" value="" />';	
}

function c_secotresotros()
{
 
	var v_puesto_id=document.f_registro.f_sector[document.f_registro.f_sector.selectedIndex].text;
		
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sectores_otros").innerHTML='<input type=text id="f_sectores_otros" name="f_sectores_otros" />';
		
	}
	else document.getElementById("sectores_otros").innerHTML='<input type=hidden id="f_sectores_otros" name="f_sectores_otros" />';
 
}

function c_horario_oferta()
{
	var v_puesto_id=document.oferta.n_horario[document.oferta.n_horario.selectedIndex].text;
	 
	if(v_puesto_id=="Otros")
	{
		document.getElementById("f_horario").innerHTML='<input type=text id="v_horario" name="v_horario" />';
		
	}
	else document.getElementById("f_horario").innerHTML='<input type=hidden id="v_horario" name="v_horario" />';
	
}

function c_contrato_oferta()
{
	var v_puesto_id=document.oferta.n_tipo[document.oferta.n_tipo.selectedIndex].text;
	 
	if(v_puesto_id=="Otros")
	{
		document.getElementById("f_tipocontrato").innerHTML='<input type=text id="v_tipocontrato" name="v_tipocontrato" />';
		
	}
	else document.getElementById("f_tipocontrato").innerHTML='<input type=hidden id="v_tipocontrato" name="v_tipocontrato" />';
	
}

function c_secotresotros_oferta()
{
	var v_puesto_id=document.oferta.n_sector[document.oferta.n_sector.selectedIndex].text;
	 
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sectores_otros").innerHTML='<input type=text id="f_sectores_otros" name="f_sectores_otros" />';
		
	}
	else document.getElementById("sectores_otros").innerHTML='<input type=hidden id="f_sectores_otros" name="f_sectores_otros" />';

}

function c_stitulacion_form_perfil()
{
	
 
		document.getElementById("d_otros_tit_form").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="hidden" id="v_otros_tit_form" size="45" value=""/>';	
		document.getElementById("stitulacion_otros").innerHTML='<input  class="field_normal" name="f_titulacion_otros" type="hidden" id="f_titulacion_otros" size="45" value=""/>';
		document.getElementById("t_oficiales").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="hidden" id="v_otros_tit_form" size="45" value=""/>';	
		
		//<input type=hidden value='' id='v_otros_tit_form' name='v_otros_tit_form'>
		
	var v_puesto_id=document.perfil.n_titulacion[document.perfil.n_titulacion.selectedIndex].text;
  
	if(v_puesto_id=="OTROS")
	{
		document.getElementById("stitulacion_otros").innerHTML='<input type=text id="f_titulacion_otros" name="f_titulacion_otros" />';
		
	}
	else {
		document.getElementById("stitulacion_otros").innerHTML='<input type=hidden id="f_titulacion_otros" name="f_titulacion_otros" value="" />';
		 set_titulacion_of_form();
	}

}


function c_stitulacion_form_oferta()
{
	
  
		document.getElementById("d_otros_tit_form").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="hidden" id="v_otros_tit_form" size="45" value=""/>';	
		document.getElementById("stitulacion_otros").innerHTML='<input  class="field_normal" name="f_titulacion_otros" type="hidden" id="f_titulacion_otros" size="45" value=""/>';
		document.getElementById("t_oficiales").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="hidden" id="v_otros_tit_form" size="45" value=""/>';	
		
		//<input type=hidden value='' id='v_otros_tit_form' name='v_otros_tit_form'>
		
	var v_puesto_id=document.oferta.n_titulacion[document.oferta.n_titulacion.selectedIndex].text;

	if(v_puesto_id=="OTROS")
	{
		document.getElementById("stitulacion_otros").innerHTML='<input type=text id="f_titulacion_otros" name="f_titulacion_otros" />';
		
	}
	else {
		document.getElementById("stitulacion_otros").innerHTML='<input type=hidden id="f_titulacion_otros" name="f_titulacion_otros" value="" />';
	 
		 set_titulacion_of_form_oferta();
	}

}


function set_tit_otros_form_oferta()
{

	v_cadena=document.oferta.n_espcial[document.oferta.n_espcial.selectedIndex].text;
	if(v_cadena.indexOf("Otros")>=0)
	{
	
		document.getElementById("d_otros_tit_form").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="text" id="v_otros_tit_form" size="45" />';
	}
	else{
		document.getElementById("d_otros_tit_form").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="hidden" id="v_otros_tit_form" size="45" value=""/>';		
	}
}

function set_tit_otros_form()
{

	v_cadena=document.perfil.n_espcial[document.perfil.n_espcial.selectedIndex].text;
	if(v_cadena.indexOf("Otros")>=0)
	{
	
		document.getElementById("d_otros_tit_form").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="text" id="v_otros_tit_form" size="45" />';
	}
	else{
		document.getElementById("d_otros_tit_form").innerHTML='<input  class="field_normal" name="v_otros_tit_form" type="hidden" id="v_otros_tit_form" size="45" value=""/>';		
	}
}


function set_titulacion_of_form_oferta()
{
	document.getElementById("t_oficiales").innerHTML="Cargando...";
	//document.getElementById("d_otros_tit").innerHTML='<input  class="field_normal" name="v_otros_tit" type="hidden" id="v_otros_tit" size="45" value=""/>';		
	
	v_pid=document.oferta.n_titulacion[document.oferta.n_titulacion.selectedIndex].value;

	//otros titulacion alert(document.registrocandidato.v_titulos[document.registrocandidato.v_titulos.selectedIndex].text);
		$.ajax({
	   type: "POST",
	   url: "get_tit_oficial_form_oferta.asp",
	   data: "p_id="+v_pid,
	   success: function(msg){
		    
		   if( msg !=0){
		  	// document.getElementById("t_oficiales_texto").innerHTML="Especialidad";
		  	 document.getElementById("t_oficiales").innerHTML =msg;
		   }
		   else{
			  // document.getElementById("t_oficiales_texto").innerHTML="<img src='images/hspacer.gif' width=1 height=1 />";
			   document.getElementById("t_oficiales").innerHTML='<input value=""  name="v_espec" type="hidden" id="v_espec" size="1" />';
		   }
	   }
	 });	
}

function set_titulacion_of_form()
{
	document.getElementById("t_oficiales").innerHTML="Cargando...";
	//document.getElementById("d_otros_tit").innerHTML='<input  class="field_normal" name="v_otros_tit" type="hidden" id="v_otros_tit" size="45" value=""/>';		
	
	v_pid=document.perfil.n_titulacion[document.perfil.n_titulacion.selectedIndex].value;
 
	//otros titulacion alert(document.registrocandidato.v_titulos[document.registrocandidato.v_titulos.selectedIndex].text);
		$.ajax({
	   type: "POST",
	   url: "get_tit_oficial_form.asp",
	   data: "p_id="+v_pid,
	   success: function(msg){
		   
		   if( msg !=0){
		  	// document.getElementById("t_oficiales_texto").innerHTML="Especialidad";
		  	 document.getElementById("t_oficiales").innerHTML =msg;
		   }
		   else{
			  // document.getElementById("t_oficiales_texto").innerHTML="<img src='images/hspacer.gif' width=1 height=1 />";
			   document.getElementById("t_oficiales").innerHTML='<input value=""  name="v_espec" type="hidden" id="v_espec" size="1" />';
		   }
	   }
	 });	
}



function c_sdisponible_form_perfil()
{
	 
	var v_puesto_id=document.perfil.n_disponibilidad[document.perfil.n_disponibilidad.selectedIndex].text;
 
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sdisponible_otros").innerHTML='<input type=text id="f_disponibilidadotros" name="f_disponibilidadotros" />';
		
	}
	else document.getElementById("sdisponible_otros").innerHTML='<input type=hidden id="f_disponibilidadotros" name="f_disponibilidadotros" value="" />';

}

function c_sjornada_form_perfil()
{
	 
	var v_puesto_id=document.perfil.n_jornada[document.perfil.n_jornada.selectedIndex].text;
 
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sjornada_otros").innerHTML='<input type=text id="f_jornadaotros" name="f_jornadaotros" />';
		
	}
	else document.getElementById("sjornada_otros").innerHTML='<input value="" type=hidden id="f_jornadaotros" name="f_jornadaotros" />';

}

function c_sactual_form_perfil()
{
	 
	var v_puesto_id=document.perfil.n_situacion[document.perfil.n_situacion.selectedIndex].text;
 
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sactual_otros").innerHTML='<input type=text id="f_sactualotros" name="f_sactualotros" />';
		
	}
	else document.getElementById("sactual_otros").innerHTML='<input type=hidden id="f_sactualotros" name="f_sactualotros" />';

}

function c_sactual()
{
	 
	var v_puesto_id=document.registrocandidato.v_situacion[document.registrocandidato.v_situacion.selectedIndex].text;
	if(v_puesto_id=="Otros")
	{
		document.getElementById("sactual_otros").innerHTML='<input type=text id="f_sactualotros" name="f_sactualotros" />';
		
	}
	else document.getElementById("sactual_otros").innerHTML='<input type=hidden id="f_sactualotros" name="f_sactualotros" />';

}


function showpuestotrabajo_forid(p_id)
{
 
	var v_puesto_id=p_id;
	 
	document.getElementById("sel_puestotrabajo_otros").innerHTML="<input type='hidden' size=10 id='puestootros' name='puestootros' value=''>";


document.getElementById("sel_puestotrabajo").innerHTML='Cargando...';
 
$.ajax({
	   type: "POST",
	   url: "get_puestodetrabajo.asp",
	   data: "p_puesto_id="+v_puesto_id,
	   success: function(msg){			 
			document.getElementById("sel_puestotrabajo").innerHTML=msg;
			if (v_puesto_id==16)  document.getElementById("puestotrabajo").innerHTML="Otros: ";
			else document.getElementById("puestotrabajo").innerHTML="Puesto de Trabajo: ";
	   }
	 });		
	
}


function showpuestotrabajo()
{
 
	var v_puesto_id=document.getElementById("v_prof").value//document.getElementById("v_prof").selectedIndex;
//	alert(document.getElementById("v_prof").value);
	//document.registrocandidato.v_prof[document.registrocandidato.v_prof.selectedIndex].value;
	 
	document.getElementById("sel_puestotrabajo_otros").innerHTML="<input type='hidden' size=10 id='puestootros' name='puestootros' value=''>";


document.getElementById("sel_puestotrabajo").innerHTML='Cargando...';
 
$.ajax({
	   type: "POST",
	   url: "get_puestodetrabajo.asp",
	   data: "p_puesto_id="+v_puesto_id,
	   success: function(msg){			 
			document.getElementById("sel_puestotrabajo").innerHTML=msg;
			if (v_puesto_id==16)  document.getElementById("puestotrabajo").innerHTML="Otros";
			else document.getElementById("puestotrabajo").innerHTML="Puesto de Trabajo";
	   }
	 });		
	
}
 
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
} 
 
function MM_openBrWindow(theURL,winName,features) { //v2.0
 
  window.open(theURL,winName,features);
}


/*
el flash oculto va fuera o no?, desde el punto de encuentro cuando queramos "iniciar conversación" llamamos a:
todo esto no funciona el chat oculto debe mantenerse VAYA TELA, AL HACER LOGIN EL FLASH OCUTLO DEBE CONECTARSE SIEMPRE A FLASHCOM
- start_arcjob_chat, esta pagina mira si el usuario destino está en el sistema y conectado; si está conectado crea dos conexiones a flashcom nc_1, nc_2 y empieza el chat. el flash abre un pop-ur a usuario origen y usuario destiono. Para controlar si esta conectado, ocupado, etc es importnt la session 30m. si supera este tiempo pondrá siempre desconectado
- al abrir pchat.asp,  con la cadena string 66#$#jordi#$#vidal#623#$#apellido tal i como esta; de esta forma podriamos tener muchos chats abiertos aunque como ahora nos ponemos como ocupados solo puede haber una conversación activa 

*/

//funcion llamada desde el flash para iniciar conversación
//el flash oculto del id_origen ejecuta la funcion en el flash oculto del id_destino
function start_arcjob_chat(p_origen_user_id,p_destino_user_id)
{
	alert("soy"+p_origen_user_id);
		alert("para"+p_destino_user_id);
    //ponemos el usuario origen en ocupado
	update_status_db(p_origen_user_id,2);
	//if el usuario destino no está ni ocupado ni desconectado
	if(get_status_user(p_destino_user_id) !=2 && get_status_user(p_destino_user_id) != 3)
	{
		//ponemos el usuario destino ocupado
		update_status_db(p_destino_user_id,2);
		//generamos los 2 xml que necesita el chat para mostrar la información	 y diseño
		$.ajax({
		   type: "POST",
		   url: "arc_build_xml_chat_ids.asp",
		   data: "p_origen_id="+p_origen_user_id+"&p_destino_id="+p_destino_user_id,
		   success: function(msg){
		
			//Una vez generados los xml abrimos la ventana con el chat en flash	, el flash lee los xml y muestra diseño		
			submit_URL('pchat.asp?p_origen_id='+p_origen_user_id+'&p_destino_id='+p_destino_user_id,770,450);
			}
		});
	
	}
}
//Cerramos chat, ponemos usario como conectado; esta funcion la llama cada ventana cuando se cierra
//si no cerramos el pop-up no llamara a esta función y por lo tanto estamos ocupados
function close_arcjob_chat(p_usr_id)
{
		update_status_db(p_usr_id,1);		
}


function set_busca_term(p_term)
{
	document.getElementById("p_cadena").value=p_term;
	document.getElementById("lastest_querys").innerHTML= "";
}

function show_last_saved_querys(p_user_id,p)
{
	
	
	if(p==1) {
	document.getElementById("morequery").innerHTML="<a href='javascript:show_last_saved_querys("+p_user_id+",0);'>&Uacute;ltimas b&uacute;squedas</a>"
		document.getElementById("lastest_querys").innerHTML= "Cargando...";
		$.ajax({
		   type: "POST",
		   url: "get_user_lastquerys.asp",
		   data: "p_user_id="+p_user_id,
		   success: function(msg){
				document.getElementById("lastest_querys").innerHTML=msg;
			}
		});
	}
	else {	
		document.getElementById("morequery").innerHTML="<a href='javascript:show_last_saved_querys("+p_user_id+",1);'>&Uacute;ltimas b&uacute;squedas</a>";
		document.getElementById("lastest_querys").innerHTML="";
	}

	
}

function get_status_user(p_user_id)
{
		$.ajax({
		   type: "POST",
		   url: "get_user_status.asp",
		   data: "p_user_id="+p_user_id,
		   success: function(msg){
				return msg;
			}
		});
	
}

function obtenerText(p_section_id)
{
 
thisMovie("ARCJOB").get_from_html(p_section_id)
}

function thisMovie(movieName) {
   if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    }
    else {
      if(document[movieName].length != undefined){
         return document[movieName];
      }
        
    }
}

 
 function favoritos()
{
if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
var url="http://www.arcjob.net"; 
var titulo="ARCJOB";
window.external.AddFavorite(url,titulo);
}
 
else {
if(navigator.appName == "Netscape")
alert ("Presiones Crtl+D para añadir ARCJOB como Bookmark");  
}
 
}
function add(){ 
window.sidebar.addPanel("ARCJOB", "http://www.arcjob.net/", ""); 
} 

function show_user_pictures(p_user_id,w,h)
{
var window_width = w;
              var window_height = h;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;	
mywindow = window.open("arc_ver_images.asp?p_user_id="+p_user_id, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');	
	
}


function arc_print_mail(p_user_id,p_mail_id,w,h,p_all)
{
	              var window_width = w;
              var window_height = h;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;	
mywindow = window.open("arc_print_mail.asp?p_mail_id="+p_mail_id+"&p_user_id="+p_user_id+"&p_all="+p_all, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');	

}

function arc_print(p_type,p_user_id,p_id,w,h)
{
              var window_width = w;
              var window_height = h;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;	
mywindow = window.open("arc_print.asp?p_user_id="+p_user_id+"&p_id="+p_id+"&p_type="+p_type, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');	
}

function insertar_oferta(p_user_id)
{ 
              var window_width = screen.width;;
              var window_height = screen.height;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
mywindow = window.open("arc_insertar_oferta.asp?p_user_id="+p_user_id, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');
}

function ver_article(p_article_id)
{ 
              var window_width = 758;
              var window_height = 679;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
 ver_article
 mywindow = window.open("pdfs/tools/art/"+p_article_id, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+screen.width+',height='+screen.height+',top='+window_top+',left='+window_left+''); 
//mywindow = window.open("pdf/art"+p_article_id+".html", 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+screen.width+',height='+screen.height+',top='+window_top+',left='+window_left+'');
}

function insertar_perfil(p_user_id)
{ 
              var window_width = screen.width;;
              var window_height = screen.height;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
mywindow = window.open("arc_insertar_perfil.asp?p_user_id="+p_user_id, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');
}

function editar_perfil(p_perfil_id,p_user_id)
{  

 
              var window_width = screen.width;
              var window_height = screen.height;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
mywindow = window.open("arc_editar_perfil.asp?p_perfil_id="+p_perfil_id+"&p_user_id="+p_user_id, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=yes,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');
}


function ver_perfil(p_perfil_id,p_user_id,p_type)
{
	 

              var window_width = screen.width;;
              var window_height = screen.height;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
mywindow = window.open("arc_view_perfil.asp?p_typeuser="+p_type+"&p_perfil_id="+p_perfil_id+"&p_user_id="+p_user_id, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');
}


function ver_modificar(p_oferta_id,p_user_id)
{

              var window_width = screen.width;;
              var window_height = screen.height;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
mywindow = window.open("arc_modificar_oferta.asp?p_oferta_id="+p_oferta_id+"&p_user_id="+p_user_id, 'ARCJOB','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');
}

function ver_oferta(p_oferta_id,p_user_id)
{

              var window_width = screen.width;;
              var window_height = screen.height;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
mywindow = window.open("arc_view_oferta.asp?p_oferta_id="+p_oferta_id+"&p_user_id="+p_user_id, '','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');
}

function ver_oferta_home(p_oferta_id,p_user_id)
{

              var window_width = screen.width;;
              var window_height = screen.height;
              var newfeatures= 'scrollbars=yes,resizable=no';
              var window_top = (screen.height-window_height)/2;
              var window_left = (screen.width-window_width)/2;
mywindow = window.open("arc_view_oferta_h.asp?p_oferta_id="+p_oferta_id, '','toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width='+window_width+',height='+window_height+',top='+window_top+',left='+window_left+'');
}
function detectout(){
  // thisMovie("swfmovie").detectExit();
  
    //alert("Adios , me ejecuto por onBerforeUnload");
}
//alert(leerCookie('arcjob_site'));

 
mi_cookie = document.cookie.split("; ")
for (i=0; i<mi_cookie.length; i++) {
	if(mi_cookie[i].split("=")[0]=="arcjob_site")
	{
		//alert("valor"+mi_cookie[i].split("=")[1]);
 
	}
	//alert(mi_cookie[i].split("=")[1]);
 
 
}
function leerCookie(nombre) {
   a = document.cookie.substring(document.cookie.indexOf(nombre + '=') + nombre.length + 1,document.cookie.length);
   if(a.indexOf(';') != -1)a = a.substring(0,a.indexOf(';'))
   return a; 
}
//window.onbeforeunload = detectout;


function get_status_db(p_user_id) {
$.ajax({
   type: "POST",
   url: "get_user_status.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
       v_valor = get_status_user(parseInt(msg));
	   user_connected(v_valor);
   }
 });
} 

function update_apunte(p_apunte_id,p_user_id,p_page)
{
$.ajax({
   type: "POST",
   url: "arc_update_apunte.asp",
   data: "p_apunte_id="+p_apunte_id+"&user_id="+p_user_id+"&p_text="+convert_acentos(document.getElementById("texto_apuntes").value),
   success: function(msg){
	   get_apuntes(p_user_id,p_page);
   }
 });	
}

function arc_search_ofertas(p_user_id,p_sql,p_pagina,p_order)
{

v_sql='SELECT distinct ARC_EMPRESAS_OFERTAs.id,ofe_fecha_mod,ofe_fecha_insert FROM ARC_EMPRESAS_OFERTAS,ARCJOB_USERS where ARCJOB_USERS.id=ofe_ref_id and ofe_activa_oferta=true';
v_sql="Select * from arc_empresas_ofertas,arcjob_users where arcjob_users.id=ofe_ref_id and ofe_activa_oferta=true and ofe_p10  like '%entrali%' order by ofe_fecha_insert desc";
 
$.ajax({
   type: "POST",
   url: "get_search_ofertas.asp",
   data: "p_user_id="+p_user_id+"&p_sql="+escape(v_sql)+"&p_order_id="+p_order+"&p_pagina="+p_pagina,
   success: function(msg){
	   set_preload();
	   arc_paginacion(p_user_id,2,p_order,p_pagina,2);
	   get_total_ofertas_msg(p_user_id);
	   //arc_paginacion(p_user_id,2,p_order,p_pagina);
	   document.getElementById("ofertas").innerHTML =msg;
	set_preload();
		   document.getElementById("link_entrada").innerHTML ="<u>Todas las ofertas</u>";
		   document.getElementById("link_salida").innerHTML ='<a href="javascript:arc_ofertas('+p_user_id+',1,1,1);"   class="arc_mail">Ofertas inscritas</a>';	 
   }
 });	
	
}

function submit_URL(p_url,w,h)
{
	var wndKeepme = window.open(p_url, 'wndKeepme', 'width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes');
	 
}

function l_limpiar_datos()
{
	//document.fofertas.v_sector.selectedIndex=0;
	document.fofertas.reset();
	document.getElementById("t_variables").innerHTML= "";
	//document.fofertas.v_sector[document.fofertas.v_sector.selectedIndex].value=0;
}

function ltrim(s) {
	return s.replace(/^\s+/, "%20");
}

function rtrim(s) {
	return s.replace(/\s+$/, "%20");
}

function buscar_ofertas(p_user_id,p_tipo_id) {

v_msg_error="Debe escojer un campo de búsqueda";

v_sector=document.getElementById("v_sector").value;

v_categoria= document.getElementById("v_categoria").value ;
 
  
  /* v_categoria=v_categoria.replace("á","\u00e1");
  v_categoria=v_categoria.replace("é","\u00e9");
  v_categoria=v_categoria.replace("í","\u00ed");
  v_categoria=v_categoria.replace("ó","\u00f3");
  v_categoria=v_categoria.replace("ú","\u00fa");*/
   
 // v_categoria=v_categoria.replace(/^\s+/,"espacio");
 //v_categoria=rtrim(ltrim(v_categoria))
 // v_categoria="Centralita%20telefónica";
v_vector_cat=v_categoria.split(" ");
v_categoria="";
for(i=0;i<v_vector_cat.length;i++)
{
	 v_categoria+=v_vector_cat[i];
 	 if (i<v_vector_cat.length-1){
		  
		 v_categoria+="%20";
	 }
}
 
 
  //v_categoria=v_categoria.replace(" ","%20");
v_ciudad=document.getElementById("v_lugar").value;
v_sueldo=document.getElementById("v_salario").value;
v_sueldo_b=document.getElementById("v_salario_2").value;
 
if(v_sector==0 && v_categoria==0 && v_ciudad==0 && v_sueldo==0)
{
	alert(v_msg_error);
}
else{
	document.getElementById("ofertas").innerHTML="Cargando...";
	$.ajax({
	   type: "POST",
	   url: "get_buscar_ofertas.asp",
	   data: "p_user_id="+p_user_id+"&p_select1="+v_categoria+"&p_select5="+v_sector+"&p_select2="+v_ciudad+"&p_select3="+v_sueldo+"&p_select4="+v_sueldo_b,//+"&p_select5="+v_categoria+"&p_select2="+unescape(v_ciudad)+"&p_select3="+v_sueldo+"&p_select4="+v_sueldo_b,
	   success: function(msg){ 
	    
		   v_sql=msg.split("#$#");
		   //document.getElementById("arc_paginacion").innerHTML="";
		   document.getElementById("ofertas").innerHTML=v_sql[0];//v_sql[0];	
		   document.getElementById("total_ofertas").innerHTML=v_sql[1];//v_sql[0];	  
		   document.getElementById("t_variables").innerHTML= document.getElementById("t_var1").value;//v_sql[0];
	   }
	 });
}
} 


function get_apuntes(p_user_id,p_page) {

$.ajax({
   type: "POST",
   url: "get_user_apuntes.asp",
   data: "p_user_id="+p_user_id+"&p_page="+p_page,
   success: function(msg){
	   
	   //document.getElementById("texto_apuntes").value=msg;
	   document.getElementById("arc_apuntes").innerHTML =msg;
   }
 });
} 


function arc_upload_cv(p_user_id)
{
	 
				$.ajax({
			   type: "POST",
			   url: "http://www.geniks.com/ARCJODEV/upload_docs/arc_upload_word.php",
			   data: "cadenatexto="+p_user_id+"&iduser="+p_user_id,
			   success: function(msg){
				  alert("jodi");
			   }
			 });	
}

function show_empresa_ofertas(p_user_id)
{
		document.getElementById("e_"+p_user_id).innerHTML="Cargando..."
				$.ajax({
			   type: "POST",
			   url: "get_ofertas_pe.asp",
			   data: "p_empresa_id="+p_user_id,
			   success: function(msg){
				   document.getElementById("e_"+p_user_id).innerHTML=msg;
			   }
			 });	
		
}

function set_div_white(p_div_name)
{
	document.getElementById(p_div_name).innerHTML ="";
}
function clear_all_info_user()
{
	 
		for(i=1;i<=document.getElementById("info_totales").value;i++)//info_totales
						{
		  				document.getElementById("info_"+i).innerHTML="";
						} 
}

  
 function cerrar_user_info(p_div_num)
{
	alert("jj");
	//document.getElementById("info_"+p_div_num).innerHTML="fwefwfwfwfwfwf";  p_div_num
 alert(document.getElementById("info_"+p_div_num).style.visibility);
	document.getElementById("info_"+p_div_num).style.visibility="hidden";
	alert("j");
}
  

function show_user_info(p_div_num,p_id)
{    
	v_vector=document.getElementById(p_div_num).value.split("_");
  	v_user_id=parseInt(v_vector[0]);
	v_perfil_id=parseInt(v_vector[1]);
	v_info_totales=document.getElementById("info_totales").value;
 
	 if(p_id==1){
		//document.getElementById("info_"+p_div_num).innerHTML="Cargando...";
		$.ajax({
			   type: "POST",
			   url: "get_info_user.asp",
			   data: "p_div_id="+p_div_num+"&p_user_id="+v_user_id+"&p_perfil_id="+v_perfil_id,
			   success: function(msg){
				  
						for(i=1;i<=v_info_totales;i++)//info_totales
						{
						$("#tr_"+i).removeAttr("onMouseOver");
	 					$("#tr_"+i).attr( "onMouseOver",  "show_user_info("+i+",1);"  );
						if (i==p_div_num) { 
							document.getElementById("info_"+i).innerHTML="Cargando...";
							$("#tr_"+i).removeAttr("onMouseOver");
	 						$("#tr_"+i).attr( "onMouseOver",  "show_user_info("+i+",5);"  );							
						}
						else document.getElementById("info_"+i).innerHTML="";
							//$("#tr_"+i).attr( "onmouseover", show_user_info(p_div_num,1) );
						}  
				   		document.getElementById("info_"+p_div_num).innerHTML=msg;
						
						//$("#tr_"+p_div_num).attr( "mouseover", show_user_info(1,1) );
						// $("#tr_"+p_div_num).attr( "mouseover", showinfo() );

			   }
			 });
	 
	}
 

  //$("#tr_"+p_div_num).attr( "src",  "imges/j"  ); OK
 
		 
}
 
function arc_mostrar_empresa_recomendados(p_user_id,p_tipo)
{
	document.getElementById("arc_friends").innerHTML="Cargando...";
		// id="op_rec_3" 
		 
    	for (i=1;i<=3;i++)
		{
			$('#op_rec_'+i).attr('onclick', 'return false'); // disable link
			$('#op_rec_'+i).css('text-decoration', 'none');	
			$('#op_rec_'+i).css('color', '#0000FF');	
 			
		}
		$('#op_rec_'+p_tipo).attr('onclick', 'return true'); // disable link
    	$('#op_rec_'+p_tipo).css('text-decoration', 'underline');	
		$('#op_rec_'+p_tipo).css('color', '#000000');	
		$.ajax({
			   type: "POST",
			   url: "get_rc_amigos_empresa_v.asp",
			   data: "p_user_id="+p_user_id+"&p_tipo="+p_tipo,
			   success: function(msg){
				   
				   document.getElementById("arc_friends").innerHTML=msg;
			   }
			 });			
}

function arc_mostrar_amigos_recomendados(p_user_id,p_tipo)
{
	document.getElementById("arc_friends").innerHTML="Cargando...";
		// id="op_rec_3" 
		 
    	for (i=1;i<=3;i++)
		{
			$('#op_rec_'+i).attr('onclick', 'return false'); // disable link
			$('#op_rec_'+i).css('text-decoration', 'none');	
			$('#op_rec_'+i).css('color', '#0000FF');	
 			
		}
		$('#op_rec_'+p_tipo).attr('onclick', 'return true'); // disable link
    	$('#op_rec_'+p_tipo).css('text-decoration', 'underline');	
		$('#op_rec_'+p_tipo).css('color', '#000000');	
		
		$.ajax({
			   type: "POST",
			   url: "get_rc_amigos.asp",
			   data: "p_user_id="+p_user_id+"&p_tipo="+p_tipo,
			   success: function(msg){
				   
				   document.getElementById("arc_friends").innerHTML=msg;
			   }
			 });	
}

function arc_mostrar_amigos_recomendados_empresa(p_user_id,p_tipo)
{
	document.getElementById("arc_friends_"+p_tipo).innerHTML="Cargando...";
		
		$.ajax({
			   type: "POST",
			   url: "get_rc_amigos_empresa.asp",
			   data: "p_user_id="+p_user_id+"&p_tipo="+p_tipo,
			   success: function(msg){
				   
				   document.getElementById("arc_friends_"+p_tipo).innerHTML=msg;
			   }
			 });	
}

function show_alerta(p_cat_id,p_tipo,p_user_id)
{
	if(p_tipo==1){
		document.getElementById("prof_"+p_cat_id).innerHTML="Cargando...";
				$.ajax({
			   type: "POST",
			   url: "get_profesionales_catid.asp",
			   data: "p_cat_id="+p_cat_id+"&p_user_id="+p_user_id,
			   success: function(msg){
				   document.getElementById("prof_"+p_cat_id).innerHTML=msg;
			   }
			 });	
	}
	//empresa
	else{
		document.getElementById("empr_"+p_cat_id).innerHTML="Cargando...";		
					$.ajax({
			   type: "POST",
			   url: "get_empresas_catid.asp",
			   data: "p_cat_id="+p_cat_id+"&p_user_id="+p_user_id,
			   success: function(msg){
				   document.getElementById("empr_"+p_cat_id).innerHTML=msg;
			   }
			 });
	}
}

function show_content_home(p_section_id)
{
 
   document.getElementById("contendio_home").innerHTML="Cargando...";
$.ajax({
   type: "POST",
   url: "get_home_contents.asp",
   data: "p_section_id="+p_section_id,
   success: function(msg){ 
   
	 switch(p_section_id)
	{
		
		case 1:
			document.getElementById("home_articulos").innerHTML='<!a href="javascript:show_content_home(1);"><img src="images/b_ultimos_articulos_on.jpg" width="121" height="26" border="0" /></a>';
			document.getElementById("home_ofertas").innerHTML='<a href="javascript:show_content_home(2);"><img src="images/b_ultimas_ofertas.jpg" width="121" height="26" border="0" /></a>';	
			document.getElementById("home_reclamos").innerHTML='<a href="javascript:show_content_home(3);"><img src="images/b_ultimos_reclamos.jpg" width="121" height="26" border="0" /></a>';		
		break; 
		case 2:
			document.getElementById("home_articulos").innerHTML='<a href="javascript:show_content_home(1);"><img src="images/b_ultimos_articulos.jpg" width="121" height="26" border="0" /></a>';
			document.getElementById("home_ofertas").innerHTML='<!a href="javascript:show_content_home(2);"><img src="images/b_ultimas_ofertas_on.jpg" width="121" height="26" border="0" /></a>';	
			document.getElementById("home_reclamos").innerHTML='<a href="javascript:show_content_home(3);"><img src="images/b_ultimos_reclamos.jpg" width="121" height="26" border="0" /></a>';	
		break; 
		case 3:
			document.getElementById("home_articulos").innerHTML='<a href="javascript:show_content_home(1);"><img src="images/b_ultimos_articulos.jpg" width="121" height="26" border="0" /></a>';
			document.getElementById("home_ofertas").innerHTML='<a href="javascript:show_content_home(2);"><img src="images/b_ultimas_ofertas.jpg" width="121" height="26" border="0" /></a>';	
			document.getElementById("home_reclamos").innerHTML='<!a href="javascript:show_content_home(3);"><img src="images/b_ultimos_reclamos_on.jpg" width="121" height="26" border="0" /></a>';	
		break; 		
	} 

  		document.getElementById("contendio_home").innerHTML=msg;	    
   }
 });	
}

function arc_login_forget()
{
	//p_sem = si guardamos cookie 365 recuerda mi equipo

$.ajax({
   type: "POST",
   url: "get_arc_login.asp",
   data: "p_user="+document.getElementById("arc_login").value+"&p_pwd="+document.getElementById("arc_pwd").value+"&p_sem=0",
   success: function(msg){
	   
	   document.getElementById("loginerror").innerHTML="Verificando usuario...";
	
	   document.getElementById("b_login_form").innerHTML="";
	   if(parseInt(msg)>0){
			  	 v_vector=msg.split(",");
				  window.parent.location="lobby.asp?p_user_id="+v_vector[0]+"&p_type_user="+v_vector[1];
		}
		else{
				setTimeout(function() {login_send_ok()}, 3000);
			   document.getElementById("loginerror").innerHTML="Datos incorrectos";
			   function login_send_ok()
			   {
			   	document.getElementById("loginerror").innerHTML="";
				document.getElementById("b_login_form").innerHTML='<a href="javascript:arc_login_forget();"   ><img src="images/b_login.gif"  border="0" width="85" height="26" alt="Entrar"></a>';
			   }			   
	}	   
	    
   }
 });		
}

function arc_login_green()
{
	//p_sem = si guardamos cookie 365 recuerda mi equipo
	v_url=document.referrer;//document.getElementById("http_ref").value;
	 
$.ajax({
   type: "POST",
   url: "get_arc_login.asp",
   data: "p_user="+document.getElementById("arc_login").value+"&p_pwd="+document.getElementById("arc_pwd").value+"&p_sem=0",
   success: function(msg){
	
	   document.getElementById("loginerror").innerHTML="Verificando usuario...";

	   document.getElementById("b_login_form").innerHTML="";
	  
	   if(parseInt(msg)>0){
		  
			  	 v_vector=msg.split(",");
				 
				 /* if(v_url.indexOf("norma")>=0){
					 
				 	 window.parent.location="lobby.asp?p_user_id="+v_vector[0]+"&p_type_user="+v_vector[1];
				  }
				  else{
					  
					  if(v_url.indexOf("ingenio")>=0){
						  window.parent.location=v_url+"&p_desp=1";
					  }
					  else{
					 	 window.parent.location=v_url;
					  }
				  }*/
				  window.parent.location="lobby.asp?p_user_id="+v_vector[0]+"&p_type_user="+v_vector[1];
		}
		else{
				setTimeout(function() {login_send_ok()}, 3000);
			   document.getElementById("loginerror").innerHTML="Datos incorrectos";
			   
			   function login_send_ok()
			   {
				 
			   	document.getElementById("loginerror").innerHTML="";
				
				document.getElementById("b_login_form").innerHTML='<a href="javascript:arc_login_green();"   ><img src="images/b_login.gif"  border="0" width="85" height="26" alt="Entrar"></a>';
			   }			   
	}	   
	    
   }
 });	 

}


function pulsar_tecla(e) {
  tecla = (document.all) ? e.keyCode :e.which;

  return (tecla!=13);
} 



function web_ppp(evt,p_user_id,p_tipo,p_sec,p_order,p_page)
{
	
	 var msg="";
	 if(evt==0){
		 tecla=13;
	 }else{
		 tecla=(document.all) ? evt.keyCode : evt.which; 
 	}
	
	if(tecla==13){
//	if (document.getElementById("ppp_buscar").value.length<=3) msg+="\nEl campo PALABRA CLAVE es demasiado corto.";

	if(document.getElementById("v_cat1").value>0 && document.getElementById("v_cat1").value<9 && document.getElementById("dsubcat1").value==0){
		alert("Debe escoger una subcategoria");
	}
	
	
	
	
	
	if(msg==""){
		 window.parent.location="pencuentro.asp?p_user_id="+p_user_id+"&p_type_user="+p_tipo+"&sec="+p_sec+"&p_order="+p_order+"&p_page="+p_page+"&p_cadena="+document.getElementById("ppp_buscar").value+"&p_cat="+document.getElementById("v_cat1").value+"&p_subcat="+document.getElementById("dsubcat1").value;
	}
	else{
		alert(msg);
	}
}
	return (tecla!=13);
}

function web_buscar(evt)
{
		 var msg="";
	 if(evt==0){
		 tecla=13;
	 }else{
		 tecla=(document.all) ? evt.keyCode : evt.which; 
 	}
	
	if(tecla==13){
		if (document.getElementById("s_opciones").value==0) msg+="\nDebe seleccionar una opción";
		if (document.getElementById("p_cadena").value.length<=3) msg+="\nEl campo PALABRA CLAVE es demasiado corto.";
		
		if(msg==""){
			 
		document.web_buscador.submit();
		}
		else{
			alert(msg);
		}	
	}
	return (tecla!=13); 
}


function buzon_buscar(evt)
{
	 var msg="";
	 if(evt==0){
		 tecla=13;
	 }else{
		 tecla=(document.all) ? evt.keyCode : evt.which; 
 	}
	
	if(tecla==13)
	{
	 
 	if(document.getElementById("p_cadena").value=="") msg+="\nEl campo palabra clave es obligatorio";
	 if(document.getElementById("p_cadena").value.length<=3) msg+="\nEl campo palabra clave es demasiado corto";
	 if(document.getElementById("b_opcion").value==0) msg+="\nEl campo criterio a buscar es obligatorio";	 
	 if(msg=="")  document.buscar_buzon.submit();
	 else alert(msg);	
		
	}
	return (tecla!=13); 
	 
}

function arc_login(evt)
{
 if(evt==0){
	 tecla=13;
 }else{
 tecla=(document.all) ? evt.keyCode : evt.which; 
 } 
  
 
var v_sem=0;  
if (document.getElementById("t_remember_me").checked) v_sem=1;
 

if(tecla==13)
{
$.ajax({
   type: "POST",
   url: "get_arc_login.asp",
   data: "p_user="+document.getElementById("arc_login").value+"&p_pwd="+document.getElementById("arc_pwd").value+"&p_sem="+v_sem,
   success: function(msg){

	   document.getElementById("loginerror").innerHTML="Verificando usuario...";
	     
 
	      
	   if(parseInt(msg)>0){
			  	 v_vector=msg.split(",");
				  window.parent.location="lobby.asp?p_user_id="+v_vector[0]+"&p_type_user="+v_vector[1];
		}
		else{
				setTimeout(function() {login_send_ok()}, 3000);
			   document.getElementById("loginerror").innerHTML="Datos incorrectos";
			   function login_send_ok()
			   {
			   	document.getElementById("loginerror").innerHTML="";
				document.getElementById("b_login_form").innerHTML='<a href="javascript:arc_login();" class="button"  >ENTRAR</a>&nbsp;';
			   }			   
	}	   
	    
   }
 });	

}
 

}

function ver_reclamo_mas(p_id)
{
	alert(p_id);
	//document.getElementById("reclamo_ext").innerHTML="Cargando...";
		/*	$.ajax({
			   type: "POST",
			   url: "get_textos.asp",
			   data: "p_section_id="+p_section_home_id+"&p_tipo_id="+p_tipo_id,
			   success: function(msg){
				  // v_total=document.getElementById("texto_menu").innerHTML.length;
				   document.getElementById("texto_menu").innerHTML =msg;
			   }
			 });*/
			
}




function arc_search_favoritos(p_user_id)
{
	
	 
	document.getElementById("quizir_results").innerHTML="";
	if(document.getElementById("f_search").value=="")
	{
		alert("Debe escribir un nombre");
	}
	else{
	
		document.getElementById("quizir_results_buscados").innerHTML="Buscando..."
	    $.ajax({
			   type: "POST",
			   url: "get_favoritos_buscar.asp",
			   data: "p_user_id="+p_user_id+"&p_query="+document.getElementById("f_search").value,
			   success: function(msg){
				 document.getElementById("quizir_results_buscados").innerHTML=msg;
				   //document.getElementById("texto_menu").innerHTML =msg;
			   }
			 });		
	}
}


function arc_search_contactos(p_user_id)
{
	
	
	document.getElementById("quizir_results").innerHTML="";
	if(document.getElementById("f_search").value=="")
	{
		alert("Debe escribir un nombre");
	}
	else{
	
		document.getElementById("quizir_results_buscados").innerHTML="Buscando..."
	
	    $.ajax({
			   type: "POST",
			   url: "get_contactos_buscar.asp",
			   data: "p_user_id="+p_user_id+"&p_query="+escape(document.getElementById("f_search").value),
			   success: function(msg){
				   
				 document.getElementById("quizir_results_buscados").innerHTML=msg;
				   //document.getElementById("texto_menu").innerHTML =msg;
			   }
			 });		
	}
}

function show_menu_text(p_section_home_id,p_tipo_id)
{
	//if(p_section_home_id>0 || document.getElementById("texto_menu").innerHTML.length==0) ejecuta ajax
	//alert(document.getElementById("texto_menu").value);
	//if(p_section_home_id>0)	document.getElementById("texto_menu").innerHTML ="<img src=images/bigrotation.gif />";
	if(p_section_home_id==0) {
		document.getElementById("texto_menu").innerHTML="";
	}
	else{
		if(document.getElementById("texto_menu").innerHTML.length==0)
		{
			$.ajax({
			   type: "POST",
			   url: "get_textos.asp",
			   data: "p_section_id="+p_section_home_id+"&p_tipo_id="+p_tipo_id,
			   success: function(msg){
				  // v_total=document.getElementById("texto_menu").innerHTML.length;
				   document.getElementById("texto_menu").innerHTML =msg;
			   }
			 });	
		}
	}
	
}

function arc_borrar_mails(p_user_id,p_orden,ptipo,p_page)
{
 
	var v_mensaje="";
	var v_vector=new Array();
	v_vector=document.arc_mail.ids.value.split(',');
 
	if(document.arc_mail.ids.value=="")
	{
		v_mensaje+="Debe seleccionar un mensaje";
	}
	if(v_mensaje=='') {
 	
		
		v_data=document.arc_mail.ids.value;
		
		set_preload("Borrando "+(v_vector.length-1)+" mensajes...<br>");
		$.ajax({
		   type: "POST",
		   url: "get_delete_mail.asp",
		   data: "p_user_id="+p_user_id+"&p_varchar="+v_data+"&ptipo="+ptipo,
		   success: function(msg){
			   setTimeout(function() {mail_send_ok()}, 2000);
			   set_texto_ventana(""+(v_vector.length-1)+" Mensajes borrados!");
			   document.arc_mail.ids.value="";
			   function mail_send_ok()
			   {
				   document.getElementById("div_preload").style.visibility="hidden";
				  arc_mail(p_user_id,p_orden,ptipo,p_page)
				   //window.parent.location="arc_buzon.asp?p_user_id="+p_user_id+"&p_user_type="+ptipo+"&sec=4&tipo=0";//tipo es la pestaña
			   }
			   
		   }
		 });
	}
	else alert(v_mensaje);
	
}

function show_iframe(p_layer_name)
{  
	
	      var obj = document.getElementById(p_layer_name)
         if(obj.style.display == 'block') obj.style.display = 'none'
         else obj.style.display = 'block'
 
}
function hidden_iframe(p_layer_name)
{  
	
	      var obj = document.getElementById(p_layer_name);
         if(obj.style.display == 'block') obj.style.display = 'none'
         else obj.style.display = 'none'
      
 
}
/*function close_ilayer(p_layer_name)
{

		var oIfr = document.getElementById(p_layer_name); 
	    oIfr.style.display="block";	alert("j");
}
*/

function set_ids(p_valor,p_estado)
{
	//3569
	 
 if(p_estado==false)
 {
	 
	 var v_cad = document.getElementById("ids").value;//document.arc_mail.ids.value;
	 
	 v_cad=v_cad.replace(p_valor+"," ,"");
	 //document.arc_mail.ids.value=v_cad;
	 document.getElementById("ids").value=v_cad;
 }
 else{
 	//document.arc_mail.ids.value+=p_valor+",";
	document.getElementById("ids").value+=p_valor+",";
 }
}

function arc_sugerencia(p_user_id,p_type)
{
 
	var v_msg_error ='';
	v_nombre = convert_acentos(document.getElementById("f_nombre").value);
	v_mail = document.getElementById("f_mail").value  
	v_telf = document.getElementById("f_telf").value ;
	v_asunto = convert_acentos(document.getElementById("f_asunto").value) ;
	v_sugerencia = convert_acentos(document.getElementById("f_sug").value) ;	
	if (v_nombre=='') {
	    v_msg_error+="El campo NOMBRE es obligatorio\n";		
	}
	
	if (v_sugerencia=='') {
	    v_msg_error+="El campo SUGERENCIA es obligatorio\n";		
	}
	if (v_asunto=='') {
	    v_msg_error+="El campo ASUNTO es obligatorio\n";		
	}
	if (v_mail=='') {
	    v_msg_error+="El campo CORREO ELECTRÓNICO es obligatorio\n";		
	}
	if (v_mail.indexOf("@")==-1)
	{
		v_msg_error+="El campo CORREO ELECTRÓNICO debe ser una dirección válida\n";	
	}
 	 
	if(v_msg_error=='')  
	{	
 
		 
		if (p_user_id>0)
		{
		$.ajax({
		   type: "POST",
		   url: "get_enviar_sugerencia.asp",
		   data: "n_id="+p_user_id+"&n_p1="+escape(v_nombre)+"&n_p2="+v_mail+"&n_p4="+escape(v_asunto)+"&n_p3="+v_telf+"&n_p5="+escape(v_sugerencia),
		   success: function(msg){
				   window.parent.location="lobby.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=0";//tipo es la pestaña
			   
		   }
		 });
		}
		else{
				   window.parent.location="index.asp";
		}
	}
	else  alert(v_msg_error);	
	
}


function arc_consulta(p_user_id,p_type)
{
	var v_msg_error ='';
	v_consulta = convert_acentos(document.fconsulta.f_consulta.value);
	if (v_consulta=='') {
	    v_msg_error+="El campo CONSULTA es obligatorio\n";		
	}
	
	if(v_msg_error=='')  
	{	
	 
		set_preload("Enviando consulta...<br>");
		$.ajax({
		   type: "POST",
		   url: "get_enviar_CONSULTA.asp",
		   data: "n_p2="+p_user_id+"&n_p1="+escape(v_consulta),
		   success: function(msg){
			   setTimeout(function() {mail_send_ok()}, 2000);
			   set_texto_ventana("Consulta enviada!");
			   function mail_send_ok()
			   {
				   document.getElementById("div_preload").style.visibility="hidden";
				   window.parent.location="lobby.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=0";//tipo es la pestaña
			   }
			   
		   }
		 });
	}
	else  alert(v_msg_error);	
	
}


function arc_send_my_oferta(p_user_id,p_tipo)
{
 
	var msg_error="";
	var v_mails=0;
	var v_para=0;
	if(document.getElementById("n_subject").value=="") msg_error+="\nEl campo ASUNTO es obligatorio";
	if(document.getElementById("n_texto").value.length==0) msg_error+="\nEl campo texto es obligatorio";
	if(document.getElementById("sel_oferta_se").value==0) msg_error+="\nDebe seleccinar una OFERTA para añadir";
	if(document.getElementById("n_contacto").value==0 && document.getElementById("n_otros").value.length==0) msg_error+="\nLos campos PARA o E-MAIL son obligatorios";
	
	if(document.getElementById("n_otros").value.length>0) {
		
		if(document.getElementById("n_otros").value.indexOf("@")>=0) {
			v_mails = document.getElementById("n_otros").value;
		}
		else msg_error+="\nEl campo E-MAIL debe contener una direccion de correo electronico";
	}
	 
	if(document.getElementById("n_contacto").value>0)  v_para=document.getElementById("n_contacto").value;


	if(msg_error=="") {
		 
			$.ajax({
		   type: "POST",
		   url: "arc_send_oferta.asp",
		   data: "p_user_id="+p_user_id+"&p_para_id="+v_para+"&p_mensaje="+escape(tinyMCE.get('n_texto').getContent())+"&p_asunto="+escape(document.getElementById("n_subject").value)+"&p_mails="+v_mails,
		   success: function(msg){
			   
				    window.parent.location="arc_gestion_ofertas_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_tipo+"&sec=1";//tipo es la pestaña
		
			   
		   }
		 });
	}
	else alert(msg_error);
	
	
	
}


function arc_send_my_se(p_user_id,p_tipo)
{
 
	var msg_error="";
	var v_mails=0;
	var v_para=0;
	if(document.getElementById("n_subject").value=="") msg_error+="\nEl campo ASUNTO es obligatorio";
	if(document.getElementById("n_texto").value.length==0) msg_error+="\nEl campo texto es obligatorio";
	if(document.getElementById("sel_elevator_se").value==0) msg_error+="\nDebe seleccinar un RECLAMO para añadir";
	if(document.getElementById("n_contacto").value==0 && document.getElementById("n_otros").value.length==0) msg_error+="\nLos campos PARA o E-MAIL son obligatorios";
	
	if(document.getElementById("n_otros").value.length>0) {
		
		if(document.getElementById("n_otros").value.indexOf("@")>=0) {
			v_mails = document.getElementById("n_otros").value;
		}
		else msg_error+="\nEl campo E-MAIL debe contener una direccion de correo electronico";
	}
	 
	if(document.getElementById("n_contacto").value>0)  v_para=document.getElementById("n_contacto").value;

	 
	if(msg_error=="") {
		 
			$.ajax({
		   type: "POST",
		   url: "arc_send_es.asp",
		   data: "p_user_id="+p_user_id+"&p_para_id="+v_para+"&p_mensaje="+escape(tinyMCE.get('n_texto').getContent())+"&p_asunto="+escape(document.getElementById("n_subject").value)+"&p_mails="+v_mails,
		   success: function(msg){
			   
				    window.parent.location="arc_gestion_reclamos_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_tipo+"&sec=1";//tipo es la pestaña
		
			   
		   }
		 });
	}
	else alert(msg_error);
	
	
	
}


function arc_send_my_profile(p_user_id,p_tipo)
{
 
 
	var msg_error="";
	var v_mails=0;
	var v_para=0;
	if(document.getElementById("n_subject").value=="") msg_error+="\nEl campo ASUNTO es obligatorio";
	if(document.getElementById("n_texto").value.length==0) msg_error+="\nEl campo texto es obligatorio";
	//if(document.getElementById("sel_perfil").value==0) msg_error+="\nDebe seleccinar un ELEVATOR SPEECH para añadir";
	if(document.getElementById("n_contacto").value==0 && document.getElementById("n_otros").value.length==0) msg_error+="\nLos campos PARA o E-MAIL son obligatorios";
	
	if(document.getElementById("n_otros").value.length>0) {
		
		if(document.getElementById("n_otros").value.indexOf("@")>=0) {
			v_mails = document.getElementById("n_otros").value;
		}
		else msg_error+="\nEl campo E-MAIL debe contener una direccion de correo electronico";
	}
	 
	if(document.getElementById("n_contacto").value>0)  v_para=document.getElementById("n_contacto").value;
 
	 
	if(msg_error=="") {
		 
			$.ajax({
		   type: "POST",
		   url: "arc_send_perfil.asp",
		   data: "p_user_id="+p_user_id+"&p_para_id="+v_para+"&p_mensaje="+escape(tinyMCE.get('n_texto').getContent())+"&p_asunto="+escape(document.getElementById("n_subject").value)+"&p_mails="+v_mails+"&p_perfil_id="+document.getElementById("sel_perfil").value,
		   success: function(msg){
			   
				     window.parent.location="arc_perfiles_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0";//tipo es la pestaña
		
			   
		   }
		 });
	}
	else alert(msg_error);
	
	
	
}


function arc_mail_enviar(p_user_id,ptipo)
{
	
	var v_msg_error ='';
	var v_own_mail_id=0;
	v_asunto = document.getElementById("v_asunto").value;
	v_mensaje = tinyMCE.get('arc_mensaje').getContent();//document.f_enviar.arc_mensaje.value;
	 
	v_para = document.getElementById("p_para").value;
	

	if (v_asunto=='') {
	    v_msg_error+="El campo ASUNTO es obligatorio\n";		
	}
	if (v_mensaje=='') {
	    v_msg_error+="El campo MENSAJE es obligatorio\n";		
	}
	if (v_para==0) {//
	    v_msg_error+="El campo PARA es obligatorio\n";
	}	
	
	if (document.getElementById("arc_copia").checked==true) v_own_mail_id = p_user_id;
	 
	if(v_msg_error=='')  
	{	
	 
		
		$.ajax({
		   type: "POST",
		   url: "get_enviar_mail.asp",
		   data: "p_user_id="+p_user_id+"&p_para_id="+v_para+"&p_mensaje="+escape(v_mensaje)+"&p_asunto="+v_asunto+"&p_own="+v_own_mail_id,
		   success: function(msg){
			   
				   window.parent.location="arc_buzon_c.asp?p_user_id="+p_user_id+"&p_type_user="+ptipo+"&sec=0&tipo=0";//tipo es la pestaña
		
			   
		   }
		 });
	}
	else  alert(v_msg_error);	
	
}
 
function urldecode( str ) {
	 
    // Decodes URL-encoded string  
    // 
    // version: 907.503
    // discuss at: http://phpjs.org/functions/urldecode
    // +   original by: Philip Peterson
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: AJ
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Brett Zamir (http://brett-zamir.me)
    // +      input by: travc
    // +      input by: Brett Zamir (http://brett-zamir.me)
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Lars Fischer
    // +      input by: Ratheous
        // +   improved by: @Shamun Toha
        // +       note by: - Shamun: decodeURIComponent failed on many characters
    // %        note 1: info on what encoding functions to use from: http://xkr.us/articles/javascript/encode-compare/
    // *     example 1: urldecode('Kevin+van+Zonneveld%21');
    // *     returns 1: 'Kevin van Zonneveld!'
    // *     example 2: urldecode('http%3A%2F%2Fkevin.vanzonneveld.net%2F');
    // *     returns 2: 'http://kevin.vanzonneveld.net/'
    // *     example 3: urldecode('http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a');
    // *     returns 3: 'http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a'
        // *     example 4: urldecode("%3Ctr%3E%3Ctd%3Einfo%40jquery.com%20space%20%E9%3C%2Ftd%3E%3C%2Ftr%3E");
        // *     returns 4: <tr><td>info@jquery.com Space e</td></tr>
    
    var hash_map = {}, ret = str.toString(), unicodeStr='', hexEscStr='';
    
    var replacer = function(search, replace, str) {
        var tmp_arr = [];
        tmp_arr = str.split(search);
        return tmp_arr.join(replace);
    };
    
    // The hash_map is identical to the one in urlencode.
    hash_map["'"]   = '%27';
    hash_map['(']   = '%28';
    hash_map[')']   = '%29';
    hash_map['*']   = '%2A';
    hash_map['~']   = '%7E';
    hash_map['!']   = '%21';
    hash_map['%20'] = '+';
    hash_map['\u00DC'] = '%DC';
    hash_map['\u00FC'] = '%FC';
    hash_map['\u00C4'] = '%D4';
    hash_map['\u00E4'] = '%E4';
    hash_map['\u00D6'] = '%D6';
    hash_map['\u00F6'] = '%F6';
    hash_map['\u00DF'] = '%DF';
    hash_map['\u20AC'] = '%80';
    hash_map['\u0081'] = '%81';
    hash_map['\u201A'] = '%82';
    hash_map['\u0192'] = '%83';
    hash_map['\u201E'] = '%84';
    hash_map['\u2026'] = '%85';
    hash_map['\u2020'] = '%86';
    hash_map['\u2021'] = '%87';
    hash_map['\u02C6'] = '%88';
    hash_map['\u2030'] = '%89';
    hash_map['\u0160'] = '%8A';
    hash_map['\u2039'] = '%8B';
    hash_map['\u0152'] = '%8C';
    hash_map['\u008D'] = '%8D';
    hash_map['\u017D'] = '%8E';
    hash_map['\u008F'] = '%8F';
    hash_map['\u0090'] = '%90';
    hash_map['\u2018'] = '%91';
    hash_map['\u2019'] = '%92';
    hash_map['\u201C'] = '%93';
    hash_map['\u201D'] = '%94';
    hash_map['\u2022'] = '%95';
    hash_map['\u2013'] = '%96';
    hash_map['\u2014'] = '%97';
    hash_map['\u02DC'] = '%98';
    hash_map['\u2122'] = '%99';
    hash_map['\u0161'] = '%9A';
    hash_map['\u203A'] = '%9B';
    hash_map['\u0153'] = '%9C';
    hash_map['\u009D'] = '%9D';
    hash_map['\u017E'] = '%9E';
    hash_map['\u0178'] = '%9F';
        // on decodeURIComponent failure.
        hash_map['<']      = '%3C';
        hash_map['>']      = '%3E';
        hash_map['/']      = '%2F';
        hash_map['@']      = '%40'; 
        hash_map['e']      = '%E9';     
        hash_map[' ']      = '%20';
        hash_map['w']      = '%F3';		
        
 
    for (unicodeStr in hash_map) {
        hexEscStr = hash_map[unicodeStr]; // Switch order when decoding
        ret = replacer(hexEscStr, unicodeStr, ret); // Custom replace. No regexing
    }
    
    // End with decodeURIComponent, which most resembles PHP's encoding functions
    ret = decodeURIComponent(ret);
 
    return ret;
}

function convert_acentos(p_cadena)
{
	var cadenafinal;
	var valor;
	 
	valor=unescape(p_cadena);
	cadenafinal=valor.replace(/\n/g," <br> ");
	cadenafinal=cadenafinal.replace(/\s/g,"%20");
	cadenafinal=cadenafinal.replace(/\+/gi," ");
		
	return cadenafinal;
}
function arc_mod_reclamo_empresa(p_user_id,p_type,p_reclamo_id)
{
	
	var v_msg_error="";	 
			 
		v_text =tinyMCE.get('f_reclamo').getContent();//convert_acentos(document.getElementById("f_reclamo").value);
 
		 
					 
		v_perfil_id=document.getElementById("f_perfil_id").value;
		
		v_perfil = document.getElementById("f_perfil_text").value;//document.getElementById("f_perfil_id").options[document.getElementById("f_perfil_id").selectedIndex].text;
	
		
	if(v_text.length==0)
	{
		v_msg_error+="\nEl campo RECLAMO es obligatorio";
	}
	if(v_text.length>1500)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado largo.";
	}	
	if(v_text.length<200)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado corto.";
	}		
	if(v_perfil_id==0)
	{
		v_msg_error+="\nEl campo PERFIL PROFESIONAL es obligatorio.";		
	}
	
 		
 
     if(v_msg_error==""){
	
		$.ajax({
		   type: "POST",
		   url: "arc_mod_reclamo.asp",
		   data: "p_reclamo_id="+p_reclamo_id+"&p_user_id="+p_user_id+"&p_textereclamo="+ escape(v_text) +"&p_nick="+  convert_acentos(v_perfil)  +"&p_perfil="+v_perfil_id+"&p_type="+p_type,
		   success: function(msg){
			    
				   window.parent.location="arc_gestion_reclamos_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=1";
		   }
		 });
	 }
	 else{
		 alert(v_msg_error);
	 }	
	
}
function arc_mod_reclamo(p_user_id,p_type,p_reclamo_id)
{
	var v_msg_error="";	 
			 
		v_text =tinyMCE.get('f_reclamo').getContent();//convert_acentos(document.getElementById("f_reclamo").value);
 
		 
					 
		v_perfil_id=document.getElementById("f_perfil_id").value;
		
		v_perfil = document.getElementById("f_perfil_id").options[document.getElementById("f_perfil_id").selectedIndex].text;
	
		
	if(v_text.length==0)
	{
		v_msg_error+="\nEl campo RECLAMO es obligatorio";
	}
	if(v_text.length>1500)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado largo.";
	}	
	if(v_text.length<200)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado corto.";
	}		
	if(v_perfil_id==0)
	{
		v_msg_error+="\nEl campo PERFIL PROFESIONAL es obligatorio.";		
	}
	
 		
 
     if(v_msg_error==""){
	
		$.ajax({
		   type: "POST",
		   url: "arc_mod_reclamo.asp",
		   data: "p_reclamo_id="+p_reclamo_id+"&p_user_id="+p_user_id+"&p_textereclamo="+ escape(v_text) +"&p_nick="+  convert_acentos(v_perfil)  +"&p_perfil="+v_perfil_id+"&p_type="+p_type,
		   success: function(msg){
			    
				   window.parent.location="arc_gestion_reclamos_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=1";
		   }
		 });
	 }
	 else{
		 alert(v_msg_error);
	 }
}

function arc_modificar_reclamo(p_user_id,p_type)
{
	 var v_msg_error="";
	 
	 v_reclamo_id = document.getElementById("v_selected_reclamo").value;
 
 
 
	if(v_reclamo_id.length<=0)
	{
				v_msg_error+="\nDebe seleccionar un reclamo.";
	}
 
	
	if(v_msg_error==""){
		 window.location.href="arc_modificar_reclamo.asp?p_user_id="+p_user_id+"&p_user_type="+p_type+"&p_reclamo_id="+v_reclamo_id;
	}
	else alert(v_msg_error);	
}



function arc_actualizar_reclamo(p_user_id,p_type)
{
	 var v_msg_error="";
	 
	 v_reclamo_id = document.getElementById("v_selected_reclamo").value;
 
 
 
	if(v_reclamo_id.length<=0)
	{
				v_msg_error+="\nDebe seleccionar un reclamo.";
	}
	if(document.getElementById("rec_updated_"+v_reclamo_id).value=="TRUE")
	{
				v_msg_error+="\nSolo puede actualizar el reclamo una vez al día.";		
	}
 
	
	if(v_msg_error==""){
		document.getElementById("div_preload").style.visibility="visible";
		set_texto_ventana("Actualizando...");
		$.ajax({
		   type: "POST",
		   url: "arc_actualizar_reclamo.asp",
		   data: "p_reclamo_id="+v_reclamo_id,
		   success: function(msg){
			   setTimeout(function() {reclamo_borrado_ok()}, 1000);
			   set_texto_ventana("Reclamo Actualizado...");
			   function reclamo_borrado_ok()
			   {
				   document.getElementById("div_preload").style.visibility="hidden";
				   window.parent.location="arc_gestion_reclamos.asp?p_user_id="+p_user_id+"&p_user_type="+p_type+"&sec=3";
			   }			   
		   }
		 });
	}
	else alert(v_msg_error);	
}

function arc_borrar_reclamo(p_user_id,p_type)
{
	v_reclamo_id = document.getElementById("v_selected_reclamo").value;
	v_msg_error="";
	if(v_reclamo_id=="")
	{
			v_msg_error+="\nDebe seleccionar un reclamo.";
	}
	else{
 
			if(confirm('¿Seguro que desea borrar el reclamo seleccionado?')) 
			{
			 var v_msg_error="";
			
			}
			 else
			 v_msg_error="Ha cancelado la operación";
	}
	
	if(v_msg_error==""){
		document.getElementById("div_preload").style.visibility="visible";
		set_texto_ventana("Borrando reclamo...");
		$.ajax({
		   type: "POST",
		   url: "arc_borrar_reclamo.asp",
		   data: "p_reclamo_id="+v_reclamo_id,
		   success: function(msg){
			   setTimeout(function() {reclamo_borrado_ok()}, 1000);
			   set_texto_ventana("Reclamo borrado...");
			   function reclamo_borrado_ok()
			   {
				   document.getElementById("div_preload").style.visibility="hidden";
				   window.parent.location="arc_gestion_reclamos.asp?p_user_id="+p_user_id+"&p_user_type="+p_type+"&sec=3";
			   }			   
		   }
		 });
	}
	else 
	{
	alert(v_msg_error);
	}

 
	

	 
}

function arc_insert_reclamo_empresa(p_user_id,p_type)
{
	var v_msg_error="";
	var v_nick_name;
	var v_reclamo;
//	alert(document.getElementById("f_reclamo").options[document.getElementById("f_reclamo").selectedIndex].text);
	
	v_reclamo =tinyMCE.get('f_reclamo').getContent();
	var v_reclamo_id =document.getElementById("f_perfil_id").value;

	var v_text=tinyMCE.get('f_reclamo').getContent();//convert_acentos(document.getElementById("f_reclamo").value);

	v_nick_name =document.getElementById("f_perfil_text").value;
	
 

	if(v_reclamo=="")
	{
		v_msg_error+="\nEl campo RECLAMO es obligatorio";
	}
	if(v_reclamo.length>1500)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado largo.";
	}	
	if(v_reclamo.length<200)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado corto.";
	}		

	if(v_msg_error==""){
		 

		 
		$.ajax({
		   type: "POST",
		   url: "arc_insert_reclamo.asp",
		   data: "n_perfil="+parseInt(v_reclamo_id)+"&n_reclamo="+escape(v_text)+"&n_userid="+parseInt(p_user_id)+"&n_nickname="+escape(v_nick_name)+"&p_type="+p_type,
		   success: function(msg){
			  // setTimeout(function() {reclamo_send_ok()}, 2000);
					 window.parent.location="arc_gestion_reclamos_c.asp?p_user_id="+parseInt(p_user_id)+"&p_type_user="+p_type+"&sec=1";
			  // function reclamo_send_ok()
			  // {
 
				   
			   //}			   
		   }
		 });
	}
	else alert(v_msg_error);
}

function arc_insert_reclamo(p_user_id,p_type) {
	
	var v_msg_error="";
	var v_nick_name;
	var v_reclamo;
//	alert(document.getElementById("f_reclamo").options[document.getElementById("f_reclamo").selectedIndex].text);
	
	v_reclamo =tinyMCE.get('f_reclamo').getContent();
	var v_reclamo_id =document.getElementById("f_perfil_id").value;

	var v_text=tinyMCE.get('f_reclamo').getContent();//convert_acentos(document.getElementById("f_reclamo").value);
	
	v_nick_name =document.getElementById("f_perfil_id").options[document.getElementById("f_perfil_id").selectedIndex].text;
	
	 
	//alert(document.getElementById("f_reclamo").value.length-7);
	//var v_text=document.getElementById("f_reclamo").value
	//v_reclamo  =document.getElementById("f_reclamo").value
	
	if(p_type==2){
		
		 
		
		if(v_reclamo_id<=0)
		{
					v_msg_error+="\nDebe seleccionar un perfil.";
		}
		
	}
	else {
		v_reclamo_id=0;
		 
	}
 

	if(v_reclamo=="")
	{
		v_msg_error+="\nEl campo RECLAMO es obligatorio";
	}
	if(v_reclamo.length>1500)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado largo.";
	}	
	if(v_reclamo.length<200)
	{
		v_msg_error+="\nEl campo RECLAMO es demasiado corto.";
	}		

	if(v_msg_error==""){
		 

		 
		$.ajax({
		   type: "POST",
		   url: "arc_insert_reclamo.asp",
		   data: "n_perfil="+v_reclamo_id+"&n_reclamo="+escape(v_text)+"&n_userid="+parseInt(p_user_id)+"&n_nickname="+escape(v_nick_name)+"&p_type="+p_type,
		   success: function(msg){
			  // setTimeout(function() {reclamo_send_ok()}, 2000);
					 window.parent.location="arc_gestion_reclamos_c.asp?p_user_id="+parseInt(p_user_id)+"&p_type_user="+p_type+"&sec=1";
			  // function reclamo_send_ok()
			  // {
 
				   
			   //}			   
		   }
		 });
	}
	else alert(v_msg_error);
}


function update_account(p_user_id)
{
	var v_msg_error="";
	  if(document.getElementById("v_alortexto").value.length==0) alert("El campo de texto es obligatorio");//v_msg_error="";
	else {
		 
		 
		//- Enviamos un mail a ana
		//- Enviamos un mail al usuario
		//- borradomos variable de session y cookies
	 
		$.ajax({
		   type: "POST",
		   url: "arc_cancelar_cuenta.asp",
		   data: "p_user_id="+p_user_id,
		   success: function(msg){
					 window.parent.location="index.asp";

		   }
		 });
		 
	}
}

function update_pwd(p_user_id,ptipo) {
	
	v_msg_error="";
	v_pwd =document.getElementById("v_pwd").value;
	if(v_pwd=="")
	{
		v_msg_error+="\nEl campo NUEVA CONTRASEÑA es obligatorio";
	}
	if(v_pwd!=document.getElementById("v_pwd_check").value)
	{
		v_msg_error+="\nLos campos CONTRASEÑA no coinciden";
	}	
 
	
	if(v_msg_error==""){
		$.ajax({
		   type: "POST",
		   url: "arc_update_pwd.asp",
		   data: "p_user_id="+p_user_id+"&p_pwd="+v_pwd,
		   success: function(msg){
					 window.parent.location="arc_configuracion_c.asp?p_user_id="+p_user_id+"&p_type_user="+ptipo+"&sec=0";

		   }
		 });
	}
	else alert(v_msg_error);
}


function arc_search_rec(p_filtro)
{
 
		var msg;
		msg="";
		 
		//if (document.getElementById("s_opciones").value==0) msg+="\nDebe seleccionar una opción";
		if (document.getElementById("p_cadena").value.length<=p_filtro && document.getElementById("p_city").value==0) msg+="\nDebe completar un campo obligatoriamente.";
		
		if(msg==""){
		 
		 	var v_city_c=document.getElementById("p_city").options[document.getElementById("p_city").selectedIndex].text.substr(0,document.getElementById("p_city").options[document.getElementById("p_city").selectedIndex].text.indexOf("(", 0)-1);
 
			 
			 
	 window.parent.location="arc_buscar_c.asp?p_cadena="+document.getElementById("p_cadena").value+"&p_user_id="+document.getElementById("p_user_id").value+"&p_type_user="+document.getElementById("p_type_user").value+"&p_city="+document.getElementById("p_city").value+"&p_city_name="+v_city_c;
		}
		else{
			alert(msg);
		}
}

function update_mail(p_user_id,ptipo) {
	var v_msg_error="";

	v_mail =document.getElementById("v_mail").value;

	if(v_mail=="")
	{
		v_msg_error+="\nEl campo NUEVO E-MAIL es obligatorio";
	}
	if(v_mail!=document.getElementById("v_mail_check").value)
	{
		v_msg_error+="\nLos campos E-MAIL no coinciden";
	}	
	if(v_mail.indexOf("@")<0)
	{
		v_msg_error+="\nEl campo NUEVO E-MAIL no es una dirección de e-mail válida";		
	}
	
	if(v_msg_error==""){
						
			$.ajax({
		   	type: "POST",
		   	url: "get_mail_user_check.asp",
		   	data: "p_mail="+v_mail,
		   	success: function(msg){			 					 
				if(msg==1) alert("Está dirección ya existe");
				else{
															$.ajax({
										   type: "POST",
										   url: "arc_update_mail.asp",
										   data: "p_user_id="+p_user_id+"&p_mail="+v_mail,
										   success: function(msg){
								window.parent.location="arc_configuracion_c.asp?p_user_id="+p_user_id+"&p_type_user="+ptipo+"&sec=0";
										   }
										 });
				}
			}
			});
	}
	else alert(v_msg_error);
			 
		/*
		  if(msg==1) alert("Está dirección ya existe");
			  					 else{						
						
										$.ajax({
										   type: "POST",
										   url: "arc_update_mail.asp",
										   data: "p_user_id="+p_user_id+"&p_mail="+v_mail,
										   success: function(msg){
											   openclose_div('div_mail');
										   }
										 });
						}
		*/
	
	/*if(v_msg_error==""){
		$.ajax({
		   type: "POST",
		   url: "arc_update_mail.asp",
		   data: "p_user_id="+p_user_id+"&p_mail="+v_mail,
		   success: function(msg){
			   openclose_div('div_mail');
		   }
		 });
	}
	else alert(v_msg_error);*/
}

function close_all_rec(p_pos_rec)
{
	 document.getElementById("reclamo_ext"+p_pos_rec).innerHTML="";	
}
function arc_ver_reclamo(p_reclamo_id,p_numero) {
	  
	  document.getElementById("reclamo_ext1").innerHTML="";
	 document.getElementById("reclamo_ext2").innerHTML="";
	 document.getElementById("reclamo_ext3").innerHTML="";
	 document.getElementById("reclamo_ext"+p_numero).innerHTML="Cargando...";
  
	 if(p_reclamo_id>0)
	 {
		$.ajax({
		   type: "POST",
		   url: "get_texto_reclamo.asp",
		   data: "p_reclamo_id="+p_reclamo_id+"&p_pos="+p_numero,
		   success: function(msg){
			    
			   document.getElementById("reclamo_ext"+p_numero).innerHTML=msg;
		   }
		 });		 
	 }
}


function arc_script_alerts(p_user_id,p_type,p_pos)
{
	
	var v_cadena_ids="";
	for(i=1;i<=document.getElementById("v_puesto_out_2").length;i++)
	{
		 	v_cadena_ids+=document.getElementById("v_puesto_out_2").options[(i-1)].value+",";
		 
	}
	if(v_cadena_ids.length>0)
	{
 
		$.ajax({
		   type: "POST",
		   url: "arc_update_alertas_usr.asp",
		   data: "p_user_id="+p_user_id+"&p_ids="+v_cadena_ids+"&p_seccion=2",
		   success: function(msg){
			   if(p_pos==0)
			   window.parent.location="arc_configuracion_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=0"; 
			   else  window.parent.location="lobby.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=0"; 
		   }
		 });		
	}
}

function tr_alerta(p_tipo,p_textarea)
{
	// hidden_all_aclaraciones('div_6');
	if(p_tipo==1){
	
			if(document.getElementById("v_puesto_in_"+p_textarea).selectedIndex>0)
			{		 
				v_value_id=document.getElementById("v_puesto_in_"+p_textarea).value;
				v_texto=document.getElementById("v_puesto_in_"+p_textarea).options[document.getElementById("v_puesto_in_"+p_textarea).selectedIndex].text;
				 //lo pongo en out, debo quitarlo de in
				document.getElementById("v_puesto_out_"+p_textarea).options[(document.getElementById("v_puesto_out_"+p_textarea).length)]=new Option(v_texto,v_value_id,"defaultSelected");
				
				document.getElementById("v_puesto_in_"+p_textarea).remove(document.getElementById("v_puesto_in_"+p_textarea).selectedIndex);				
				 
				 
			}
			else alert("Debe seleccionar una opci&oacute;n");
	
	}
	else
	{
			if(document.getElementById("v_puesto_out_"+p_textarea).selectedIndex>=0)
			{		
				 
				v_value_id=document.getElementById("v_puesto_out_"+p_textarea).value;
				v_texto=document.getElementById("v_puesto_out_"+p_textarea).options[document.getElementById("v_puesto_out_"+p_textarea).selectedIndex].text;
			
				 document.getElementById("v_puesto_out_"+p_textarea).remove(document.getElementById("v_puesto_out_"+p_textarea).selectedIndex);
				 
				document.getElementById("v_puesto_in_"+p_textarea).options[(document.getElementById("v_puesto_in_"+p_textarea).length)]=new Option(v_texto,v_value_id,"");				 
				 
				 
				 
				 
			}
			else alert("Debe seleccionar una opci&oacute;n");
	}
	 
	
}

function  setpestana(p_id,p_user_id,p_user_type)
{
	 
	if(p_id==1){
	document.getElementById("t_new"+p_id).innerHTML="<a href='javascript:hidden_all_aclaraciones(&quot;div_34&quot;);setpestana(2,"+p_user_id+","+p_user_type+");showfolder(1,&quot;"+'mis_cosas'+"&quot;,&quot;"+'arc_new_users.asp?p_user_id='+p_user_id+'&p_type_user='+p_user_type+'&sec=0'+"&quot;);'>Nuevas incorporaciones a ARCjob</A>";
	document.getElementById("t_new2").innerHTML="<b>Mis Alertas</b>";	
	}
	//showfolder(1,'mis_cosas','arc_new_users.asp?p_user_id=<%=Request("p_user_id")%>&p_type_user=<%=Request("p_type_user")%>&sec=0');
	else{
	document.getElementById("t_new"+p_id).innerHTML="<a href='javascript:setpestana(1,"+p_user_id+","+p_user_type+");showfolder(1,&quot;"+'mis_cosas'+"&quot;,&quot;"+'arc_mis_alertas_c.asp?p_user_id='+p_user_id+'&p_type_user='+p_user_type+'&sec=0'+"&quot;);show_aclaracion_form(&quot;div_34&quot;,&quot;alertas_home&quot;);'>Mis alertas</A>";		
	//document.getElementById("t_new"+p_id).innerHTML="<a href='showfolder(1,'mis_cosas','arc_new_users.asp?p_user_id="+p_user_id+"&p_type_user="+p_user_type+"&sec=0');setpestana(1,"+p_user_id+","+p_user_type+");'>Mis alertas</A>";
	document.getElementById("t_new1").innerHTML="<b>Nuevas incorporaciones a ARCjob</b>";			
	}
}

function insert_new_tool_action(p_article_id,p_user_id,p_path)
{
	 
		$.ajax({
		   type: "POST",
		   url: "arc_new_tool_action.asp",
		   data: "p_art_id="+p_article_id+"&p_user_id="+p_user_id,
		   success: function(msg){
			    
			    var myWindow = window.open(p_path,"arcjobtools","resizable=yes"); 
		   }
		 });	
}


function load_tool(p_article_id,p_user_id,p_path)
{
	var v_total;
 	//get how many times download
		$.ajax({
		   type: "POST",
		   url: "get_tools_download_userid.asp",
		   data: "p_user_id="+p_user_id+"&p_art_id="+p_article_id,
		   success: function(msg){
			    v_total=msg;
				if (v_total>=2)
				{
					alert("Ha superado el máximo de descargas");
				}
				else{
					insert_new_tool_action(p_article_id,p_user_id,p_path);
					
				}
		   }
		 });	
 
}

function get_current_nombrepublico(p_user_id)
{
 
$.ajax({
   type: "POST",
   url: "get_user_npublico.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	   v_vector_ids = msg.split(',');
	   openclose_div('div_npublico');
	   document.getElementById("curent_nombre_publico").innerHTML=msg;
   }
 });	
}
function update_nombrepublico(p_user_id)
{
	var msg_error="";
	var v_nombre=document.getElementById("v_nombrepublico").value;
	if(v_nombre=="") msg_error+="El campo Nuevo N 1 es obligatorio";
	if (msg_error=="")
	{
		 
	$.ajax({
	   type: "POST",
	   url: "arc_update_npublico.asp",
	   data: "p_user_id="+p_user_id+"&p_nombre="+escape(v_nombre),
	   success: function(msg){
		   //v_vector_ids = msg.split(',');
		   openclose_div('div_npublico');
		   if(msg.length>25){
			   v_cad=msg.substring(0,25)+"..."
		   }
		   else{
			   v_cad=msg;
		   }
		   document.getElementById("st_0").innerHTML=v_cad;
	   }
	 });
	}
	else alert(msg_error);
}
function get_current_mail(p_user_id) {

$.ajax({
   type: "POST",
   url: "get_user_mail.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	   document.getElementById("current_mail").value=msg;
   }
 });
}

function get_total_ofertas_msg(p_user_id) {
	 
$.ajax({
   type: "POST",
   url: "get_total_ofertas.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	   v_vector_ids = msg.split(',');
	   document.getElementById("total_ofertas").innerHTML=v_vector_ids[0];
	    
	   document.getElementById("total_ofertas_inscritas").innerHTML="("+v_vector_ids[1]+") ";
	   if(v_vector_ids[1]==0){
	    document.getElementById("link_salida").innerHTML ='<!a href="javascript:arc_ofertas('+p_user_id+',1,1,1);"   class="arc_mail">Ofertas inscritas</a>';
	   }
	   
   }
 });
}

function arc_ofertas(p_user_id,p_order,p_tipo,p_pagina)
{
	document.fofertas.reset();
	//document.getElementById("t_variables").innerHTML= "";
	
 
$.ajax({
   type: "POST",
   url: "get_ofertas.asp",
   data: "p_user_id="+p_user_id+"&p_order_id="+p_order+"&p_tipo="+p_tipo+"&p_pagina="+p_pagina,
   success: function(msg){
	   
	  
	 
	  /* if(p_tipo==1)  arc_paginacion(p_user_id,2,p_order,p_pagina,3);	
	   else  arc_paginacion(p_user_id,2,p_order,p_pagina,2);*/	
	   
		
	
	   document.getElementById("ofertas").innerHTML =msg;
	   if (p_tipo==0)
	   {
		   document.getElementById("link_entrada").innerHTML ="<u>Todas las ofertas</u>";
		   document.getElementById("link_salida").innerHTML ='<a href="javascript:arc_ofertas('+p_user_id+',1,1,1);"   class="t_blue">Ofertas inscritas</a>';	
		   get_total_ofertas_msg(p_user_id);
		   document.getElementById("to_found").innerHTML ="Ofertas encontradas:";
		   
	   }
	   else{
		   document.getElementById("link_entrada").innerHTML ='<a href="javascript:arc_ofertas('+p_user_id+',1,0,1);"   class="t_blue">Todas las ofertas</a>';
		   document.getElementById("link_salida").innerHTML ="<u>Ofertas inscritas</u>"	;
		   document.getElementById("total_ofertas").innerHTML ="";
		   document.getElementById("to_found").innerHTML ="";
		   
	   }
   }
 });	
	
}

function openclose_div(p_namediv) 
{
	if (document.getElementById(p_namediv).style.visibility=="visible")
	{
		document.getElementById(p_namediv).style.visibility="hidden";
	}else{
		document.getElementById(p_namediv).style.visibility="visible";
	 
	}	
 
}

function set_preload(p_texto)
{
	if (document.getElementById("div_preload").style.visibility=="visible")
	{
		document.getElementById("div_preload").style.visibility="hidden";
	}else{
		document.getElementById("div_preload").style.visibility="visible";
		if (p_texto==null) v_texto="Cargando...";
		else v_texto=p_texto;
		document.getElementById("gif_preload").innerHTML = v_texto;
	}	
}

function set_texto_ventana(p_texto)
{
	document.getElementById("gif_preload").innerHTML = p_texto;
}

 

function arc_mail_responder(p_para,p_de,p_mail_id,p_tipo,p_nombre,p_usert)
{
	//p_tipo =0 responde / p_tipo=1 reeenviar
 var v_mensaje;
 var v_asunto;
 
 v_mensaje=tinyMCE.get('t_texto').getContent();//convert_acentos(document.f_enviar.t_texto.value);
 v_asunto=document.getElementById("t_asunto").value;
 
$.ajax({
   type: "POST",
   url: "get_send_mail.asp",
   data: "p_asunton="+escape(v_asunto)+"&p_mensaje="+escape(v_mensaje)+"&user_id="+p_de+"&touser_id="+p_para+"&p_mensaje_id="+p_mail_id+"&p_tipo="+p_tipo+"&p_user_id="+p_de+"&p_responder=1",
   success: function(msg){

		   window.parent.location="arc_buzon_c.asp?p_user_id="+p_de+"&p_type_user="+p_usert+"&sec=0&tipo=0";//tipo es la pestaña

	   
   }
 });	 
	
	
}

function set_nombre_publico(p_perfil_id,p_text)
{
	 
	document.getElementById("f_perfil_id").value=p_perfil_id
	 
	document.getElementById("l_current_nombre_publico").innerHTML=p_text;
	 
	document.getElementById("f_current_nombre_publico").value=p_text;
	//document.getElementById("h_nombrre").value=p_text;
	
	
	
	openclose_div('l_nombres');
}

function get_nombre_publicos(p_user_id)
{
$.ajax({
   type: "POST",
   url: "get_nombres.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	  openclose_div('l_nombres');
	    document.getElementById("l_nombrepublicos_list").innerHTML=msg;
	  
   }
 });
}

function arc_paginacion(p_user_id,p_tipo_user,p_orden,p_pagina,p_seccion)
{
 
if(p_seccion==2) p_seccion=20;

$.ajax({
   type: "POST",
   url: "get_datos_paginacion.asp",
   data: "p_user_id="+p_user_id+"&p_tipo_user="+p_tipo_user+"&p_orden="+p_orden+"&p_page="+p_pagina+"&p_seccion="+p_seccion,
   success: function(msg){
	    document.getElementById("arc_paginacion").innerHTML=msg;
	  
   }
 });
}

function check_recomend(p_user_id,p_tipo)
{
	
		$.ajax({
		   type: "POST",
		   url: "get_mail_recomendados.asp",
		   data: "p_user_id="+p_user_id,
		   success: function(msg){
			 
			 		
			 
			    v_total_mails=msg; 
				v_html="<div style='float:left;cursor:pointer' onclick=window.parent.location.href='arc_contactos_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_tipo+"&sec=0'><img src='images/exc_recomen.gif' border=0><div style='margin-left:-35px;position:absolute; width:100%' class=t_etiqueda>Tiene un nuevo contacto <br>&nbsp;por confirmar</div></div>";//<img src='images/sobre_mail.gif' border=0>
				 
			   
			  if(parseInt(msg)>0)	{
					//document.getElementById("arc_total_msg").innerHTML="("+v_total_mails+")";
					 document.getElementById("arc_total_recomended").innerHTML=v_html;   

 }
				 
				
		   }
		 });	
}

function check_mail(p_user_id,p_tipo)
{
	 
		$.ajax({
		   type: "POST",
		   url: "get_mail_user.asp",
		   data: "p_user_id="+p_user_id,
		   success: function(msg){
			    v_total_mails=msg; 
				v_html="<div style='float:left;cursor:pointer' onclick=window.parent.location.href='arc_buzon_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_tipo+"&sec=0'><img src='images/sobre_mail.gif' border=0><div style='margin-left:-35px;position:absolute; width:100%' class=t_etiqueda>Tiene un nuevo mensaje</div></div></div>";
			    
			 	if(parseInt(msg)>0)	{
					
					document.getElementById("arc_total_msg").innerHTML="("+v_total_mails+")";//"("+v_total_mails+")"+"<img src='images/ex_mail.gif' border=0>"; ;   
					 document.getElementById("arc_total_exc").innerHTML=v_html;//"<img src='images/ex_mail.gif' border=0>";    
					//document.getElementById("arc_total_exc").innerHTML="<img src='images/ex_mail.gif' border=0>"; 
				 }
				 
				//<img src='images/ex_mail.gif'>
		   }
		 });
}



function check_mail_buzon(p_user_id,p_folder)
{   
document.getElementById("arc_total_msg_folder").innerHTML="0";



		$.ajax({
		   type: "POST",
		   url: "get_mail_user_enviados.asp",
		   data: "p_user_id="+p_user_id,
		   success: function(msg){
			   v_total_mails_send=msg;
		   }
		});
		$.ajax({
		   type: "POST",
		   url: "get_mail_user.asp",
		   data: "p_user_id="+p_user_id,
		   success: function(msg){
			 
			 	v_total_mails=msg; 
				v_html="<div style='float:left'><img src='images/sobre_mail.gif' border=0></div>";
			    
				 if(parseInt(v_total_mails)>0){
					 
					document.getElementById("arc_total_msg").innerHTML="("+v_total_mails+")";//"("+v_total_mails+")"+"<img src='images/ex_mail.gif' border=0>"; ;   
					 document.getElementById("arc_total_exc").innerHTML=v_html;//"<img src='images/ex_mail.gif' border=0>";   					
					
				}
				else {
					document.getElementById("arc_total_msg").innerHTML=""; 
					document.getElementById("arc_total_exc").innerHTML="";   					
				}
				 
					document.getElementById("arc_total_msg_folder").innerHTML=v_total_mails;
					document.getElementById("arc_total_send_folder").innerHTML=v_total_mails_send;					
					
				 
		   }
		 });
}


function arc_save_mail(p_user_id,p_mail_id)
{
	 
	$.ajax({
   type: "POST",
   url: "set_msg_saved.asp",
   data: "p_user_id="+p_user_id+"&p_mail_id="+p_mail_id,
   success: function(msg){
	   alert("Mensaje guardado");
   }
 });
}

function get_total_mail_msg(p_user_id,ptipo) {
	
	
	
 document.getElementById("arcbuzon").innerHTML="<b>Buzón personal</b>";
 document.getElementById("arcbuzonenviados").innerHTML="<a href='javascript:showfolder(1,&quot;arc_mail&quot;,&quot;get_mail_c.asp?p_user_id="+p_user_id+"&p_user_type="+ptipo+"&p_order_id=3&p_tipo=1&p_page=1&quot;);get_total_mail_sendmsg("+p_user_id+");'>Mensajes Enviados</a>";
$.ajax({
   type: "POST",
   url: "get_total_mensajes.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	   document.getElementById("arc_mensajes_totales").innerHTML=msg;
   }
 });
} 

function get_total_mail_sendmsg(p_user_id,ptipo) {
 
 document.getElementById("arcbuzonenviados").innerHTML="<b>Mensajes Enviados</b>";
 document.getElementById("arcbuzon").innerHTML="<a href='javascript:showfolder(1,&quot;arc_mail&quot;,&quot;get_mail_c.asp?p_user_id="+p_user_id+"&p_user_type="+ptipo+"&p_order_id=3&p_tipo=0&p_page=1&quot;);get_total_mail_msg("+p_user_id+");'>Buzón personal</A>";
$.ajax({
   type: "POST",
   url: "get_total_mensajes_send.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	   document.getElementById("arc_mensajes_totales").innerHTML=msg;
   }
 });
} 

function send_msg_con_fav(p_para_id,p_origen_id,p_count)
{

	var msg_error="";
	var v_mensaje=convert_acentos(document.getElementById("msg_text"+p_count).value);

	var v_asunto=convert_acentos(document.getElementById("msg_asunto"+p_count).value);

	var p_user_id=p_origen_id;
	var v_para=p_para_id;
	 
	if (v_mensaje==""){ msg_error+="\nEl campo mensaje es obligatorio"; }
	if (v_asunto==""){ msg_error+="\nEl campo asunto es obligatorio"; }	
 
	if (msg_error=="")
	{
		 
	 
			 
		$.ajax({
		   type: "POST",
		   url: "get_enviar_mail.asp",
		   data: "p_user_id="+p_user_id+"&p_para_id="+v_para+"&p_mensaje="+v_mensaje+"&p_asunto="+v_asunto,
		   success: function(msg){
			   	 
			    
				   alert("Mensaje enviado!");
				   close_ofertas(p_count);
 
			   
		   }
		 });
	}
	else{
		alert(msg_error);
	}
}



function send_msg(p_msg_id)
{
	 
	var msg_error="";
	var v_mensaje=convert_acentos(document.getElementById("msg_text").value);
	var v_asunto=convert_acentos(document.getElementById("msg_asunto").value);
	var p_user_id=document.getElementById("msg_de").value;
	var v_para=document.getElementById("msg_para").value;
	 
	if (v_mensaje==""){ msg_error+="\nEl campo mensaje es obligatorio"; }
	if (v_asunto==""){ msg_error+="\nEl campo asunto es obligatorio"; }	
 
	if (msg_error=="")
	{
		 
	 		  
		$.ajax({
		   type: "POST",
		   url: "get_enviar_mail.asp",
		   data: "p_user_id="+p_user_id+"&p_para_id="+v_para+"&p_mensaje="+v_mensaje+"&p_asunto="+v_asunto,
		   success: function(msg){
			   		alert("Mensaje enviado correctamente!");
			   	   document.getElementById("contendio_puntoencuentro"+p_msg_id).innerHTML="";
	 			   close_ofertas(p_msg_id);
				  // window.parent.location="arc_buzon.asp?p_user_id="+p_user_id+"&p_user_type="+ptipo+"&sec=4&tipo=0";//tipo es la pestaña
	 		   
		   }
		 });
	}
	else{
		alert(msg_error);
	}
}

function close_ofertas(p_total)
{
	 
		 document.getElementById("contendio_oferta"+p_total).innerHTML="";
		 document.getElementById("contendio_puntoencuentro"+p_total).innerHTML="";
 
}


function set_tit_otros()
{
	v_cadena=document.registrocandidato.v_espec[document.registrocandidato.v_espec.selectedIndex].text;
	if(v_cadena.indexOf("Otros")>=0)
	{
		document.getElementById("d_otros_tit").innerHTML='<input  class="field_normal" name="v_otros_tit" type="text" id="v_otros_tit" size="45" />';
	}
	else{
		document.getElementById("d_otros_tit").innerHTML='<input  class="field_normal" name="v_otros_tit" type="hidden" id="v_otros_tit" size="45" value=""/>';		
	}
}

function set_titulacion_of()
{
	document.getElementById("t_oficiales").innerHTML="Cargando...";
	document.getElementById("d_otros_tit").innerHTML='<input  class="field_normal" name="v_otros_tit" type="hidden" id="v_otros_tit" size="45" value=""/>';		

	v_pid=document.registrocandidato.v_titulos[document.registrocandidato.v_titulos.selectedIndex].value;
	
	if(document.registrocandidato.v_titulos[document.registrocandidato.v_titulos.selectedIndex].text=="OTROS")
	{
		
		document.getElementById("otrostitulosoficial").innerHTML="<input type=text value='' id='otros_tit_oficiales' name='otros_tit_oficiales'>";
		document.getElementById("t_oficiales").innerHTML='<input value=""  name="v_espec" type="hidden" id="v_espec" size="1" />';
		document.getElementById("t_oficiales_texto").innerHTML="";
		
		
	}
	else{
				document.getElementById("otrostitulosoficial").innerHTML="<input type=hidden value='' id='otros_tit_oficiales' name='otros_tit_oficiales'>";

				
				
				
	//otros titulacion alert(document.registrocandidato.v_titulos[document.registrocandidato.v_titulos.selectedIndex].text);
		$.ajax({
	   type: "POST",
	   url: "get_tit_oficial.asp",
	   data: "p_id="+v_pid,
	   success: function(msg){
//				document.getElementById("t_oficiales").innerHTML="aaaaaaaaaaaaa";	
 
		   if( msg !=0){
		  	 document.getElementById("t_oficiales_texto").innerHTML="Especialidad: ";
		  	 document.getElementById("t_oficiales").innerHTML =msg;
		   }
		   else{
			   document.getElementById("t_oficiales_texto").innerHTML="<img src='images/hspacer.gif' width=1 height=1 />";
			   document.getElementById("t_oficiales").innerHTML='&nbsp;<input value=""  name="v_espec" type="hidden" id="v_espec" size="1" />';
		   }
	   }
	 });	
	}
}


function set_pwd_foruser()
{
 	var v_msg="";
	v_mail_adress=document.getElementById("m_user_mail").value;
	
	if(v_mail_adress=="") v_msg+="\nEl campo está vacio";
	if(v_mail_adress.indexOf("@")<0) v_msg+="\nEl campo debe ser una dirección de E-mail";
	
	if(v_msg==""){
	$.ajax({
	   type: "POST",
	   url: "send_sec_code.asp",
	   data: "p_mail="+v_mail_adress,
	   success: function(msg){
		   //document.getElementById("arc_mensajes_totales").innerHTML=msg;
		   if(msg==0) alert("El usuario no existe");
		   else window.parent.location="arc_lost_recovery_c.asp?p_mail="+v_mail_adress;
	   }
	 });
	}
	else{
		alert(v_msg);
	}
	
}

function check_pwd_final_foruser(p_mail)
{
	var v_msg="";
 
	if (document.getElementById("pwd").value=="") v_msg+="\nEl campo CONTRASEÑA es obligatorio";
	if (document.getElementById("pwd2").value=="") v_msg+="\nEl campo REPITE CONTRASEÑA es obligatorio";
	if (document.getElementById("pwd2").value!=document.getElementById("pwd").value) v_msg+="\nEl campo REPITE CONTRASEÑA y CONTRASEÑA deben ser iguales";
	if (document.getElementById("pwd").value.length<=5) v_msg+="\nEl campo CONTRASEÑA es demasiado corto";
	

	if(v_msg=="") {
			$.ajax({
		   type: "POST",
		   url: "arc_change_code.asp",
		   data: "p_mail="+p_mail+"&p_pas="+document.getElementById("pwd").value,
		   success: function(msg){
			  // alert(p_mail);
			  // alert(document.getElementById("pwd").value);
			    window.parent.location="arc_arclogin_p_www_c.asp";
		   }
		 });
	}
	else alert(v_msg);

}


function msg_noread(p_user_id,p_order,p_tipo,p_pagina)
{
	 
	var v_mensaje="";
	var v_vector=new Array();
	 
	v_vector=document.getElementById("ids").value.split(',');
 
	if(document.getElementById("ids").value=="")
	{
		v_mensaje+="Debe seleccionar un mensaje";
	}
	if(v_mensaje=='') {
		v_data=document.getElementById("ids").value;
		
		$.ajax({
		   type: "POST",
		   url: "set_msg_noread.asp",
		   data: "p_varchar="+v_data+"&p_user_id="+p_user_id,
		   success: function(msg){
					showfolder(1,'arc_mail','get_mail_c.asp?p_user_id='+p_user_id+'&p_user_type='+p_tipo+'&p_order_id='+p_order+'&p_tipo=0&p_page='+p_pagina);
			   				//arc_mail(p_user_id,p_order,0,p_pagina);
		   }
		 });
	}
	else alert(v_mensaje);
			
	
}


function msg_readmsg(p_user_id,p_order,p_tipo,p_pagina)
{
	 
	var v_mensaje="";
	var v_vector=new Array();
	 
	v_vector=document.getElementById("ids").value.split(',');
 
	if(document.getElementById("ids").value=="")
	{
		v_mensaje+="Debe seleccionar un mensaje";
	}
	
	if(v_mensaje=='') {
		v_data=document.getElementById("ids").value;
		
		$.ajax({
		   type: "POST",
		   url: "set_msg_read.asp",
		   data: "p_varchar="+v_data+"&p_user_id="+p_user_id,
		   success: function(msg){
			   
			       // get_total_mail_msg(p_user_id,p_tipo);
					showfolder(1,'arc_mail','get_mail_c.asp?p_user_id='+p_user_id+'&p_user_type='+p_tipo+'&p_order_id='+p_order+'&p_tipo=0&p_page='+p_pagina);
			   				//arc_mail(p_user_id,p_order,0,p_pagina);
		   }
		 });
	}
	else alert(v_mensaje);
			
	
}


function show_all_help()
{
	var v_db=0;
	for(i=1;i<=7;i++)
	{
		v_db=30;
		
		document.getElementById("t"+i).innerHTML="Cargando...";
		alert(v_db);
		$.ajax({
		   type: "POST",
		   url: "get_help_text.asp",
		   data: "p_id="+parseInt(v_db),
		   success: function(msg){
	 
			  document.getElementById("t"+i).innerHTML=msg;
			   
			   
		   }
		 });		
	}
}

function show_help_text(p_id,p_db)
{
	for(i=1;i<=7;i++)
	{
		document.getElementById("t"+i).innerHTML="";
	}
	document.getElementById("t"+p_id).innerHTML="Cargando...";
	$.ajax({
	   type: "POST",
	   url: "get_help_text.asp",
	   data: "p_id="+p_db,
	   success: function(msg){
 
		  document.getElementById("t"+p_id).innerHTML=msg;
		   
		   
	   }
	 });	
}

function check_code_foruser(p_mail)
{
	
	v_code=document.getElementById("m_code_mail").value;
	
	$.ajax({
	   type: "POST",
	   url: "checkuser_sec_code.asp",
	   data: "p_mail="+p_mail+"&p_code="+v_code,
	   success: function(msg){

		   if(msg==0)  alert("El código introducido es incorrecto. Por favor, introdúzcalo de nuevo o revise su e-mail de reestablecimiento.");
		   else {
			   document.getElementById("f_code_ok").innerHTML="Cargando...";
			   show_verify(p_mail);
		   }		   
		   
		   
	   }
	 });
	
}

function show_verify(p_mail)
{
	$.ajax({
	   type: "POST",
	   url: "arc_verify_code.asp",
	   data: "p_mail="+p_mail,
	   success: function(msg){
		   
		   document.getElementById("f_code_ok").innerHTML=msg;
	   }
	 });
}

function add_id_flashcom_user(p_flashcom_id)
{
	 //alert(p_flashcom_id);
}

function arc_mail(p_user_id,p_order,p_tipo,p_pagina)
{
	 
 	 document.getElementById("arc_paginacion").innerHTML="";
	 //document.getElementById("menu_ordenarpor").style.visibility="hidden";
	//set_preload();
 
 
$.ajax({
   type: "POST",
   url: "get_mail.asp",
   data: "p_user_id="+p_user_id+"&p_order_id="+p_order+"&p_tipo="+p_tipo+"&p_page="+p_pagina,
   success: function(msg){
	    
   v_asunto=2;
   v_usuario=6;
   v_fecha=4;
   /*
   if(parseInt(p_order)==3) {
	   v_fecha=4;
	   document.getElementById("a_asunto").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
	   document.getElementById("a_fecha").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
	   document.getElementById("a_de").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   	   
   }
   else if (p_order==4) {
	   v_fecha=3;
	   document.getElementById("a_fecha").innerHTML="<img src='images/arrow_orange_2.gif' border=0>";
	   document.getElementById("a_asunto").innerHTML="<img src='images/arrow_orange.gif' border=0>";
	   document.getElementById("a_de").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
   }
   
   if(parseInt(p_order)==2) {
	   v_asunto=5;
	   document.getElementById("a_asunto").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
	   document.getElementById("a_fecha").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
	   document.getElementById("a_de").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   	   
   }
   else if (p_order==5) {
	   
	   v_asunto=2;
	   document.getElementById("a_fecha").innerHTML="<img src='images/arrow_orange.gif' border=0>";
	   document.getElementById("a_asunto").innerHTML="<img src='images/arrow_orange_2.gif' border=0>";
	   document.getElementById("a_de").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
	   
   }
   
   if(parseInt(p_order)==6) {
	   v_usuario=1;
   	   document.getElementById("a_asunto").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
	   document.getElementById("a_fecha").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   
	   document.getElementById("a_de").innerHTML="<img src='images/arrow_orange.gif' border=0>";	   	   

   }
   else if (p_order==1)
   {
	   v_usuario=6;  
	   document.getElementById("a_fecha").innerHTML="<img src='images/arrow_orange.gif' border=0>";
	   document.getElementById("a_asunto").innerHTML="<img src='images/arrow_orange.gif' border=0>";
	   document.getElementById("a_de").innerHTML="<img src='images/arrow_orange_2.gif' border=0>";	   
	   
   }
   
   if(p_tipo==1)
   {
	   v_usuario=17;
   if(parseInt(p_order)==17) v_usuario=18;
   else v_usuario=17;   	   
   }
   
  
   document.getElementById("b_1").innerHTML="<a href='javascript:arc_mail("+p_user_id+","+v_fecha+","+p_tipo+",1); '  class='t_opciones_ordenar'>Fecha</a>";
 
 
 
   document.getElementById("b_2").innerHTML="<a href='javascript:arc_mail("+p_user_id+","+v_asunto+","+p_tipo+",1); '  class='t_opciones_ordenar'>Asunto</a>";
   
 
   
   document.getElementById("b_3").innerHTML="<a href='javascript:arc_mail("+p_user_id+","+v_usuario+","+p_tipo+",1); '  class='t_opciones_ordenar'>Usuario</a>";   
   */
	  
	  //  set_preload();
		v_orden_def=p_order;
		 
		arc_paginacion(p_user_id,2,v_orden_def,p_pagina,(p_tipo+1));//1=seccion mail  2=tipo user
		 
		if(p_tipo==0) 
		{
			 
					get_total_mail_msg(p_user_id);
					check_mail_buzon(p_user_id);
					//document.getElementById("t_men_enviados").innerHTML="Mensajes recibidos:";
					//document.getElementById("t_men_noread").innerHTML="Mensajes no leídos:";
					//document.getElementById("msgnoleido").innerHTML='<a href="javascript:msg_noread('+p_user_id+',3,'+p_tipo+','+p_pagina+');"><img src="images/b_noread_msg.gif" border="0" alt="Marcar como no leído"  height="26" /></a>';
					
		}
		else {
			get_total_mail_sendmsg(p_user_id);
			
			//document.getElementById("t_men_enviados").innerHTML="Mensajes enviados:";
			//document.getElementById("arc_total_msg").innerHTML="";
			//document.getElementById("t_men_noread").innerHTML="";
			//document.getElementById("msgnoleido").innerHTML='<img src="images/b_noread_msg.gif" border="0"  width=1 height="1" />';
			
		}
	   document.getElementById("mail").innerHTML =msg;
	   if (p_tipo==0)
	   {
		   //document.getElementById("link_entrada").innerHTML ="<span class='arc_mail'><u>Bandeja de entrada</u></span>";
		   //document.getElementById("link_salida").innerHTML ='<a href="javascript:arc_mail('+p_user_id+',3,1,1);"   class="arc_mail">Mensajes enviados</a>';		
		   //document.getElementById("borrar_mail").innerHTML ='<a href="javascript:arc_borrar_mails('+p_user_id+',3,'+p_tipo+',1);" onClick=""  ><img src="images/b_borrar.gif" alt="Eliminar"   border="0" /></a>';			   
		   
	   }
	   else{
		   //document.getElementById("borrar_mail").innerHTML ='<a href="javascript:arc_borrar_mails('+p_user_id+',3,'+p_tipo+',1);" onClick=""  ><img src="images/b_borrar.gif" alt="Eliminar"   border="0" /></a>';	
		   //document.getElementById("link_entrada").innerHTML ='<a href="javascript:arc_mail('+p_user_id+',3,0,1);"   class="arc_mail">Bandeja de entrada</a>';
		   //document.getElementById("link_salida").innerHTML ="<span class='arc_mail'><u>Mensajes enviados</u></span>"		   
	   }
   }
 });	
	
}



function set_foto_user(p_user_id)
{
	 
	document.getElementById("st_image").innerHTML ="Cargando...";
	
	$.ajax({
   type: "POST",
   url: "get_foto_user.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	  
	   document.getElementById("st_image").innerHTML =msg;
   }
 });

}
function set_nombrepublico_user(p_nombre)
{
	
	document.getElementById("st_1").innerHTML ="Cargando...";
	document.getElementById("st_1").innerHTML =p_nombre;
/*	$.ajax({
   type: "POST",
   url: "get_nombre_publico.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	   	   document.getElementById("st_0").innerHTML ="";
   }
 });*/

}

function arc_ver_mail(p_mail_id,p_user_id,p_tipo,p_f)
{
	 
	window.parent.location="arc_buzon_ver_mensaje_c.asp?p_type_user="+p_tipo+"&p_user_id="+p_user_id+"&p_mail_id="+p_mail_id+"&p_tipo="+p_f;
}

function check_user_status(p_id,p_tipo)
{
		var b_buton_pos = document.getElementById('marca_menu_pastillas');
  	    var v_pos_y=findPosY(b_buton_pos);
		var v_pos_x=findPosX(b_buton_pos);
 		
	    document.getElementById('menu_pastillas').style.top=v_pos_y+42+ 'px';
		document.getElementById('menu_pastillas').style.left=v_pos_x+2+ 'px';
		document.getElementById('menu_pastillas').style.visibility="visible";

	v_status_id = get_status_db(p_id);
	
	get_apuntes(p_id,1);//user id + paginaid
	update_status_db(p_id,v_status_id);
}

function findPosX(obj)
  {
    var curleft = 0;
    if(obj.offsetParent)
        while(1) 
        {
          curleft += obj.offsetLeft;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.x)
        curleft += obj.x;
    return curleft;
  }

function findPosY(obj)
  {
    var curtop = 0;
    if(obj.offsetParent)
        while(1)
        {
          curtop += obj.offsetTop;
          if(!obj.offsetParent)
            break;
          obj = obj.offsetParent;
        }
    else if(obj.y)
        curtop += obj.y;
    return curtop;
  }

function set_div(p_id_pos,p_div_id)
{
	
	var b_buton_pos = document.getElementById(p_id_pos);
    var v_pos_y=findPosY(b_buton_pos);
	var v_pos_x=findPosX(b_buton_pos);
 
	document.getElementById(p_div_id).style.top=v_pos_y+15+ 'px';
	document.getElementById(p_div_id).style.left=v_pos_x-30+ 'px';
}

function show_usuarios_registro()
{
	var b_buton_pos = document.getElementById('newuser');
    var v_pos_y=findPosY(b_buton_pos);
	var v_pos_x=findPosX(b_buton_pos);
	document.getElementById("menu_registro").style.top=v_pos_y+30+ 'px';
	document.getElementById("menu_registro").style.left=v_pos_x-80+ 'px';
 
	 //left = $('.newuser').offset().top;
	if (document.getElementById("menu_registro").style.visibility=="visible")
	{
		document.getElementById("menu_registro").style.visibility="hidden";
		//document.getElementById("arc_contectado_arrow").innerHTML = "<img src=images/arrowup.gif border=0>";
	}else{
		document.getElementById("menu_registro").style.visibility="visible";
		//document.getElementById("arc_contectado_arrow").innerHTML = "<img src=images/arrowdown.gif border=0>";
	}
	
 
 
}

function check_registro1()
{
	var v_msg_error ="";
	
	document.registrocandidato.submit();
}

function check_registro2()
{

	var v_msg="Para continuar, revise los siguientes campos:\nLos siguientes campos deben estar cumplimentados\n";
	var v_msg_error ="";
//alert(document.registrocandidato.v_provincia_sp.value);
 
	if(document.registrocandidato.v_pwd.value=="") v_msg_error+="\nEl campo Contraseña es obligatorio";
	if(document.registrocandidato.v_pwd.value.length<5) v_msg_error+="\nEl campo Contraseña es demasiado corto";
	if(document.registrocandidato.v_nombre.value=="") v_msg_error+="\nEl campo Nombre es obligatorio";
	if(document.registrocandidato.v_nombre2.value=="") v_msg_error+="\nEl campo 1er. Apellido es obligatorio";
	if(document.registrocandidato.v_nombre3.value=="") v_msg_error+="\nEl campo 2on.. Apellido es obligatorio";
	if(document.registrocandidato.v_nombrepublico.value=="") v_msg_error+="\nEl campo Nombre público es obligatorio";
	if(document.registrocandidato.v_ciudad.value=="") v_msg_error+="\nEl campo CIUDAD es obligatorio";
 	if(document.registrocandidato.v_provincia_sp.value==0) v_msg_error+="\nEl campo PROVINCIA es obligatorio";
 
	if(document.registrocandidato.v_prof[document.registrocandidato.v_prof.selectedIndex].value==0) v_msg_error=v_msg_error+"\nEl campo PROFESIÓN es obligatorio";
	 
	//if(document.registrocandidato.v_prof2[document.registrocandidato.v_prof2.selectedIndex].value==0) v_msg_error+="\nEl campo PUESTO DE TRABAJO es obligatorio";	
	if(document.registrocandidato.v_situacion[document.registrocandidato.v_situacion.selectedIndex].value==0) v_msg_error+="\nEl campo SITUACIÓN ACTUAL es obligatorio";	

	if(document.registrocandidato.v_ciudad=="") v_msg_error+="\nEl campo CIUDAD es obligatorio";
	
	if(document.registrocandidato.v_permiso[document.registrocandidato.v_permiso.selectedIndex].value==0) v_msg_error+="\nEl campo PERMISO DE CONDOCIR es obligatorio";	
	
	valor = parseInt(document.registrocandidato.v_postal.value) 

 	if (isNaN(valor)) { 
		v_msg_error+="\nEl campo CÓDIGO POSTAL debe ser un valor numérico";	
	}
	
	if(document.registrocandidato.v_telf.value!="") {
		
		if(document.registrocandidato.v_telf.value.length<9){
			v_msg_error+="\nEl campo TELÉFONO tiene que tener un mínimo de 9 dígitos";
		}
		if(isNaN(parseInt(document.registrocandidato.v_telf.value) ))
		{
			v_msg_error+="\nEl campo TELÉFONO tiene que tener un valor numérico";	
		}
	}
	
		
	if(document.registrocandidato.v_postal.value=="") v_msg_error+="\nEl campo CÓDIGO POSTAL es obligatorio";
	if(document.registrocandidato.v_nacionalidad.value=="") v_msg_error+="\nEl campo NACIONALIDAD es obligatorio";
	
	if(document.registrocandidato.v_dia[document.registrocandidato.v_dia.selectedIndex].value==0) v_msg_error+="\nEl campo Día es obligatorio";	
	if(document.registrocandidato.v_mes[document.registrocandidato.v_mes.selectedIndex].value==0) v_msg_error+="\nEl campo MES es obligatorio";	
	if(document.registrocandidato.v_year[document.registrocandidato.v_year.selectedIndex].value==0) v_msg_error+="\nEl campo AÑO es obligatorio";	
   	
	
	
	 if(v_msg_error=="") document.registrocandidato.submit();
	else {
		v_msg+=v_msg_error;
		alert(v_msg);
	} 
	
	 
}

function isDate(dateStr) {

var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
var matchArray = dateStr.match(datePat); // is the format ok?

if (matchArray == null) {

return false;
}
}

function check_registro3()
{
	var v_msg="Para continuar, revise los siguientes campos:\nLos siguientes campos deben estar cumplimentados\n";
	var v_msg_error =""; 
  
	if(document.registrocandidato.v_descripcion.value=="") v_msg_error+="\nEl campo DESCRIPCIÓN es obligatorio";
	
	if(document.registrocandidato.v_descripcion.value.length<150) v_msg_error+="\nEl campo DESCRIPCIÓN es demasiado corto";
	if(document.registrocandidato.v_descripcion.value.length>2000) v_msg_error+="\nEl campo DESCRIPCIÓN es demasiado largo";	
	if(document.registrocandidato.v_experiencia.value=="") v_msg_error+="\nEl campo EXPERIENCIA es obligatorio";
		valor = parseInt(document.registrocandidato.v_experiencia.value) 
 	if (isNaN(valor)) { 
		v_msg_error+="\nEl campo EXPERIENCIA debe ser una valor numérico";	
	}	

	if(document.registrocandidato.v_conocimientos[document.registrocandidato.v_conocimientos.selectedIndex].value==0) v_msg_error=v_msg_error+"\nEl campo CONOCIMIENTOS INFORMÁTICOS es obligatorio";
 
 	 //document.registrocandidato.v_espec.value
	 if(document.registrocandidato.v_espec.value!=""){
	// alert(document.registrocandidato.v_espec[document.registrocandidato.v_espec.selectedIndex].value);
			 if(document.registrocandidato.v_espec[document.registrocandidato.v_espec.selectedIndex].value==0) v_msg_error=v_msg_error+"\nEl campo ESPECIALIDAD es obligatorio";	
	 }
	
	if(document.registrocandidato.v_jordnada[document.registrocandidato.v_jordnada.selectedIndex].value==0) v_msg_error=v_msg_error+"\nEl campo JORNADA LABORAL es obligatorio";	
	
	if(document.registrocandidato.v_disponibilidad[document.registrocandidato.v_disponibilidad.selectedIndex].value==0) v_msg_error=v_msg_error+"\nEl campo DISPONIBILIDAD es obligatorio";	
	

	 
 
	  if(document.registrocandidato.v_idiomas.value.length==0) v_msg_error+="\nEl campo IDIOMAS es obligatorio";	
	
	if(document.registrocandidato.v_titulos[document.registrocandidato.v_titulos.selectedIndex].value==0) v_msg_error+="\nEl campo TITULACIÓN es obligatorio";
	

	 if(v_msg_error=="") document.registrocandidato.submit();
	else {
		v_msg+=v_msg_error;
		alert(v_msg);
	} 
 	
	
}
function check_registro4()
{
 
	var v_msg="Para continuar, revise los siguientes campos:\nLos siguientes campos deben estar cumplimentados\n";
	var v_msg_error =""; 

	if(document.registrocandidato.v_reclamo.value=="") v_msg_error+="\nEl campo RECLAMO es obligatorio";
	if(document.registrocandidato.v_reclamo.value.length>500) v_msg_error+="\nEl campo RECLAMO es demasiado largo";
	if(document.registrocandidato.v_reclamo.value.length<=150) v_msg_error+="\nEl campo RECLAMO es demasiado corto";
	
		 

	if(v_msg_error=="")  document.registrocandidato.submit();
	else {
		v_msg+=v_msg_error;
		alert(v_msg);
	}


	
	
}

function open_menu()
{
	document.getElementById("arc_contectado_arrow").innerHTML = "<img src=images/arrowdown.gif border=0>";
	if (document.getElementById("menu_conectado").style.visibility=="visible")
	{
		document.getElementById("menu_conectado").style.visibility="hidden";
		document.getElementById("arc_contectado_arrow").innerHTML = "<img src=images/arrowup.gif border=0>";
	}else{
		document.getElementById("menu_conectado").style.visibility="visible";
		document.getElementById("arc_contectado_arrow").innerHTML = "<img src=images/arrowdown.gif border=0>";
	}
}
function user_connected(p_valor)
{	

	document.getElementById("arc_contectado").innerHTML = p_valor;
 
	switch(p_valor)
	{
		case "OCUPADO":
		document.getElementById("arc_contectado_gif").innerHTML = "<img src=images/b_ocupado_box.gif   border=0>";
		break;
		case "CONTECTADO":
		document.getElementById("arc_contectado_gif").innerHTML = "<img src=images/b_contectado_box.gif   border=0>";
		break;
		case "DESCONTECTADO":
		document.getElementById("arc_contectado_gif").innerHTML = "<img src=images/b_desconectado_box.gif   border=0>";
		break;		
	}
	
	document.getElementById("arc_contectado_arrow").innerHTML = "<img src=images/arrowup.gif border=0>";
	
	//update_status_db(66,p_valor);
}

function update_status_db(p_user_id,p_status) {
$.ajax({
   type: "POST",
   url: "update_user_status.asp",
   data: "p_user_id="+p_user_id+"&p_status_id="+p_status,
   success: function(msg){
	   user_connected(get_status_user(p_status));
	   document.getElementById("menu_conectado").style.visibility="hidden";
   }
 });
} 

function get_status_user(p_status_id)
{
	var v_status;
	switch(p_status_id)
	{
		case 1:
			v_status="CONTECTADO";
		break;
		case 2:
			v_status="OCUPADO";		
		break;
		case 3:
			v_status="DESCONTECTADO";		
		break;	
	}
		
		return v_status;
}

function show_warning_ofertas_msg(){
	//document.getElementById("oferta_waring_error").innerHTML="wwwwwwww"
 
	document.getElementById("oferta_waring_error").style.visibility="visible";
		
}
function call_alert(p_valor,pdate_id)
{
	if(p_valor==0) alert("Debe seleccionar la oferta que desea modificar");
	else {
		v_fecha=document.getElementById("ofe_ref_last_date"+pdate_id).value;
		alert("El paquete que tiene contratado no le permite más de una modificación por oferta.\nEsta oferta ha sido modificada el "+v_fecha+"\nSi desea realizar cualquier cambio deberá insertar una nueva oferta o contratar otro pack.");
	}
}


function borrar_favorito(p_id,p_id_to)
{
	
		$.ajax({
		   type: "POST",
		   url: "delete_favorito.asp",
		   data: "p_de_id="+p_id+"&p_user_id="+p_id_to,
		   success: function(msg){
			 
			  
				  window.location.href="arc_contactos_c.asp?p_user_id="+p_id_to+"&p_user_type=1&sec=9";
								
		   }
		 });	
}


function borrar_contacto(p_id,p_id_to)
{
	if(confirm("Esta seguro que desea borrar el contacto?")){
		$.ajax({
		   type: "POST",
		   url: "delete_contact.asp",
		   data: "p_de_id="+p_id+"&p_user_id="+p_id_to,
		   success: function(msg){
			 
			  
				  window.location.href="arc_contactos_c.asp?p_user_id="+p_id_to+"&p_type_user=2&sec=11";
								
		   }
		 });	
	}
	 
}


function check_incidencias()
{
	var msg="";
	if(document.getElementById("v1").value=="") msg+="\nEl campo NOMBRE es obligatorio";
	if(document.getElementById("v2").value=="") msg+="\nEl campo DIRECCIÓN DE CORREO ELECTRÓNICO es obligatorio";
	if(document.getElementById("v2").value.indexOf("@")<0) msg+="\nEl campo DIRECCIÓN DE CORREO ELECTRÓNICO debe ser un E-mail";
	if(document.getElementById("v3").value=="") msg+="\nEl campo ASUNTO es obligatorio";
	if(document.getElementById("v4").value=="") msg+="\nEl campo INCIDENCIA es obligatorio";	
	
	if(msg=="")
	{
		document.incidencias.submit();
	}
	else{
		alert(msg);
	}
	
}

function enviar_mensaje_generic(p_user_id,p_pos,p_id,p_total)
{
 	for(i=1;i<parseInt(document.getElementById("t_tal2").value);i++)
	{
		document.getElementById("contendio_puntoencuentro"+i).innerHTML="";
	}	 
   
	document.getElementById("contendio_puntoencuentro"+p_pos).innerHTML="<table width='100%'><tr><td align=center><img src=images/bigrotation.gif></td></tr></table>";
	$.ajax({
			   type: "POST",
			   url: "get_msg_pe.asp",
			   data: "p_parauser_id="+p_user_id+"&p_user_id="+p_id+"&p_pos="+p_pos,
			   success: function(msg){		
		 			document.getElementById("contendio_puntoencuentro"+p_pos).innerHTML=msg;					
			   }
	});
	
}

function call_contact_recom(p_id,p_para_id,p_num)
{
	 
   document.getElementById("contacto"+p_num).innerHTML="Contacto por confirmar."
		$.ajax({
		   type: "POST",
		   url: "call_contact.asp",
		   data: "p_de_id="+p_id+"&p_user_id="+p_para_id+"&p_mode=P",
		   success: function(msg){
			  // alert("Su solicitud de amistad se ha enviado correctamente");
			   document.getElementById("contacto"+p_num).innerHTML=""
				  //document.getElementById("contacto"+p_num).innerHTML="Solicitud enviada..."
				  window.location.href="arc_contactos_c.asp?p_user_id="+p_id+"&p_type_user=2&sec=11";
								
		   }
		 });	
}


function call_contact(p_id,p_para_id,p_mode,p_num)
{
 
   document.getElementById("contacto"+p_num).innerHTML="Enviando solicitud..."
		$.ajax({
		   type: "POST",
		   url: "call_contact.asp",
		   data: "p_de_id="+p_id+"&p_user_id="+p_para_id+"&p_mode="+p_mode,
		   success: function(msg){
			   document.getElementById("contacto"+p_num).innerHTML="<img src='images/hspacer.gif' width=100 height=1>"
			   alert("Su solicitud de amistad se ha enviado correctamente");
			   
				  //document.getElementById("contacto"+p_num).innerHTML="Solicitud enviada..."
								
		   }
		 });		
}

function add_slifeva(p_usr_id)
{
	if(p_usr_id>0){	 
	 alert("enviamos");
	}
	else   window.parent.location="arc_arclogin_www.asp"
	
	
}

function set_contact(p_id,p_user_id,p_type,p_mode)
{

	 
		$.ajax({
		   type: "POST",
		   url: "set_contact.asp",
		   data: "p_de_id="+p_id+"&p_user_id="+p_user_id+"&p_mode="+p_mode,
		   success: function(msg){
			 
					 
				window.location.href="arc_contactos_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_type+"&sec=11";
								 
		   }
		 });	
	

}

function set_oferta_form(p_id)
{
	 
	v_oferta_id = document.getElementById("sel_oferta_se").value;
	 
	var v_user_v_id=0;
	if(document.getElementById("n_contacto").value>0) v_user_v_id=document.getElementById("n_contacto").value;
	if (v_oferta_id>0)
	{ 
	 
	    v_titulo=document.getElementById("sel_oferta_se").options[document.getElementById("sel_oferta_se").selectedIndex].text;
		v_texto = document.getElementById("n_texto").value+"<a href='arc_view_oferta.asp?p_id="+p_id+"&p_oferta_id="+v_oferta_id+"&p_user_id="+v_user_v_id+"' target=_blank>"+v_titulo+"</A>";
		   
		tinyMCE.get('n_texto').setContent(v_texto);
	}
}

function set_es_form()
{
	v_reclamo_id = document.getElementById("sel_elevator_se").value;
	
	if (v_reclamo_id>0)
	{ 
		v_texto = document.getElementById("n_texto").value;
		$.ajax({
		   type: "POST",
		   url: "get_reclamo.asp",
		   data: "p_reclamo_id="+v_reclamo_id,
		   success: function(msg){
			   v_texto+=msg;
			   tinyMCE.get('n_texto').setContent(v_texto);
 
		   }
		});	
	}
}
 
function arc_borrar_msg_buzon(p_user_id,p_orden,ptipo,p_page)
{
	var v_mail_ids="";
 
	for(i=1;i<=document.getElementById("v_total_msg").value;i++)
	{
		if(document.getElementById("mail_"+i).checked==true)
				v_mail_ids+=document.getElementById("mail_"+i).value +","
		
	}	
	if(v_mail_ids.length==0) alert("Debe seleccionar un mensaje");
	else{
		
	if(confirm("Esta seguro que desea borrar el mensaje?")){
		 
		$.ajax({
   type: "POST",
   url: "get_delete_mail.asp",
   data: "p_user_id="+p_user_id+"&p_varchar="+v_mail_ids+"&ptipo="+ptipo,
   success: function(msg){
	 	  window.location.href="arc_buzon_c.asp?p_user_id="+p_user_id+"&p_type_user=2&sec=0";
		  //arc_buzon_c.asp?p_user_id=66&p_type_user=2&sec=0
//		  arc_mail
	   
   }
	});
	}
				 	
	}
}

function arc_buscamos_buzon()
{
	 var msg="";
	 if(document.getElementById("p_cadena").value=="") msg+="\nEl campo palabra clave es obligatorio";
	 if(document.getElementById("p_cadena").value.length<=3) msg+="\nEl campo palabra clave es demasiado corto";
	 if(document.getElementById("b_opcion").value==0) msg+="\nEl campo criterio a buscar es obligatorio";	 
	 if(msg=="")  document.buscar_buzon.submit();
	 else alert(msg);
}

function arc_buzon_all_msg(p_user_id,p_total_msg)
{
	 
	for(i=1;i<=p_total_msg;i++)
	{
		if(document.getElementById("mail_"+i).checked==true)
		{
		document.getElementById("mail_"+i).checked=false;
		
		
		}
		else {
			document.getElementById("mail_"+i).checked=true;
			document.getElementById("ids").value+=document.getElementById("mail_"+i).value+",";
		}
	}
	
	
}

function show_op_buzon(p_op,p_user_id,p_tipo,p_pos)
{
	 if(p_op==1){
	document.getElementById("b_opciones").innerHTML="<a href='javascript:show_op_buzon(0,"+p_user_id+","+p_tipo+","+p_pos+");'><img src='images/arrow1.png' width='16' height='8' border=0 /></a>";
	document.getElementById("b_opcones_link").innerHTML="<a href='javascript:show_op_buzon(0,"+p_user_id+","+p_tipo+","+p_pos+");'>Opciones de correo</a>";	
	
	showfolder(1,'buzon_opciones','arc_opciones_buzon_d.asp?p_user_id='+p_user_id+'&p_tipo='+p_tipo+"&p_opcion="+p_pos);	
	 }
	 else{
	document.getElementById("b_opciones").innerHTML="<a href='javascript:show_op_buzon(1,"+p_user_id+","+p_tipo+","+p_pos+");'><img src='images/arrow.png' width='16' height='8' border=0 /></a>";
	document.getElementById("b_opcones_link").innerHTML="<a href='javascript:show_op_buzon(1,"+p_user_id+","+p_tipo+","+p_pos+");'>Opciones de correo</a>";		
	document.getElementById("buzon_opciones").innerHTML="";
	 }
		 
}


function arc_oferta_empresas(p_user_id,p_user_type,p_folder_id)
{
	
	set_preload();
	
$.ajax({
   type: "POST",
   url: "get_ofertas_empresa.asp",
   data: "p_user_id="+p_user_id+"&p_user_type="+p_user_type+"&p_folder="+p_folder_id,
   success: function(msg){
	    set_preload();
		
		/*
		
		<td align="left" valign="middle"  class='links_crambs' ><span id="atrascram"><a class="links_crambs" href="lobby.asp?p_user_id=<%=v_user_id%>&p_type_user=<%=v_user_type%>&sec=0">&gt; Atr&aacute;s </a><%=v_crams%></span></td>
    <td width="30" align="center" valign="top"  class='links_crambs' ><a href="javascript:history.go(-1)"><img src="images/back.jpg" width="22" height="23" border=0 alt="Atr&aacute;s" /></a></td>
		*/
	 
		 if(p_folder_id==0) {
			  document.getElementById("b_ofe_op1").innerHTML='<a href="arc_insertar_oferta.asp?p_user_id='+p_user_id+'" target="_blank"  ><img src="images/b_insertar.gif" width="119" height="26" border=0 alt=Insertar/></a>';
			  document.getElementById("atrascram").innerHTML='<a class="links_crambs" href="lobby.asp?p_user_id='+p_user_id+'&p_type_user='+p_user_type+'&sec=0">&gt; Atr&aacute;s </a>'
			  document.getElementById("ofe_mod").innerHTML='<a href="javascript:call_alert(0);"  ><img src="images/b_modificar.gif" width="119" height="26" border=0 alt="Modificar"/></a>';
			  document.getElementById("b_ofe_op3").innerHTML='<a href="javascript:arc_borrar_oferta('+p_user_id+');"   ><img src="images/b_eliminar.gif" width="121" height="26" border=0 alt="Eliminar"/></a>';			 
			 show_warning_ofertas_msg();//document.getElementById("oferta_waring").style.visibility="visible";
		 }
		  else  {
			  document.getElementById("oferta_waring_error").style.visibility="hidden";
			  document.getElementById("atrascram").innerHTML='<a href="javascript:arc_oferta_empresas('+p_user_id+','+p_user_type+',0);">&gt; Atr&aacute;s </a>';
			  //remove buttons
			  document.getElementById("b_ofe_op1").innerHTML="<IMG src=images/hspacer.gif width=1 height=1>";
			  document.getElementById("ofe_mod").innerHTML="<IMG src=images/hspacer.gif width=1 height=1>";
			  document.getElementById("b_ofe_op3").innerHTML="<IMG src=images/hspacer.gif width=1 height=1>";
		  }
	    document.getElementById("arc_ofertas").innerHTML=msg;
		
		var b_buton_pos = document.getElementById('marcaaltura');
  	    var v_pos_y=findPosY(b_buton_pos);
		var v_pos_x=findPosX(b_buton_pos);
 
	   document.getElementById('oferta_waring_error').style.top=v_pos_y+40+ 'px';

   }
 });	
	
}

function hidden_capsula(p_user_id)
{
	document.getElementById('menu_pastillas').style.visibility="hidden";
	$.ajax({
	   type: "POST",
	   url: "set_capsula_hidden.asp",
	   data: "p_user_id="+p_user_id,
	   success: function(msg){
			  
			 
	   }
	 });		
}

function arc_posicion_div(p_layer,p_origen_span)
 {
	 
	 var b_buton_pos_arrow = document.getElementById("ar_arrow");
	var b_buton_pos = document.getElementById(p_origen_span);
	var v_pos_y=findPosY(b_buton_pos);
	var v_pos_x=findPosX(b_buton_pos);
					 
						 document.getElementById(p_layer).style.top=(v_pos_y-findPosY(b_buton_pos_arrow))+"px";
						 document.getElementById(p_layer).style.left=(v_pos_x-130)+"px";
						 m_menu(p_layer);
						 
						//document.getElementById("p_foto").style.left=v_pos_x;
 }


function show_material(p_tipo,p)
{
	
	 document.getElementById("arcjob_material_"+p).innerHTML="Cargando..."

$.ajax({
   type: "POST",
   url: "arc_material_arcjob.asp",
   data: "p_id="+p_tipo+"&p="+p,
   success: function(msg){
	      document.getElementById("arcjob_material_"+p).innerHTML=msg;
		 
   }
 });		 
}

function m_menu(p_name)
{
	document.getElementById(p_name).style.visibility="visible";
}

function m_menu_2(p_name)
{
	document.getElementById(p_name).style.visibility="hidden";
}

function lanzar_puntoencuentro(p_tpe,p_user_id){ 
 
  var ppp_window= window.open("pencuentro.asp?p_user_type="+p_tpe+"&p_page=1&p_user_id="+p_user_id+"&p_order=3","arc_pp","width=960,height=700,scrollbars=YES,resizable=YES") 
} 

function show_more_foro(p_tema_id,p_op)
{
	
if(p_op==1){	
set_preload();
	
$.ajax({
   type: "POST",
   url: "get_tema_description.asp",
   data: "p_tema_id="+p_tema_id,
   success: function(msg){
	     set_preload();	 
		 document.getElementById("foro_description").innerHTML=msg;
		 document.getElementById("vermas").innerHTML='<a href="javascript:show_more_foro('+p_tema_id+',0);"><img src="images/ver_mas.gif" border=0 alt="Ver más" /><span class="t_blue">ver mas</span></a>';
		 
   }
 });	
}
else{
	 
		document.getElementById("foro_description").innerHTML=document.getElementById("aux_tema").value;
		 document.getElementById("vermas").innerHTML='<a href="javascript:show_more_foro('+p_tema_id+',1);"><img src="images/ver_mas.gif" border=0 alt="Ver más" /><span class="t_blue">ver mas</span></a>';
}
}

function set_icono_foro(p_op)
{
	document.getElementById("f_icono").value=p_op;
}



function utf8_decode ( str_data ) {  

    var tmp_arr = [], i = ac = c1 = c2 = c3 = 0;  
  
    str_data += '';  
  
    while ( i < str_data.length ) {  
        c1 = str_data.charCodeAt(i);  
        if (c1 < 128) {  
            tmp_arr[ac++] = String.fromCharCode(c1);  
            i++;  
        } else if ((c1 > 191) && (c1 < 224)) {  
            c2 = str_data.charCodeAt(i+1);  
            tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));  
            i += 2;  
        } else {  
            c2 = str_data.charCodeAt(i+1);  
            c3 = str_data.charCodeAt(i+2);  
            tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));  
            i += 3;  
        }  
    }  
  
    return tmp_arr.join('');  
}  

function foro_new_tema(p_user_id,p_type)
{
	msg_error="";
	v_titulo=convert_acentos(document.getElementById("f_titulo").value);
	v_description=convert_acentos(document.getElementById("f_des").value);
	v_icono= document.getElementById("f_icono").value;
 
 	if (v_icono==""){
		msg_error+="\nDebe seleccionar un tema";
	}
 	if (v_description==""){
		msg_error+="\nEl campo TEMA es obligatorio";
	}
 	if (v_titulo==""){
		msg_error+="\nEl campo ASUNTO es obligatorio";
	}	
 
    if(msg_error==""){
 
	set_preload();
 
	$.ajax({
	   type: "POST",
	   url: "insert_foro_tema.asp",
	   //utf8_decode(
	   data: "p_user_id="+p_user_id+"&p_titulo="+v_titulo+"&p_tema="+v_description+"&p_icono_id="+v_icono,
	   success: function(msg){
			 set_preload();	 
			 window.location.href="arc_foro.asp?p_user_id="+p_user_id+"&p_user_type="+p_type;
	   }
	 });
	}
	else alert(msg_error);
}


function utf8_encode2 ( string ) {  
    // Encodes an ISO-8859-1 string to UTF-8    
    //   
    // version: 812.316  
    // discuss at: http://phpjs.org/functions/utf8_encode  
    // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)  
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
    // +   improved by: sowberry  
    // +    tweaked by: Jack  
    // +   bugfixed by: Onno Marsman  
    // +   improved by: Yves Sucaet  
    // +   bugfixed by: Onno Marsman  
    // *     example 1: utf8_encode('Tom van Mikes');  
    // *     returns 1: 'Tom van Mikes'  
    string = (string+'').replace(/\r\n/g, "\n").replace(/\r/g, "\n");  
  
    var utftext = "";  
    var start, end;  
    var stringl = 0;  
  
    start = end = 0;  
    stringl = string.length;  
    for (var n = 0; n < stringl; n++) {  
        var c1 = string.charCodeAt(n);  
        var enc = null;  
  
        if (c1 < 128) {  
            end++;  
        } else if((c1 > 127) && (c1 < 2048)) {  
            enc = String.fromCharCode((c1 >> 6) | 192) + String.fromCharCode((c1 & 63) | 128);  
        } else {  
            enc = String.fromCharCode((c1 >> 12) | 224) + String.fromCharCode(((c1 >> 6) & 63) | 128) + String.fromCharCode((c1 & 63) | 128);  
        }  
        if (enc != null) {  
            if (end > start) {  
                utftext += string.substring(start, end);  
            }  
            utftext += enc;  
            start = end = n+1;  
        }  
    }  
  
    if (end > start) {  
        utftext += string.substring(start, string.length);  
    }  
  
    return utftext;  
}  

function insertnewcomment(p_user_id,p_tema_id)
{
	v_cadena=  convert_acentos(document.getElementById("arc_foro").value);
	set_preload();

	document.getElementById("foro_contendio").innerHTML="";
	// alert(document.f_foro.arc_foro.value.length);
	// alert(document.f_foro.arc_foro.value.length);
	//v_texto="w";  //document.f_question.t_foro.textn;  
   
	$.ajax({
	   type: "POST",
	   url: "insert_new_question.asp",
	   //utf8_decode(
	   data: "p_tema_id="+p_tema_id+"&p_user_id="+p_user_id+"&p_texto="+v_cadena,
	   success: function(msg){
			 set_preload();	 
			 show_comments(p_tema_id);
	   }
	 });
}

function arc_foro_new_coment(p_user_id,p_tema_id)
{
	set_preload();
	document.getElementById("foro_contendio").innerHTML="";
	$.ajax({
	   type: "POST",
	   url: "get_new_question.asp",
	   data: "p_tema_id="+p_tema_id+"&p_user_id="+p_user_id,
	   success: function(msg){
			 set_preload();	 
			 document.getElementById("foro_contendio").innerHTML=msg;
	   }
	 });		
}
function cerrar_comentario(p_tema_id)
{
	show_comments(p_tema_id);
}
function show_comments(p_tema_id)
{
	set_preload();
	document.getElementById("foro_contendio").innerHTML="";
	$.ajax({
	   type: "POST",
	   url: "get_comments.asp",
	   data: "p_tema_id="+p_tema_id,
	   success: function(msg){
			 set_preload();	
			 v_vector=msg.split("#$#");
			 v_html=v_vector[0];
			 v_total=v_vector[1];
			 document.getElementById("foro_contendio").innerHTML=v_html;
			 document.getElementById("f_total_respuestas").innerHTML=v_total;
			 
	   }
	 });	
}


function show_perfil(p_perfil_id,p_user_id,p_activo)
{ 

	document.getElementById("mostrar_perfil").innerHTML="Cargando perfil...";
	 
			$.ajax({
			   type: "POST",
			   url: "load_perfil.asp",
			   data: "p_perfil_id="+p_perfil_id+"&p_user_id="+p_user_id,
			   success: function(msg){
				  
						 document.getElementById("mostrar_perfil").innerHTML=msg;
						 
						 //<a href='javascript:show_perfil("&v_activo_id&","&Request("p_user_id")&",1);' class='arc_b_perfiles'>"&v_nom&"</a>
						 
						 switch(parseInt(p_activo))
						 {
							 case 1:
							 //	document.getElementById("t_perfil_1").innerHTML="";
							//   $(selector).attr('onclick', 'return true'); // enable link
  // $('#arc_b_perfiles').css("font-size: ", "23");
							// $(".arc_b_perfiles_1").css("text-decoration", "underline");
							    $('#css_1').attr('onclick', 'return false'); // disable link
    							$('#css_1').css('text-decoration', 'underline'); 
							    $('#css_2').attr('onclick', 'return true'); // disable link
    							$('#css_2').css('text-decoration', 'none');
							    $('#css_3').attr('onclick', 'return true'); // disable link
    							$('#css_3').css('text-decoration', 'none');	
							 	break;
							 case 2:
							    $('#css_2').attr('onclick', 'return false'); // disable link
    							$('#css_2').css('text-decoration', 'underline'); 
							    $('#css_1').attr('onclick', 'return true'); // disable link
    							$('#css_1').css('text-decoration', 'none');
							    $('#css_3').attr('onclick', 'return true'); // disable link
    							$('#css_3').css('text-decoration', 'none');								
							 	break;
							 case 3:
							    $('#css_3').attr('onclick', 'return false'); // disable link
    							$('#css_3').css('text-decoration', 'underline'); 
							    $('#css_1').attr('onclick', 'return true'); // disable link
    							$('#css_1').css('text-decoration', 'none');
							    $('#css_2').attr('onclick', 'return true'); // disable link
    							$('#css_2').css('text-decoration', 'none');								
							 	break;								
						 }
					
						 document.getElementById("perfil_editar").innerHTML="<a href='arc_editar_perfil.asp?p_perfil_id="+p_perfil_id+"&p_user_id="+p_user_id+"&ptotal="+p_activo+"' target='_blank'><img src='images/p_editar.gif' alt='Editar Perfil' width='94' height='26' border='0' /></a>";
						 if(p_activo==1) document.getElementById("perfil_borrar").innerHTML="";
						 else{
							 document.getElementById("perfil_borrar").innerHTML="<a href='javascript:del_perfil("+p_perfil_id+","+p_user_id+");' ><img src='images/p_borrar.gif' alt='Borrar Perfil' width='93' height='26' border='0' /></a>";
						 }
						// document.getElementById("perfil_view").innerHTML="<a href='javascript:show_perfil("+p_perfil_id+","+p_user_id+","+p_activo+");'><img src='images/per_pre.gif' width='93' height='26' border=0 /></a>";
						  
						 //ok    document.getElementById("perfil_view").innerHTML="";
						
						 //document.getElementById("t_perfil_"+p_activo).innerHTML="";
						 var b_buton_pos = document.getElementById('giffoto');
  	    				var v_pos_y=findPosY(b_buton_pos) -100;
						var v_pos_x=findPosX(b_buton_pos) -550;
						// alert(v_pos_y);
					//	alert(document.getElementById("p_foto").style.left);
						document.getElementById("p_foto").style.top=v_pos_y;
						document.getElementById("p_foto").style.left=v_pos_x;					
						document.getElementById("p_foto").style.visibility="visible";
						 
						 
						
			   }
			 });		
}

function load_perfiles(p_user_id)
{
	
	
	document.getElementById("perfiles_opciones").innerHTML="Cargando..."
$.ajax({
   type: "POST",
   url: "load_perfiles.asp",
   data: "p_user_id="+p_user_id,
   success: function(msg){
	  
		 	document.getElementById("perfiles_opciones").innerHTML=msg;
				 	var b_buton_pos = document.getElementById('gifinsertar_ayuda');
  	    			var v_pos_y=findPosY(b_buton_pos);
					var v_pos_x=findPosX(b_buton_pos);
					document.getElementById("opcionesperfiles").style.top=v_pos_y+120;
					document.getElementById("opcionesperfiles").style.left=v_pos_x-15;					
					document.getElementById("opcionesperfiles").style.visibility="visible";
					
			 

			
   }
 });	
	
}

function view_next_perfil(p_user_id,p_color_id,p_activo)
{
	
	document.getElementById("perfiles_opciones").innerHTML="Cargando...";
$.ajax({
   type: "POST",
   url: "get_perfiles.asp",
   data: "p_user_id="+p_user_id+"&p_color_id="+p_color_id+"&p_perfil_id="+p_activo,
   success: function(msg){
	  document.getElementById("perfiles_opciones").innerHTML=msg;
	  
   }
 });	
	

	
	/*document.getElementById("v_perfil").value=p_color_id;
	document.getElementById("perfil_editar").innerHTML='<a href="arc_editar_perfil.asp?p_perfil_id='+p_activo+'&p_user_id='+p_user_id+'" target="_blank"><img src="images/p_editar.gif" alt="Editar Perfil" width="94" height="26" border="0" /></a>';
	document.getElementById("perfil_borrar").innerHTML='<img src="images/p_borrar.gif" width="93" height="26" />';
	document.getElementById("perfil_insertar").innerHTML='<a href="arc_insertar_perfil.asp?p_user_id"'+p_user_id+' target="_blank"><img src="images/pe_insertar.gif" alt="Insertar Perfil Alernativo" width="142" height="26" border="0" /></a>';	
	document.getElementById("perfil_view").innerHTML='<img src="images/per_pre.gif" width="93" height="26" />';		
	*/
}

function open_chat_room(p_user_id,p_destino_id)
{
  
		 submit_URL('pchat/arc_jobline.asp?p_to_id='+p_user_id+'&p_room='+p_user_id+'&p_origen_id='+p_destino_id,970,830);
		//window.open("titlebar.html", "_blank", "titlebar=0");
		
		
}
 
function arc_chat_invite(p_oriden_id,p_destino_id)
{
	
	//miramos antes de lanzar el chat como esta
/*	$.ajax({
   type: "POST",
   url: "get_chat_user_status.asp",
   data: "p_user_id="+p_destino_id,
   success: function(msg){
	  
	 
	   if(msg==1) {
			 //funciona llamada desde punto de encuentro
			//submit_URL('pchat_arc.asp?p_origen_id='+p_oriden_id+'&p_destino_id='+p_destino_id,770,450);
			submit_URL('pchat/arc_jobline.asp?p_to_id='+p_destino_id+'&p_room='+p_oriden_id+'&p_origen_id='+p_oriden_id,970,770);
			//abrimos ventana en el navegador destinatario  612,66
		 
			window.opener.document.getElementById("arcmedia").calluser_chat(p_oriden_id,p_destino_id);
			
			//ponemos los dos usuarios como ocupados
			update_status_chat_db(p_oriden_id,2);	
			update_status_chat_db(p_destino_id,2);			   
	   }
	   else{
		  // alert("El usuario está ocupado");
	   }
   }
 });*/
	
			submit_URL('pchat/arc_jobline.asp?p_to_id='+p_destino_id+'&p_room='+p_oriden_id+'&p_origen_id='+p_oriden_id,970,830);
			//abrimos ventana en el navegador destinatario  612,66
		  
			window.opener.document.getElementById("arcmedia").calluser_chat(p_oriden_id,p_destino_id);
			update_status_chat_db(p_oriden_id,2);	
			update_status_chat_db(p_destino_id,2);	
			
 
}


function update_status_chat_db(p_user_id,p_status) {
$.ajax({
   type: "POST",
   url: "update_user_status.asp",
   data: "p_user_id="+p_user_id+"&p_status_id="+p_status,
   success: function(msg){
	  
	   //user_connected(get_status_user(p_status));
	   //document.getElementById("menu_conectado").style.visibility="hidden";
   }
 });
} 

function set_quees()
{
	document.getElementById("reclamo_ejemplo").innerHTML="Cargando...";	
	$.ajax({
	   type: "POST",
	   url: "get_reclamo_quees.asp",
	   data: "p_tipo_user=0",
	   success: function(msg){
			document.getElementById("reclamo_ejemplo").innerHTML=msg;
	   }
	 });		
}

function close_reclamo_ej()
{
	document.getElementById("reclamo_ejemplo").innerHTML="";
}


function cargar_normas()
{
 
	 document.getElementById("textarea_normas").innerHTML="Cargando...";
	 document.getElementById("textarea_politica").innerHTML="Cargando...";
	//f_normas //f_politica   textarea_politica
 
	$.ajax({
	   type: "POST",
	   url: "get_normas.asp",
	   data: "p_tipo_user=0",
	   success: function(msg){
		   
		   document.getElementById("textarea_normas").innerHTML=msg;
	   }
	 });
	$.ajax({
	   type: "POST",
	   url: "get_politica.asp",
	   data: "p_tipo_user=0",
	   success: function(msg){
		   document.getElementById("textarea_politica").innerHTML=msg;
	   }
	 });	
}


function set_recom_ejemplo(p_type_user)
{

	document.getElementById("reclamo_ejemplo").innerHTML="Cargando...";
	$.ajax({
	   type: "POST",
	   url: "get_recomendaciones_ejemplo.asp",
	   data: "p_tipo_user="+p_type_user,
	   success: function(msg){
			document.getElementById("reclamo_ejemplo").innerHTML=msg;
	   }
	 });		
}


function set_ejemplo(p_type_user)
{
	document.getElementById("reclamo_ejemplo").innerHTML="Cargando...";
	$.ajax({
	   type: "POST",
	   url: "get_reclamo_ejemplo.asp",
	   data: "p_tipo_user="+p_type_user,
	   success: function(msg){
			document.getElementById("reclamo_ejemplo").innerHTML=msg;
	   }
	 });		
}
function get_mail_user_check(p_mail)
{
	$.ajax({
	   type: "POST",
	   url: "get_mail_user_check.asp",
	   data: "p_mail="+p_mail,
	   success: function(msg){
			 return msg;
	   }
	 });	
}


function buzon_change_bar_arc(p_id,p_user_id,p_tipo)
{
	var v_crams;
 	$('#bar1').css("background", "#FFFFFF");  
	$('#bar2').css("background", "#FFFFFF");  
	$('#bar3').css("background", "#FFFFFF");  	
	$('#bar'+p_id).css("background", "#CCEBFF");  
	 
      show_op_buzon(0,p_user_id,p_tipo,p_id);
	  
	  switch(p_id)
	  {
		  case 1:
		  	v_crams="<strong>Buz&oacute;n personal</strong>";
			break;
		  case 2:
		  	v_crams="<strong>Buz&oacute;n personal</strong>";
			break;
		  case 3:
		  	v_crams="<strong>Buz&oacute;n personal</strong>";
			break;			
	  }
	  
	  document.getElementById("arcbuzon").innerHTML=v_crams;
	//$('#op_noleidos').css("background", "#CCEBFF");  
	 
}
function tr_change_background(p_tr_id,p_id)
{
	if(p_tr_id<4){
		if(p_id==0) $('#'+"p"+p_tr_id).attr('background', 'images/back_b_on.gif');
		else $('#'+"p"+p_tr_id).attr('background', 'images/back_b.gif');
	}
	if(p_tr_id==4){
		if(p_id==0) $('#'+"p"+p_tr_id).attr('background', 'images/back_b2_on.gif');
		else $('#'+"p"+p_tr_id).attr('background', 'images/back_b2.gif');
	}	
	
	if(p_tr_id==7){
		if(p_id==0) $('#'+"p"+p_tr_id).attr('background', 'images/b_back_4_on.jpg');
		else $('#'+"p"+p_tr_id).attr('background', 'images/b_back_4.jpg');
	}
	if(p_tr_id==8){
		if(p_id==0) $('#'+"p"+p_tr_id).attr('background', 'images/b_back_5_on.jpg');
		else $('#'+"p"+p_tr_id).attr('background', 'images/b_back_5.jpg');
	}	
	if(p_tr_id==9){
		if(p_id==0) $('#'+"p"+p_tr_id).attr('background', 'images/b_back_7_on.jpg');
		else $('#'+"p"+p_tr_id).attr('background', 'images/b_back_7.jpg');
	}		
	if(p_tr_id==19){
		if(p_id==0) $('#'+"p"+p_tr_id).attr('background', 'images/back_b3_on.jpg');
		else $('#'+"p"+p_tr_id).attr('background', 'images/back_b3.jpg');
	}	
	if(p_tr_id==18){
		if(p_id==0) $('#'+"p"+p_tr_id).attr('background', 'images/b_back_3_on.jpg');
		else $('#'+"p"+p_tr_id).attr('background', 'images/b_back_3.jpg');
	}		
 	
	//$('p').addClass('texto_login_home');
}

function tr_change_class_menu(p_tr_id,p_id)
{

	if(p_id==0) $('#'+"op"+p_tr_id).attr('bgcolor', '#BABAFF');
	else $('#'+"op"+p_tr_id).attr('bgcolor', '#6B6BFF');
	
}

function td_tema(p_td_id,p_id)
{
	 
 	if(p_td_id==0) $('#'+"tema"+p_id).attr('bgcolor', '#FFFFFF');
 	else $('#'+"tema"+p_id).attr('bgcolor', '#C4D5FC');	
	
	//$('#'+"tema1").attr('bgcolor', '#C4D5FC');
	
}

function set_td_quizir(p_id,p_td)
{
	 	if(p_td==0) $('#'+"tema"+p_id).attr('bgcolor', '#FFFFFF');	
 	else $('#'+"tema"+p_id).attr('bgcolor', '#EDF7FF');	
	
		 
}

function set_home_bgr(p_td)
{
	
	 if(p_td==0) $('#home_text_main').css("background-color","#EFEFEF");
	 else  $('#home_text_main').css("background-color","#FCFCFC");
 
		 
}

function change_rec_box_arc_newusers(p_td,p_idbox)
{
		 if(p_td==0) $('#reclamos_box'+p_idbox).css("background-color","#E5EEFF");
	 else  $('#reclamos_box'+p_idbox).css("background-color","#FFF");
}

function change_rec_box(p_td)
{
	 if(p_td==0) $('#reclamos_box').css("background-color","#EBFFAA");
	 else  $('#reclamos_box').css("background-color","#FFFFFF");
 	
}

function change_rec_box_arc(p_td,p_idbox)
{
	 if(p_td==0) $('#reclamos_box'+p_idbox).css("background-color","#EBFFAA");
	 else  $('#reclamos_box'+p_idbox).css("background-color","#E5EEFF");
 	
}

function change_rec_box_lobby(p_td,p_idbox,p_name)
{
	 
	 if(p_td==0) $('#'+p_name).css("background-color","#FFFFFF");
	 else  $('#'+p_name).css("background-color","#F2F2F2");
 	
}

function change_rec_box_lobby_c(p_name)
{
	 $('#'+p_name).css("background-color","#FFFFFF");
}

function set_td_tema(p_id)
{
	 
 
 	 $('#'+"tema"+p_id).attr('bgcolor', '#C4D5FC');	
	
	//$('#'+"tema1").attr('bgcolor', '#C4D5FC');
	
}

function tr_change_class_bottom(p_tr_id,p_id)
{
 
	if(p_tr_id==0) $('#'+"arc_bottom"+p_id).attr('bgcolor', '#A3C2FF');
	else $('#'+"arc_bottom"+p_id).attr('bgcolor', '#FFBB00');	
}

function arc_send_seclife()
{
	document.getElementById("video_seclife").innerHTML="Cargando...";	
	$.ajax({
	   type: "POST",
	   url: "get_seclife_upload_form.asp",
	   data: "p_tipo_user="+p_type_user,
	   success: function(msg){
			document.getElementById("video_seclife").innerHTML=msg;
	   }
	 });	
}

function add_favoritos()
{
if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
var url="http://www.arcjob.net"; 
var titulo="ARCJOB";
window.external.AddFavorite(url,titulo);
}
 
else {
if(navigator.appName == "Netscape")
alert ("Presiones Crtl+D para añadir ARCJOB como Bookmark");  
}
 
}



function arc_mail_reenviar(p_para,p_de,p_mail_id,p_tipo,p_nombre,p_usert)
{
 var v_para=0;
 //alert(p_para+"/"+p_de);
 
 //alert(p_para);
// v_para = document.f_enviar.arc_para[document.f_enviar.arc_para.selectedIndex].value;	

 if(document.getElementById("arc_para").value==0)
 {
	 alert("Debe seleccionar un destinatario");
 }
 else{
	 
	 	 v_para=document.getElementById("arc_para").value;
	 
		 v_mensaje=tinyMCE.get('t_texto').getContent();//convert_acentos(document.f_enviar.t_texto.value);
		 
		 v_asunto= convert_acentos(document.getElementById("t_asunto").value);
		  
		$.ajax({
		   type: "POST",
		   url: "get_send_mail.asp",
		   data: "p_asunton="+v_asunto+"&p_mensaje="+escape(v_mensaje)+"&user_id="+p_para+"&touser_id="+v_para+"&p_mensaje_id="+p_mail_id+"&p_tipo="+p_tipo+"&p_user_id="+p_de,
		   success: function(msg){
			   
				  window.parent.location="arc_buzon_c.asp?p_user_id="+p_de+"&p_type_user="+p_usert+"&sec=4&tipo=0";//tipo es la pestaña
			  
			   
		   }
		 });	
 }
	
	
}


function arc_mail_reenviar_entrada(p_para,p_de,p_mail_id,p_tipo,p_nombre,p_usert)
{
 var v_para=0;
 //alert(p_para+"/"+p_de);
 
 //alert(p_para);
// v_para = document.f_enviar.arc_para[document.f_enviar.arc_para.selectedIndex].value;	
 if(document.getElementById("arc_para").value==0)
 {
	 alert("Debe seleccionar un destinatario");
 }
 else{
	 	 v_para=document.getElementById("arc_para").value;
		  
		 v_mensaje=tinyMCE.get('t_texto').getContent();//convert_acentos(document.f_enviar.t_texto.value);
 
		 v_asunto= convert_acentos(document.getElementById("t_asunto").value) ;
		   
		$.ajax({
		   type: "POST",
		   url: "get_send_mail.asp",
		   data: "p_asunton="+v_asunto+"&p_mensaje="+escape(v_mensaje)+"&user_id="+p_para+"&touser_id="+v_para+"&p_mensaje_id="+p_mail_id+"&p_tipo="+p_tipo+"&p_user_id="+p_de+"&p_responder=3",
		   success: function(msg){
			    
				  window.parent.location="arc_buzon_c.asp?p_user_id="+p_de+"&p_type_user="+p_usert+"&sec=0&tipo=0";//tipo es la pestaña
			   
			   
		   }
		 });	
 }
	
	
}




function arc_otros(p_select,p_desplegable)
{
	if(document.oferta.n_lugardetrabajo[document.oferta.n_lugardetrabajo.selectedIndex].value=="Otros")	
	document.getElementById(p_select).innerHTML="&nbsp;<input type=text size=10 id='lugar_otros_arc' name='lugar_otros_arc'>"
	else 	document.getElementById(p_select).innerHTML="&nbsp;<input type=hidden size=10 id='lugar_otros_arc' name='lugar_otros_arc' value=''>"
	
}


function show_aclaracion_form(p_div_form,p_literal)
{
  
	switch(p_literal)
	{
		
		case 'alertas_home':
			v_cadena="Mediante el servicio alertas podrás encontrar lo que buscas de una forma más precisa e invirtiendo el menor tiempo posible. Especifica sobre que área profesional quieres recibir reclamos de profesionales y empresas y podrás estar informado en tiempo real de posibles ofertas o reclamos de profesionales!</div>";
			break;
		
		case 'telefono':
			v_cadena="Recomendaciones de privacidad: Este campo se mostrará a todos los usuarios que tengan acceso al Punto de Encuentro. Por eso se recomienda facilitarlo únicamente a las empresas o profesionales que les interese.";
			break;
		 
		case 'nombrepublico':
			v_cadena="Dedica unos minutos para elegir tu <b>nombre público</B>, este tiene que ser representativo de lo que haces pero a la vez, atractivo y original. Piensa que es el nombre con el que te identificarán el resto de usuarios, tanto empresas como profesionales. Puedes optar por tu nombre completo o por una combinación de tu nombre con tu profesión.";	
		case 'reclamo':
			 /*  v_cadena="Cargando...";
				$.ajax({
			   type: "POST",
			   url: "get_reclamo_quees.asp",
			   data: "p_tipo_user=0",
			   success: function(msg){					 
					 v_cadena="Reclamo (máx. 500 carácteres) <br>"+msg;	
			   }
			 });*/	
						
			
			break;
	   case 'puestotrabajo':
	   		v_cadena="Preste mucha atención en la elección de la <b>categoría profesional</b> y el <b>puesto de trabajo</b>, ya que a partir de estas variables las empresas realizarán sus búsquedas. ";	
	   	break;
	   case 'descripcion':
			v_cadena="Breve descripción profesional de los últimos 3 años (mín. 150 carácteres)";		   
	   		break;
			
	   case 'password':
			v_cadena="(Min 5 caracteres)";		   
	   		break;		
			
	   case 'idiomas':
			v_cadena="Para seleccionar varios idiomas haga click en el texto seleccionado y mantenga la tecla control pulsada.";		   
	   		break;		
						
			
	    case 'nombrepublico_empresa':
			v_cadena="Este es el nombre con el que se presentará y visualizarán los demás usuarios. Si desea que los demás sepan de la empresa que se trata, entonces ponga la razón social de la empresa o nombre comercial. Si por el contrario, desea aparecer oculto, entonces puede poner las iniciales de su Empresa o una frase en la que se describa la empresa en referencia a su sector. <br><b>Ej: Empresa del sector farmacéutico…</b>";
			break;
		case 'reclamo_quees':
			v_cadena="El reclamo es el medio a través del cual los candidatos y profesionales dan a conocer su situación, oferta y necesidades.<br>Por tanto, en la sala general podrás visualizar de una forma sencilla y práctica, los reclamos de Empresas que ofrecen trabajo y de profesionales que, como tu, buscan nuevas oportunidades de empleo.En ningún caso, la estructura que aquí se presenta es de carácter obligatorio, sino que se trata de una sugerencia para que la búsqueda sea más eficaz.<p><b>El siguiente fragmento es un ejemplo de RECLAMO:</B><p>Ej: Empresa del sector textil necesita cubrir para una de sus tiendas en Barcelona una Responsable de Tienda, con experiencia mínima de 3 años en puesto similar. Se ofrece retribución atractiva y posibilidad de promoción dentro de la Marca.";
			
			
			
			break;
		case 'alerta_puesto':
			v_cadena="Quiero recibir reclamos de Profesionales y Empresas relacionados con la categoría seleccionada";
			break;
			
		case 'reclamo_web':
			v_cadena="El Reclamo representa QUIEN SOY, QUE OFREZCO y QUE BUSCO, es nuestro Speech Elevator o-line. Es un llamamiento profesional para aquel que pueda precisar de un profesional de sus características. Es su oferta profesional.<p>El Reclamo será lo que le represente en el Punto de Encuentro y lo que pueda despertar el interés de otras empresas o usuarios. Así que puede utilizar como guía la información del campo “breve descripción trayectoria profesional”, pero recuerde que al final deberá precisar lo que quiere o esta buscando en este momento."
			break;
			
			
		case 'CV':
			v_cadena="<span class=t_etiqueda>Desde ARCjob le damos la oportunidad de insertar su curr&iacute;culum profesional de forma alternativa al perfil.</span>";
			break;	
		case 'descripcion_trayectoria':
			v_cadena="Aproveche el campo <b>“breve descripción trayectoria profesional”</b>, para hacer mención a los puestos de trabajo ocupados en los últimos 5 años, así como para destacar habilidades adquiridas, empresas en las que ha trabajado, conocimientos aplicados, etc.  Recuerde que más adelante deberá sintetizar su experiencia, competencias, actitudes y motivaciones en el campo del Reclamo, por tanto, aproveche en este apartado para presentar la información de forma más detallada.";
		break;
	}
	 
	if(p_literal=="CV") document.getElementById(p_div_form).innerHTML="<br/>"+v_cadena;
	else
	document.getElementById(p_div_form).innerHTML="<img src='images/exclamacion.gif' border=0>&nbsp;"+v_cadena;
}

function hidden_all_aclaraciones(p_div_form)
{
 
   
	document.getElementById(p_div_form).innerHTML="<img src='images/hspacer.gif' width=1 height=1>";
}



function sel_puesto_trabajo()
{
		v_opcion= document.getElementById("n_profesiones").value;
	
		if(v_opcion!=12 && v_opcion!=16){
			document.getElementById("puestotrabajootros").innerHTML="<input type='hidden' size='30' name='n_puestotrabajo2'  id='n_puestotrabajo'/>";
			 
		$.ajax({
		   type: "POST",
		   url: "get_perfil_puesto.asp",
		   data: "p_id="+v_opcion,
		   success: function(msg){
			 
			  	//document.getElementById("ff_otros").innerHTML="<b>Puesto de trabajo</b>&nbsp;";
			   document.getElementById("desplega").innerHTML=msg;
		   }
		 });
		}
		else{
			document.getElementById("desplega").innerHTML="&nbsp;<input type='hidden' value='0' name='n_categorias'  id='n_categorias'/>";
			//document.getElementById("ff_otros").innerHTML="&nbsp;";
			
			document.getElementById("puestotrabajootros").innerHTML="<span class='texto_plano'>Otros&nbsp;</span><input type='text' size='30' name='n_puestotrabajo2'  id='n_puestotrabajo'/>";
			 
		}
}


function send_explica(p_user_id,p_typo)
{
			var msg="";
		 
 
	v_texto=document.getElementById("v_texto").value;
 
	if (v_texto.length==0) msg+="\nDebe escribir un comentario";
	if(v_texto.length>0) {
		 
			//sugerencia
					$.ajax({
		   type: "POST",
		   url: "get_enviar_buzon.asp",
		   data: "p_user_id="+p_user_id+"&p_tipo_buzon=3&p_texto="+escape(v_texto),
		   success: function(msg){
			  window.parent.location="arc_configuracion_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_typo+"&sec=0";
			  	
		   }
		 });
			 
			
			 		
	}
	else alert(msg);
}

function send_buzon_mail_empresa(p_user_id,p_typo)
{
		var msg="";
		 
 
	v_texto=document.getElementById("v_texto_jv2").value;
 
	if (v_texto.length==0) msg+="\nDebe escribir un comentario";
	if(v_texto.length>0) {
		 
			//sugerencia
					$.ajax({
		   type: "POST",
		   url: "get_enviar_buzon.asp",
		   data: "p_user_id="+p_user_id+"&p_tipo_buzon=1&p_texto="+escape(v_texto),
		   success: function(msg){
			  window.parent.location="arc_configuracion_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_typo+"&sec=0";
			  	
		   }
		 });
			 
			
			 		
	}
	else alert(msg);	
}
function send_buzon_mail(p_user_id,p_typo)
{
	 var v_opcion;
	 var v_texto;
	 var msg="";
  
	v_opcion=document.getElementById("v_seleccd").value;
	 
	v_texto=document.getElementById("v_texto_sugeren").value;
 
	if (v_opcion==0) msg+="\nDebe seleccionar el tipo de comentario";
	if (v_texto.length==0) msg+="\nDebe escribir un comentario";
	
	if(msg=="") {
		 
			//sugerencia
					$.ajax({
		   type: "POST",
		   url: "get_enviar_buzon.asp",
		   data: "p_user_id="+p_user_id+"&p_tipo_buzon="+v_opcion+"&p_texto="+escape(v_texto),
		   success: function(msg){
			  window.parent.location="arc_configuracion_c.asp?p_user_id="+p_user_id+"&p_type_user="+p_typo+"&sec=0";
			  	
		   }
		 });
			 
			
			 		
	}
	else alert(msg);
}

function evalform_new_perfil()
{
	var v_msg_error="";
	if (document.getElementById("n_perfil").value=='') {
	    v_msg_error+="El campo NOMBRE PÚBLICO es obligatorio\n";
		
	}
 
	
	v_cadena=document.getElementById("n_descripcion").value;
 
	if (v_cadena.length>2000) {
	    v_msg_error+="El campo BREVE DESCRIPCIÓN TRAYECTORIA PROFESIONAL es demasiado largo\n";
	}	
	if (v_cadena.length<150) {
	    v_msg_error+="El campo BREVE DESCRIPCIÓN TRAYECTORIA PROFESIONAL es demasiado corto\n";
	}	
 
	if (document.getElementById("n_profesiones").value==0) {
	    v_msg_error+="El campo PROFESIÓN es obligatorio\n";
	}	
	if (document.getElementById("n_situacion").value==0) {
	    v_msg_error+="El campo SITUACIÓN ACTUAL es obligatorio\n";
	}		
	
	if (document.getElementById("v_ciudad").value=='') {
	    v_msg_error+="El campo CIUDAD es obligatorio\n";
	}		
	if (document.getElementById("n_descripcion").value<=0) {
	    v_msg_error+="El campo BREVE DESCRIPCIÓN TRAYECTORIA PROFESIONAL es obligatorio\n";
	}	
	 if (document.getElementById("n_trabajo").value==0) {
	    v_msg_error+="El campo AÑOS TRABAJADOS es obligatorio\n";
	}		
	if (document.getElementById("n_titulacion").value==0) {
	    v_msg_error+="El campo TITULACIÓN es obligatorio\n";
	}	
 
	/*if (document.perfil.n_idiomas.selectedIndex<0) {
	    v_msg_error+="El campo IDIOMAS es obligatorio\n";
	}	*/	
	if(document.getElementById("v_idiomas").value.length==0) v_msg_error+="El campo IDIOMAS es obligatorio\n";
 	
	
	if (document.getElementById("n_jornada").value==0) {
	    v_msg_error+="El campo JORNADA LABORAL es obligatorio\n";
	}	
	
	if (document.getElementById("n_disponibilidad").value==0) {
	    v_msg_error+="El campo DISPONIBILIDAD es obligatorio\n";
	}
	
	if (document.getElementById("n_cpostal").value=='') {
	    v_msg_error+="El campo CÓDIGO POSTAL es obligatorio\n";
	}	
	
		if(v_msg_error=='') {
		     document.perfil.submit();
		 
			
	}
	
	else  alert(v_msg_error);

}

function change_ofertas_mig(p_tipo,p_userid)
{
 
 	v_raiz="<a href='arc_gestion_ofertas_c.asp?p_user_id="+p_userid+"&p_type_user=1&sec=0'>Gesti&oacute;n de ofertas</a> > "
	switch(parseInt(p_tipo))
	{
		case 1:
		     document.getElementById("m_pan_ofertas").innerHTML =v_raiz + "<b>Insertar Oferta</B>";
			break;
		case 2:
		     document.getElementById("m_pan_ofertas").innerHTML =v_raiz +"<B>Modificar Oferta</B>";
			break;			
	}
}

function show_subcat_buscaodr(p_cat_id,p_sub_id)
{ 
 
	$.ajax({
	   type: "POST",
	   url: "get_subcategoria_id.asp",
	   data: "p_id="+parseInt(p_cat_id)+"&p_cid="+p_sub_id,
	   success: function(msg){ 
		 
					document.getElementById("subcat1").innerHTML  =msg;
				 	   

	   }
	 });	
}


function show_subcat(p_cat_id)
{ 
 
	switch(p_cat_id)
	{
		case 1:
			v_sub_id=document.getElementById("v_cat1").value;//document.arc_buscador.v_cat1[document.arc_buscador.v_cat1.selectedIndex].value;
		break;
		case 2:
			v_sub_id=document.arc_buscador.v_cat2[document.arc_buscador.v_cat2.selectedIndex].value;
		break;
		case 3:
			v_sub_id=document.arc_buscador.v_cat3[document.arc_buscador.v_cat3.selectedIndex].value;	
		break;	
	}	
	  
	$.ajax({
	   type: "POST",
	   url: "get_subcategoria_id.asp",
	   data: "p_id="+parseInt(v_sub_id)+"&p_cid="+p_cat_id,
	   success: function(msg){
			switch(p_cat_id)
			{
				case 1:
					document.getElementById("subcat1").innerHTML =msg;
				break;
				case 2:
					document.getElementById("subcat2").innerHTML  =msg;
				break;
				case 3:
					document.getElementById("subcat3").innerHTML  =msg;	
				break;	
			}		   

	   }
	 });	
}


function evalform_mod_oferta()
{
var v_msg_error ='';
 

//perfil.submit()
/*	if (document.oferta.f_titulo.value=='') {
	    v_msg_error+="El campo TÍTULO es obligatorio\n";
		
	}
	if (document.oferta.n_lugar.value=='') {
	    v_msg_error+="El campo LUGAR DE TRABAJO es obligatorio\n";
	}

	if (document.oferta.n_descripcion.value=='') {
	    v_msg_error+="El campo DESCRIPCIÓN es obligatorio\n";
	}	*/
	
/*	v_cadena=document.oferta.n_reclamooferta.value;
	if (v_cadena.length>500) {
	    v_msg_error+="El campo RECLAMO es demasiado largo\n";
	}	*/	
	if (document.oferta.f_titulo.value=='') {
	    v_msg_error+="El campo TÍTULO es obligatorio\n";
		
	}

	if(document.getElementById("nombreoculto").style.visibility=='visible' && document.oferta.n_sioculto.value.length<=0)
	{
	    v_msg_error+="El campo NOMBRE OCULTO es obligatorio\n";
	}
	 
	if (document.oferta.n_profesiones[document.oferta.n_profesiones.selectedIndex].value==0) {//
	    v_msg_error+="El campo CATEGORIA es obligatorio\n";
	}
	if(document.getElementById("puestotrabajootros").style.visibility=="visible")
	{
			if (document.oferta.puestotrabajootros.value=='') {
	    v_msg_error+="Debe detallar un puesto de trabajo\n";
		
			}
	}
	else{
		if (document.oferta.n_categorias[document.oferta.n_categorias.selectedIndex].value==0) {//
			v_msg_error+="El campo PUESTO DE TRABAJO es obligatorio\n";
		}
	}	
	if (document.oferta.n_sector[document.oferta.n_sector.selectedIndex].value==0) {//
	    v_msg_error+="El campo SECTOR es obligatorio\n";
	}
	if (document.oferta.n_lugardetrabajo[document.oferta.n_lugardetrabajo.selectedIndex].value==0) {//
	    v_msg_error+="El campo LUGAR DE TRABAJO es obligatorio\n";
	} 	
 	v_cadena=document.oferta.n_serequiere.value;
	if (v_cadena.length>500) {
	    v_msg_error+="El campo SE REQUIERE es demasiado largo\n";
	}
	if (v_cadena.length<100) {
	    v_msg_error+="El campo SE REQUIERE es demasiado corto\n";
	}	
	if (document.oferta.n_serequiere.value=='') {
	    v_msg_error+="El campo SE REQUIERE es obligatorio\n";
	}
 	v_cadena=document.oferta.n_seofrece.value;
	if (v_cadena.length>500) {
	    v_msg_error+="El campo SE OFRECE es demasiado largo\n";
	}	
	
	if (document.oferta.n_tipo[document.oferta.n_tipo.selectedIndex].value==0) {
	    v_msg_error+="El campo TIPO DE CONTRATO es obligatorio\n";
	}
	if (document.oferta.n_horario[document.oferta.n_horario.selectedIndex].value==0) {
	    v_msg_error+="El campo HORARIO es obligatorio\n";
	}  
	
 	v_cadena=document.oferta.n_descripcion.value;
	if (v_cadena.length>1200) {
	    v_msg_error+="El campo DESCRIPCIÓN es demasiado largo\n";
	} 
	if (v_cadena.length<150) {
	    v_msg_error+="El campo DESCRIPCIÓN es demasiado corto\n";
	}	
	if (document.oferta.n_descripcion.value=='') {
	    v_msg_error+="El campo DESCRIPCIÓN es obligatorio\n";
	}	
	/*v_cadena=document.oferta.n_reclamooferta.value;
	if (v_cadena.length>500) {
	    v_msg_error+="El campo RECLAMO es demasiado largo\n";
	}		
	if (document.oferta.n_reclamooferta.value=='') {
	    v_msg_error+="El campo RECLAMO es obligatorio\n";
	}
	*/
	
	if(v_msg_error=='') document.oferta.submit();	
	
	else  alert(v_msg_error);	
}


function setFocus(objName) {
	var objTextBox = myGetElementById(objName);
	objTextBox.focus();
}
