//var acc='x';
////-----------------------------------------------------
function get(id){
    return document.getElementById(id).value;
}


////++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

function limp(){
    
    document.getElementById('s_id1').value='';
    document.getElementById('s_id2').value='';
    document.getElementById('g_id1').value='';
    document.getElementById('g_id2').value='';
    document.getElementById('c_id1').value='';
    document.getElementById('c_id2').value='';
    var frame = document.getElementById("preview2"),
    frameDoc = frame.contentDocument || frame.contentWindow.document;
    frameDoc.documentElement.innerHTML = "";
}


function pdf(){    
  
    var grado=get('g_id1');
    var curso=get('c_id1');
    
	//alert(grado+" - "+curso);
     window.open('listado.php?grado='+grado+'&curso='+curso, "preview2");

}

////-----------------------------------

function pdf1(){    
  
    var grado=get('g_id1');
    var curso=get('c_id1');
    var x=Math.random() * (50 - 10) + 10;   
    window.open('listado1.php?grado='+grado+'&curso='+curso+'&x='+x, "preview2");

}

////-----------------------------------


function excel(){



    var grado=get('g_id1');
    var curso=get('c_id1');


      if (grado==""){
          alert("Seleccione Grado");
          return 0;
      }

      if (curso==""){
          alert("Seleccione Curso");
          return 0;
      }

window.open('reporteexcel.php?grado='+grado+'&curso='+curso, "preview2");

        
}


////-----------------------------------
function parametro( name ){
	var regexS = "[\\?&]"+name+"=([^&#]*)";
	var regex = new RegExp ( regexS );
	var tmpURL = window.location.href;
	var results = regex.exec( tmpURL );
	if( results == null )
		return "";
	else
		return results[1];
}

////----------------------------------

function retornar_menu_docente(){
    
 var parametros = {"accion":'retornar_rol'};

                    $.ajax({
                    data:  parametros,
                    url:"catalogos.php",
                    type: "POST",
                    success: function(rol){
                       
                         if(rol==4)
                           location.href="../menu.php";
                        else if(rol==1)
                              location.href="../menu_profesor.php";
                        else if(rol==5)
                            location.href="../menu_coordinador.php";
                        else if(rol==6)
                            location.href="../menu_secretaria.php";

                    }}) ;

}

//-------------------------

function verificar(){

var grado=get('g_id1');
var curso=get('c_id1');
  
window.open('page_verificar.php?grado='+grado+'&curso='+curso);

}
//-------------------------
function cargar_verificar(){

var grado=parametro('grado');
var curso=parametro('curso');

var parametros = {"accion":'fotos_verificar',
                  "grado":grado,
                  "curso":curso
                 };
        $.ajax({
                data:  parametros,
                url:   'catalogos.php',
                type:  'post',
                success:function (response){
                      
                       $("#fotos_verificar").html(response);
                        
           }
        });
  

}
//-------------------------
function grabar_codigo(codigo){

var nuevo=get('NUEVO_'+codigo);
  
   var parametros = {"accion":'grabar_nuevo_codigo',
                     "codigo":codigo,
                     "nuevo":nuevo
                    };
        $.ajax({
                data:  parametros,
                url:   'catalogos.php',
                type:  'post'
        });

}