function verifica_encuesta(formulario){
 var el = formulario.elements;
 for(var i = 0 ; i < el.length ; ++i) {
  if(el[i].type == "radio") {
   var radiogroup = el[el[i].name]; // get the whole set of radio buttons.
   var itemchecked = false;
   for(var j = 0 ; j < radiogroup.length ; ++j) {
    if(radiogroup[j].checked) {
	 itemchecked = true;
	 break;
	}
   }
   if(!itemchecked) { 
    alert("Marque una respuesta de la encuesta, por favor");
    if(el[i].focus)
     el[i].focus();
	return false;
   }
  }
 }
 return true;
} 


 function enviar_encuesta(FORM,CODIGO)
{
		if (verifica_encuesta(window.document.frm_home_encuesta)) 
		{
		window.document.frm_home_encuesta.id_pre.value=CODIGO;
		window.document.frm_home_encuesta.submit();
		}
} 

function Ir_derecho_home(VER,DERECHO)
{
 //alert(VER);
 //var checkStr1;
//checkStr1= window.document.formulario.enunciadoalternativaencuesta.value;
 //window.document.formulario.enunciadoalternativaencuesta.value=checkStr1;
    window.document.form_medio.ver_opt.value="";
    window.document.form_medio.ver_opt.value=VER;
 	window.document.form_medio.nom_seccion.value=VER;
	window.document.form_medio.derecho.value=DERECHO;
	// alert(VER);
	 
	// alert(DERECHO);
	window.document.form_medio.submit();

} 
function Ir_derecho_home_acordeon(VER,DERECHO)
{
 
    window.document.formulario_acordeon.ver_opt.value="";
    window.document.formulario_acordeon.ver_opt.value=VER;
 	window.document.formulario_acordeon.nom_seccion.value=VER;
	window.document.formulario_acordeon.derecho.value=DERECHO;
	 // alert(VER);
	 
	// alert(DERECHO);
	window.document.formulario_acordeon.submit();

} 
function Ir_interna_home_acordeon(VER)
{
    window.document.formulario_acordeon.ver_opt.value="";
    window.document.formulario_acordeon.ver_opt.value=VER;
	window.document.formulario_acordeon.nom_seccion.value="";
	window.document.formulario_acordeon.submit();
}
/************************   OPCIONES ACORDEON Y GENERAL - DANDO AREGLO DE SECCION **************/ 
/*************************/
 

function Ir_derecho_ac(VER,DERECHO)
{
 //alert(VER);
     
    window.document.formulario.ver_opt.value=VER;
	window.document.formulario.ver_opt2.value='';
		window.document.formulario.ver_opt2_color.value='';
 	window.document.formulario.nom_seccion.value=VER;
	window.document.formulario.derecho.value=DERECHO;
	 
	//alert(NOM_SECCION);
	//alert(DERECHO);
	window.document.formulario.submit();

} 
/*************************/
function Ir_otro(VER,DERECHO)
{
 //alert(VER);

    window.document.frm_abajo.ver_opt.value=VER;
 	window.document.frm_abajo.nom_seccion.value=VER;
	window.document.frm_abajo.derecho.value=DERECHO;
 
	//alert(NOM_SECCION);
	//alert(DERECHO);
	window.document.frm_abajo.submit();

} 

//***********
function Ir_edi_usu_interna(VER,DERECHO)
{
 //alert(VER);

    window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.nom_seccion.value='';
	window.document.formulario.derecho.value=DERECHO;
 
	//alert(NOM_SECCION);
	//alert(DERECHO);
	window.document.formulario.submit();

}
function Ir_derecho(VER,DERECHO)
{
 //alert(VER);
    window.document.formulario.ver_opt.value="";
    window.document.formulario.ver_opt.value=VER;
//	window.document.formulario.nom_seccion.value=NOM_SECCION;
	window.document.formulario.derecho.value=DERECHO;
	//alert(VER);
	//alert(NOM_SECCION);
	//alert(DERECHO);
	window.document.formulario.submit();

} 

// funcion para la barra de cabeza del prompymes
function go(DoWhat) {

if (DoWhat.value != "none") {
	/*var height = 300;
	var width = 350;
	  var str = "height=" + height + ",innerHeight=" + height;
	  str += ",width=" + width + ",innerWidth=" + width;
	  if (window.screen) {
	    var ah = screen.availHeight - 30;
	    var aw = screen.availWidth - 10;
	
	    var xc = (aw - width) / 2;
	    var yc = (ah - height) / 2;
	
	    str += ",left=" + xc + ",screenX=" + xc;
	    str += ",top=" + yc + ",screenY=" + yc;
	  }*/
	   //open(DoWhat.value, "remote", str);
	  var wintoload = open(DoWhat.value, "remote");
	   wintoload.focus()
  }
}

function Validar(theForm)
{var checkStr = theForm.login.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su código de Usuario, por favor.");
    theForm.login.focus();
    return (false);
	}	
 var checkStr = theForm.passw.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su Contraseña, por favor.");
    theForm.passw.focus();
    return (false);
	}	
 return (true);
}
function Login()
{
if (Validar(window.document.formulario))
{
window.document.formulario.action="ar_admin/verifica.php";	
	window.document.formulario.submit();
}
}


function Ir_inicio_verifica(IDUSU)
{
 
    window.document.formulario.Usuario_session.value=IDUSU;
	window.document.formulario.action="index.php";
	window.document.formulario.submit();
}


function focus(){
	window.document.formulario.login.focus();
}



function Ir_derecho_sub(VER,VER2,DERECHO)
{
     
    window.document.formulario.ver_opt.value=VER;
	window.document.formulario.ver_opt2.value=VER2;
	window.document.formulario.ver_opt2_color.value=VER2;
 	window.document.formulario.nom_seccion.value=VER;
	window.document.formulario.derecho_sub.value=DERECHO;
	window.document.formulario.submit();

} 

/*************************/
/************************   OPCIONES VER GENERAL **************/ 
/*************************/
 

function Ir_tipo_empresas(VER,DERECHO,TIPO_EMP)
{
    window.document.formulario.ver_opt.value="";
    window.document.formulario.ver_opt.value=VER;
 	window.document.formulario.tip_empresa.value=TIPO_EMP;
	
	window.document.formulario.derecho.value=DERECHO;
	window.document.formulario.submit();

} 
 
