// JavaScript Document
var modulos='';
var URL = unescape(location.href)	
var xstart = URL.lastIndexOf("/") + 1
var xend = URL.length
var hereName = URL.substring(xstart,xend)
var url2=unescape(hereName)	
var xend2 = url2.lastIndexOf("?")
if (xend2>-1)
	{
	var final=hereName.substring(0,xend2)
	var nom_pagina=final.replace(/.php/,"")
	}
else
	{
	var nom_pagina=hereName.replace(/.php/,"")
	}
function mensajes()
{
var query = window.location.search.substring(1);
if (query=="we345hidq"){alert("Los datos ingresados son incorectos.")}
if (query=="endsessions"){alert("Por favor, Identifíquese.")}
if (query=="nofile"){alert("No se encuentra autorizado para descargar este archivo.")}
if (query=="permiso"){alert("No se encuentra autorizado para acceder a esta sección.")}
if (query=="msjok"){alert("El mensaje fué enviado con éxito,"+'\n'+"en breve nos comunicaremos contigo."+'\n'+"Muchas Gracias!.")}
if (query=="newsok"){alert("Los datos fueron almacenados con éxito,"+'\n'+"en breve empezaras a recibir nuestro Newsletter."+'\n'+"Muchas Gracias!.")}
if (query=="newserror"){alert("El email indicado ya se encuentra,"+'\n'+"habilitado para recibir nuestro Newsletter.")}
if (query=="postulacion"){alert("Los datos fueron almacenados con éxito,"+'\n'+"Muchas Gracias!.")}
if (query=="exist"){alert("Ya te encuentras postulado a esta oferta laboral.")}
}
function tamano()
{
	if(document.form1.lst_tipos.value=="I")
	{
	document.getElementById('tam').style.display=""
	}
	else
	{
	document.getElementById('tam').style.display="none"
	}
	if(document.form1.lst_tipos.value=="A")
		{
		document.getElementById('descrimedia').style.display="none"
		document.getElementById('linkmedia').style.display="none"
		}
	else
		{
		document.getElementById('descrimedia').style.display=""
		document.getElementById('linkmedia').style.display=""
		}
}
function valida_contacto()
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_apellido.value=="")|(document.form1.txt_telefono.value=="")|(document.form1.txt_email.value=="")|(document.form1.txt_comentarios.value==""))
	{
		alert("Todos los datos son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.submit();
		}
	}
}
function valida_new()
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_email.value==""))
	{
		alert("Todos los datos son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.submit();
		}
	}
}
function valida_postulacion()
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_apellidos.value=="")|(document.form1.txt_telefono.value=="")|(document.form1.txt_email.value==""))
	{
		alert("Los campos marcados con (*) son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.submit();
		}
	}
}
function valida_recibirnews()
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_email.value==""))
	{
		alert("Todos los datos son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.submit();
		}
	}
}
function valida_ofertas()
{
if ((document.form1.txt_titulo.value==""))
	{
	alert("Debe ingresar el Título.")
	}
else
	{
	if (document.form1.txt_id.value!="")
			{
			accion="updt"
			id=document.form1.txt_id.value
			busca_duplicado(accion,'ofertas',document.form1.txt_titulo.value,id)
			}
		else
			{
			accion="add"
			id=document.form1.txt_id.value
			busca_duplicado(accion,'ofertas',document.form1.txt_titulo.value,id)
			}
		}
}
function valida_listas()
{

if ((document.form1.txt_descripcion.value==""))
	{
	alert("Todos los datos son obligatorios.")
	document.form1.txt_descripcion.focus();
	}
else	
	{
	if (document.form1.txt_id.value!="")
		{
		accion="updt"
		id=document.form1.txt_id.value
		busca_duplicado(accion,'lista_emails',document.form1.txt_descripcion.value,id)
		}
	else
		{
		accion="add"
		id=document.form1.txt_id.value
		busca_duplicado(accion,'lista_emails',document.form1.txt_descripcion.value,id)
		}
	}
}
function valida_lista_detalle()
{

if ((document.form1.txt_destinatario.value=="")|(document.form1.txt_email.value==""))
	{
	alert("Todos los datos son obligatorios.")
	document.form1.txt_descripcion.focus();
	}
else	
	{
	q=document.form1.txt_email.value;
	var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
	if(b.test(q)==false)
		{
		alert ("La dirección de email es incorrecta")
		}
	else	
		{
		if (document.form1.txt_id.value!="")
			{
			accion="updt"
			id=document.form1.txt_id.value
			busca_duplicado(accion,'lista_detalle',document.form1.txt_email.value,id)
			}
		else
			{
			accion="add"
			id=document.form1.txt_id.value
			busca_duplicado(accion,'lista_detalle',document.form1.txt_email.value,id)
			}
		}
	}
}
function valida_news(tipo)
{
if ((document.form1.txt_asunto.value=="")|(document.form1.lst_incgrupos.length==0))
	{
	alert("Debe ingresar el asunto del News y al menos un grupo a quien enviarlo.")
	}
else
	{
	/*recopilo noticias agrgadas*/
	var can = (document.getElementById('lst_incnoticias').length)
	var noticias=''
	if (can>0)
		{
		for (var g=0; g < can;g++)
			{
			if (noticias!='')
				{sep="@"}
			else
				{sep=""}
			noticias=noticias+sep+document.form1.lst_incnoticias[g].value
			}
		}
	/*recopilo eventos agrgadas*/
	/*var can = (document.getElementById('lst_inceventos').length)
	var eventos=''
	if (can>0)
		{
		for (var g=0; g < can;g++)
			{
			if (eventos!='')
				{sep="@"}
			else
				{sep=""}
			eventos=eventos+sep+document.form1.lst_inceventos[g].value
			}
		}*/
		eventos="";
	/*recopilo grupos agrgadas*/
	var can = (document.getElementById('lst_incgrupos').length)
	var grupos=''
	if (can>0)
		{
		for (var g=0; g < can;g++)
			{
			if (grupos!='')
				{sep="@"}
			else
				{sep=""}
			grupos=grupos+sep+document.form1.lst_incgrupos[g].value
			}
		}
		
		if (document.form1.txt_id.value!="")
			{
			accion="updt"
			id=document.form1.txt_id.value
		    //busca_duplicado(accion,'newsletters',document.form1.txt_asunto.value,id)
			document.form1.action="comandos.php?accion=updt_newsletters&pag=newsletters.php?tipo="+tipo+"&noticias="+noticias+"&eventos="+eventos+"&grupos="+grupos+"&id="+id	;
			document.form1.submit();
			}
		else
			{
			accion="add"
			id=document.form1.txt_id.value
			//busca_duplicado(accion,'newsletters',document.form1.txt_asunto.value,id)
			document.form1.action="comandos.php?accion=add_newsletters&pag=newsletters.php?tipo="+tipo+"&noticias="+noticias+"&eventos="+eventos+"&grupos="+grupos;
			document.form1.submit();
			}
	}

}
function updt_postulaciones(foco,valores)
{
mue_form3()
valores=valores.replace(/ª/g,"'")
valores=valores.replace(/ç/g,'"')
arr=valores.split("|")
document.form1.txt_id.value=arr[0]
document.form1.txt_nombre.value=arr[1]
document.form1.txt_apellidos.value=arr[2]
document.form1.txt_edad.value=arr[3]
document.form1.txt_direccion.value=arr[4]
document.form1.txt_cp.value=arr[5]
document.form1.txt_pais.value=arr[6]
document.form1.txt_provincia.value=arr[7]
document.form1.txt_poblacion.value=arr[8]
document.form1.txt_telefono.value=arr[9]
document.form1.txt_movil.value=arr[10]
document.form1.txt_email.value=arr[11]
document.form1.txt_comentarios.value=arr[12].replace(/<br>/g,"\r")
}
function updt_ofertas(foco,valores)
{
mue_form(foco)
valores=valores.replace(/ª/g,"'")
valores=valores.replace(/ç/g,'"')
arr=valores.split("|")
document.form1.txt_id.value=arr[0]
document.form1.txt_titulo.value=arr[1]
document.form1.txt_fecha.value=arr[2]
detalle=arr[3]
var oEditor = FCKeditorAPI.GetInstance('txt_detalle');
oEditor.SetHTML (detalle, true);
str=arr[4]
document.form1.txt_copete.value=str.replace(/<br>/g,"\r")
}
function updt_listas(foco,valores)
{
mue_form(foco)
arr=valores.split("|")
document.form1.txt_id.value=arr[0]
document.form1.txt_descripcion.value=arr[1]
}
function updt_lista_detalle(foco,valores)
{
mue_form(foco)
arr=valores.split("|")
document.form1.txt_id.value=arr[0]
document.form1.txt_destinatario.value=arr[1]
document.form1.txt_email.value=arr[2]
}
function updt_news(id,tipo)
{
window.open("newsletters.php?id="+id+"&tipo="+tipo, "_parent")
}
function ocu_form()
{
document.getElementById('alta_modi').style.display="none"
document.getElementById('marco').style.display="none"
}

function mue_form(foco)
{
document.getElementById('alta_modi').style.display="block"
document.getElementById(foco).focus()
document.getElementById('marco').style.display="none"
var foto=document.getElementById('tdimg')
if (foto){document.getElementById('tdimg').innerHTML=""}
if (nom_pagina=="media"){document.getElementById('tam').style.display="none"}

if (nom_pagina=='ofertas')
	{
	var oEditor = FCKeditorAPI.GetInstance('txt_detalle');
	oEditor.SetHTML ('', true);
	document.forms[0].reset()
	}
	else
	{
	if (nom_pagina=='newsletter')
		{
		var oEditor = FCKeditorAPI.GetInstance('txt_infogral');
		oEditor.SetHTML ('', true);
		}
	else
		{
		document.forms[0].reset()
		}
	}
		
}
function mue_form2(tipo)
{
window.open("newsletters.php?id=0&tipo="+tipo, "_parent")
}
function mue_form3()
{
document.getElementById('alta_modi').style.display="block"
document.getElementById('marco').style.display="none"
var foto=document.getElementById('tdimg')
if (foto){document.getElementById('tdimg').innerHTML=""}
if (nom_pagina=="media"){document.getElementById('tam').style.display="none"}

if (nom_pagina=='ofertas')
	{
	var oEditor = FCKeditorAPI.GetInstance('txt_detalle');
	oEditor.SetHTML ('', true);
	document.forms[0].reset()
	}
	else
	{
	if (nom_pagina=='newsletter')
		{
		var oEditor = FCKeditorAPI.GetInstance('txt_infogral');
		oEditor.SetHTML ('', true);
		}
	else
		{
		document.forms[0].reset()
		}
	}
		
}
function alta_news(val)
{
if (val>-1)
	{
	mue_form('txt_asunto')
	if(val>0){document.form1.txt_id.value=val}
	}
}
function asignaclase()
{

//if (nom_pagina=='novedades') {document.getElementById('novedades').className = 'current'}
if (nom_pagina=='encuestas') {document.getElementById('encuestas').className = 'current'}
if (nom_pagina=='eventos') {document.getElementById('eventos').className = 'current'}
if (nom_pagina=='links') {document.getElementById('links').className = 'current'}
if (nom_pagina=='newsletters') {document.getElementById('newsletters').className = 'current'}
}
function validausu()
{
if ((document.form_usuario.usuario.value=="" )|(document.form_usuario.clave.value==""))
	{
	alert("Debes ingresar el Usuario y la Clave.")
	document.form_usuario.usuario.focus()
	}
else
	{
	document.form_usuario.submit()
	}
}
function intro() 
{
	var x=event.keyCode
	if (x==13)  
	{
	validausu();
	return true;
	}
}
function intro_forms() 
{
	var x=event.keyCode
	if (x==13)  
	{
	if (nom_pagina=="clientes"){valida_clientes()}
	if (nom_pagina=="directores"){valida_clientes()}
	if (nom_pagina=="peliculas"){valida_peliculas()}
	if (nom_pagina=="media"){valida_media()}
	if (nom_pagina=="novedades"){valida_novedades()}
	return true;
	}
}
function intro_busca(pagina) 
{
	var x=event.keyCode
	if (x==13)  
	{
	buscar(pagina);
	return true;
	}
}
function eliminar(cod,tabla,campo,archivo)
{
var eli = confirm("¿Deseas eliminar el Registro?");
if (eli== true)
{
var URL = unescape(location.href)	
var xstart = URL.lastIndexOf("/") + 1
var xend = URL.length
var pagina = URL.substring(xstart,xend)
pag=pagina.replace(/&/gi,"|")
sql="delete from "+tabla+" where "+campo+"="+cod
nav=pag.lastIndexOf("totalRows_"+nom_pagina+"=")
caracteres=nom_pagina.length
if (nav>-1)
	{
	numero=pag.substring(nav+11+caracteres,nav+10+caracteres+3)
	final=parseInt(numero)-1
	va="totalRows_"+nom_pagina+"="+numero
	pag=pag.replace(va,"totalRows_"+nom_pagina+"="+final)
	}
window.open('comandos.php?accion=delete&sql='+sql+'&file='+archivo+'&pag='+pag , '_parent')
}
}

function buscar(pagina)
{
if(document.getElementById('txt_busca').value=="")
{
alert("Tienes que ingresar el dato a buscar.")
document.getElementById('txt_busca').focus()
}
else
{
window.open(pagina+'?valor='+document.getElementById('txt_busca').value , '_parent')
}
}
function oculta_submen()
{
document.getElementById('marco').style.display="none"
}
function muestra_submen()
{
document.getElementById('marco').style.display=""
}
function orden(op,campo)
{
obj = document.getElementById(op);
var top=obj.offsetTop 
var left=obj.offsetParent.offsetLeft 
var query = window.location.search.substring(1);
var esta=document.getElementById('alta_modi').style.display
tt=document.getElementById('tbl').offsetTop
ll=document.getElementById('tbl').offsetLeft
var navegador = navigator.appName 
if (navegador == "Microsoft Internet Explorer") 
{
document.getElementById('marco').style.left=left+255+ll+'px'
document.getElementById('marco').style.top=tt+200+'px'
}
else 
{
document.getElementById('marco').style.left=left+ll+'px'
document.getElementById('marco').style.top=tt+30+'px'
}
	

muestra_submen()
col="<div><div id=item><ul><li><a href=javascript:ira('asc','"+campo+"') onclick=oculta_submen()>Ascending Order</a></li></ul></div><div id=item2><ul><li><a href=javascript:ira('desc','"+campo+"')  onclick=oculta_submen()>Descending Order</a></li></ul></div>"
document.getElementById('interior').innerHTML=col
}
function ira(orden,campo)
{
var URL = unescape(location.href)	
var xstart = URL.lastIndexOf("/") + 1
var xend = URL.length
var pagina = URL.substring(xstart,xend)
var query1=pagina.lastIndexOf("?")	
if (query1<0)
	{pag=pagina+"?ord="+orden+"&campo="+campo}
else
	{
	var inicio=pagina.lastIndexOf("?ord=")	
	if (inicio>0)
		{
			if (orden=='asc') {pag=pagina.replace(/ord=desc/, "ord=asc")}
	    	if (orden=='desc') {pag=pagina.replace(/ord=asc/, "ord=desc")}
		}
	else
		{
		var inicio=pagina.lastIndexOf("&ord=")	
			if (inicio>0)
			{
				if (orden=='asc') {pag=pagina.replace(/ord=desc/, "ord=asc")}
	    		if (orden=='desc') {pag=pagina.replace(/ord=asc/, "ord=desc")}
			}
			else
			{		
			pag=pagina+"&ord="+orden+"&campo="+campo
			}
		}
	}
var inicio=pag.lastIndexOf("campo=")	
if (inicio>0){pag=pag.substring(0,inicio-1)+"&campo="+campo}
window.open(pag, '_parent')
}
function control_errores(x,valores)
{
if (x>0){document.getElementById('alta_modi').style.display=""}	
if (x==1)
	{
	val=valores.split("|")
	document.form1.txt_descripcion.value=val[1]
	document.form1.txt_id.value=val[0]
	alert("La imágen no debe superar los "+val[2]+".")
	}
if (x==2)
	{
	alert("El email fué enviado con éxito.")
	}
}
function duplicado_cmd() { 
	if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
			 var a=http.responseText
			 if (a<1)
			 {
				var URL = unescape(location.href)	
				var xstart = URL.lastIndexOf("/") + 1
				var xend = URL.length
				var pagina = URL.substring(xstart,xend)
				pag=pagina.replace(/updt=1/, "updt=0")
				pag=pagina.replace(/add=1/, "add=0")
				accion1=pag.lastIndexOf("add")
				accion2=pag.lastIndexOf("updt")
				if (accion1>-1){accion="add"}
				if (accion2>-1){accion="updt"}
				pag=pag.replace(/&/gi,"|")
				//alert("comandos.php?accion="+accion+"_clientes&pag="+pag)
				nav=pag.lastIndexOf("totalRows_"+nom_pagina+"=")
				caracteres=nom_pagina.length
				if ((nav>-1) && (document.form1.txt_id.value==""))
					{
						numero=pag.substring(nav+11+caracteres,nav+10+caracteres+3)
						final=parseInt(numero)+1
						va="totalRows_"+nom_pagina+"="+numero
						pag=pag.replace(va,"totalRows_"+nom_pagina+"="+final)
					}
					
					if (document.form1.txt_id.value!="")
						{
						accion="updt_"+nom_pagina+"&id="+document.form1.txt_id.value
						}
						else
						{
						accion="add_"+nom_pagina
						}
					//alert(nom_pagina)
					document.form1.action="comandos.php?accion="+accion+"&pag="+pag+"&modulos="+modulos
					document.form1.submit();
			 }
			 else
			 {
				alert("Ya existe un registro similar.") 
			 }
			 enProceso = false;
			}
			
       }
    }
}
function busca_duplicado(comando,modulo,valor,id)
{
if (!enProceso && http) 
	{
   	   var url = "includes/duplicado.php?comando="+comando+"&modulo="+modulo+"&valor="+valor+"&id="+id
	   http.open("GET", url, true);
	   http.onreadystatechange = duplicado_cmd;
       enProceso = true;
       http.send(null);
    }
}

/***ajax*///
function getHTTPObject()
{
 var xmlhttp = null;
 //Internet Explorer
 try
 {
  xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
 }
 catch (e)
 {
  try
  {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  catch (e)
  {
   xmlhttp = null;
  }
 }

 //Mozilla y Safari

 if ((xmlhttp == null) && (typeof XMLHttpRequest != 'undefined'))
 {
  try
  {
   xmlhttp = new XMLHttpRequest();
  }
  catch (e)
  {
   xmlhttp = null;
  }
 }
 return xmlhttp;
}
var enProceso = false; // lo usamos para ver si hay un proceso activo
var http =  getHTTPObject(); // Creamos el objeto XMLHttpRequest
function solonumeros() {
if (event.keyCode < 48  || event.keyCode >  57)  {
	if (event.keyCode != 44 ){
	event.keyCode = 0;
	return true;
}}
}
function formateo(control)
{
var val=document.getElementById(control).value
//var val=document.form2.importe.value 
var val=val.replace(".","") 
var val=val.replace(".","") 
var val=val.replace(".","") 
var cant=val.length 
var esta=val.search(",") 
if (esta<0){ 
if (cant==0) document.getElementById(control).value='' 
if (cant==4) document.getElementById(control).value=val.substr(0,1) + "." + val.substr(1,15) 
if (cant==5) document.getElementById(control).value=val.substr(0,2) + "." + val.substr(2,15) 
if (cant==6) document.getElementById(control).value=val.substr(0,3) + "." + val.substr(3,15) 
if (cant==7) document.getElementById(control).value=val.substr(0,1) + "." + val.substr(1,3) + "." + val.substr(4,15) 
if (cant==8) document.getElementById(control).value=val.substr(0,2) + "." + val.substr(2,3) + "." + val.substr(5,15) 
}
}
function notifica(id,presu)
{
var eli = confirm("Usted esta por enviar un email al cliente "+"\n"+"con la dirección web para acceder a visualizar el Presupuesto."+"\n"+"¿Desea hacerlo?");
if (eli== true)	
	{
	 window.open("presupuestonotifica.php?id="+id+"&presu="+presu , "_parent")
	}
}
/*funciones de agrgados de combos news*/
function addd(lst,lstinc)
{
var m=document.form1[lst].value
if (m==0){
	alert("Debe selecionar una noticia.");}
else{

	var can = (document.getElementById(lstinc).length)
	var indice1 = document.form1[lst].selectedIndex; 
	var texto=document.form1[lst][indice1].text;
	var error =0
		if (can>0)
			{
			for (var g=0; g < can;g++)
				 {
				var tex=document.form1[lstinc][g].text;
				var valor=document.form1[lstinc][g].value;
				if ((texto==tex))
					{
					error=1
					break;
					}
				else
					{
					error=0
					}
				}	
			
			}
		else
			{
			error=0
			}
		
	
		if (error==0)
			{		
			var valor = document.form1[lst].value;
			var new_option = new Option(texto, valor, false, false);
			document.getElementById(lstinc).options[can] = new_option;
			var selObj = document.getElementById(lst);
			selObj.options[0].selected = 1
			}
		else
			{
			if(m<100000)
				{
				alert("El Item que desea agregar ya existe!.");
				}
			var selObj = document.getElementById(lst);
			selObj.options[0].selected = 1
			}
	}
}
function quit(lst,lstinc)
{
var indi =  document.form1[lstinc].selectedIndex; 
if (indi==-1){
alert("No hay ningún item seleccionado!.")}
else
{
document.getElementById(lstinc).options[indi] = null;
var selObj = document.getElementById(lst);
selObj.options[0].selected = 1
}
}
function enviar_news(id,tipo)
{
var eli = confirm("¿Desea realizar el envío?");
if (eli== true)	
	{
	window.open("news_envio.php?id="+id+"&tipo="+tipo, "_parent")
	}
}
function exito(m)
{
	if(m==1)
	{
		alert("El News fué enviado con éxito")
	}
}
function save_cancel(x)
{
	if (x==1)
	{
	document.getElementById('save').style.display=""
	document.getElementById('cancel').style.display=""
	document.getElementById('edit').style.display="none"
	document.getElementById('edit1').style.display="none"
	document.getElementById('edit2').style.display=""
	}
	else
	{
	document.getElementById('save').style.display="none"
	document.getElementById('cancel').style.display="none"
	document.getElementById('edit').style.display=""
	document.getElementById('edit1').style.display=""
	document.getElementById('edit2').style.display="none"
	}
}
function vota(cant,enc)
{
var cod=0
	for (var g=0; g < cant;g++) {
		 if (document.encuestas.voto[g].checked==true)
			{var cod=document.encuestas.voto[g].value}
	}
	if (cod==0){
		alert("Tienes que selccionar una opción válida!.")}
	else
	{
	for (var u=0; u < cant;u++) {
		 var ss="td"+(u+1)
		 document.all[ss].style.display="none"
		 var ss2="td2"+(u+1)
		 document.all[ss2].style.display=""
		 }
		 if(document.getElementById('pregunta'))
		 	{
			 var ss3='pregunta'
			  document.getElementById('pregunta').style.display="none"
			}
		if(document.getElementById('respu'))
			{
			 var ss4='respu'
			  document.getElementById('respu').style.display=""
			}
		if(document.getElementById('boton'))
			{
			 var ss5='boton'
			 document.getElementById('boton').style.display="none"
			}
		if (!enProceso && http) {
		   var url = 'duplicado.php?modulo=encuestas&cod='+cod+'&enc='+enc
		   http.open("GET", url, true);
		   http.onreadystatechange = handleHttpResponse4;
		   enProceso = true;
		   http.send(null);
	 }
	 }

}
function handleHttpResponse4() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
		  var qbusco = http.responseText.split("-");
		  for (var m=0; m < qbusco.length;m++) {
		 	var obj='resultado'+(m+1)
			document.encuestas[obj].value=qbusco[m]
			}
					
		  /*document.getElementById("enttot").value=qbusco[1]
          document.getElementById("prodtot").value=qbusco[2]
		  document.getElementById("total").value=qbusco[0]
		  document.getElementById("vta_cantidad").value=qbusco[3]
		  document.getElementById("vta_total").value=qbusco[0]*/
		  enProceso = false;
		  }
    }
	}
}