$(document).ready(function(){
    //inicia la funcion cuando un combo cambia de seleccion
    $('#Estado').change(function() { 
    //obtengo el valor del combo
    var valor = $('#Estado').attr('value'); 
    	$.ajax({
            method: "get",url: "./inc_php/ajax_php.php", data:"boxEstado="+valor,
            //muestro imagen "cargando" cuando se selecciona un estado
    		beforeSend: function(){$("#loading").show("fast");},
            //detengo la imagen "cargando" cuando termina el proceso 
    		complete: function(){ $("#loading").hide("fast");},
            //si algún dato es obtenido, lo almaceno en la var html 
    		success: function(html){
    		    //el conenido de html se lo asigno al div "respuestaCombo"
                $("#respuestaCombo").html(html); 
    		}
    	}); //close $.ajax( 
    }); //close change(-------------  
    
    
	var valorCiudad = $('#tmp_id_ciudad').val() || 0; 
	var valorEstado = $('#Estado').val() || 0;
	if(valorCiudad != 0 && valorEstado != 0){
    	$.ajax({
            method: "get",url: "./inc_php/ajax_php.php", data:"boxCiudad="+valorCiudad+'&idEstado='+valorEstado,
    		beforeSend: function(){$("#loading").show("fast");},
    		complete: function(){ $("#loading").hide("fast");}, 
    		success: function(html){
                $("#respuestaCombo").html(html);
    		}
    	}); //close $.ajax( 
	} //close condicion
	
	
    $('#mod_pago').change(function(){ 
    //obtengo el valor del combo
    var valor_mod = $('#mod_pago').attr('value');
    var valor_cc = $('#id_cc').attr('value');
    var valor_a = $('#id_a').attr('value');
    
        if(valor_mod > 0){
            if(valor_mod > 1){
            	$.ajax({
                    method: "get",url: "./inc_php/ajax_php.php", data:"mod_pago="+valor_mod+"&id_calendario="+valor_cc+"&id_alumno="+valor_a,
            		beforeSend: function(){$("#loading").show("fast");}, 
            		complete: function(){ $("#loading").hide("fast");},
            		success: function(html){
                        $("#fechas_pago").html(html); 
            		}
            	}); //close $.ajax(
            }else{
                $("#fechas_pago").html('');
            } //close if 2 
        }; //close if 1
    }); //close function
}); //close ready
