<?php header("Content-type: text/html; charset=utf-8"); ?>

<style>
.guardar{
	background-image:url(<?php  echo $this->htmlHead()->img();?>/cms/icons/diskette.png)!important;
	width:80px !important;
	height:26px !important;
}
<style>
.blue-row .x-grid3-cell-inner{
background-color:blue;
}
.red-row .x-grid3-cell-inner{
background-color:#EAEAEA;
}
.green-row .x-grid3-cell-inner{
background-color:#FDF2AB;
}

.marcaError{
background-color: #D25F2C;
border : 1px solid black;
}

.marcaBloque{
	border:1px solid red;
	box-shadow: 2px 2px 5px #999;
}

</style>
<form name="form1" id="form1" method="POST">
	<input type="hidden" value="<?php echo $this->nemo;?>" id="NEMO">
	<input type="hidden" value="<?php echo $this->cursocod;?>" name="CURSOCODE" id="CURSOCODE"/>
	<input type="hidden" value="<?php echo $this->pericod;?>" name="BIMECOD" id="BIMECOD"/>
	<input type="hidden" value="<?php echo $this->unicod;?>" name="UNICOD" id="UNICOD"/>
	<input type="hidden" value="<?php echo $this->instru;?>" name="INSTRUCOD" id="INSTRUCOD"/>
	<div style="width:430px;float:left;">
    <!--<div id="cerrarMODAL" style="background-color:#C30">cerrar</div>-->
		<div class="fila" >
			<p style="width:60px;">
			Salón: 
			</p>		  
		  	<input readonly="readonly" type="text" value="<?php echo $this->nemo;?>" style="width: 100px; margin-right: 15px;">  		
		    <p style="width:60px;">
		  		Año:
		    </p>
		   <input readonly="readonly" type="text" value="<?php echo $this->ano;?>" style="width: 100px; margin-right: 15px;">  
	   	</div>
	   	<div class="fila">
	   		<p style="width:60px;">
		  		Nivel: 
		  	</p>
		  	 <input readonly="readonly" type="text" value="<?php echo $this->instrucod;?>" style="width: 100px; margin-right: 15px;">  		  
		  	<p style="width:60px;">
		  		Turno: 
		  	</p>
		  	<input readonly="readonly" type="text" value="<?php echo $this->turno;?>" style="width: 100px; margin-right: 15px;">  
		  	
	   	</div>
	   	<div class="fila">
	   		<p style="width:60px;">
		  		Grado: 
		  	</p>
		    <input readonly="readonly" type="text" value="<?php echo $this->gradoc;?>" style="width: 100px; margin-right: 15px;">  
		  				  	
		  	<p style="width:60px;">
		  		Sección: 
		  	</p>
		  	<input readonly="readonly"  type="text"  value="<?php echo $this->seccion;?>" style="width: 100px; margin-right: 15px;">  
		  			  	
	   	</div>
	   <div class="fila">
	   		<p style="width:60px;">
		  		Curso: 
		  	</p>
		  	<input readonly="readonly" type="text" value="<?php echo $this->curso;?>" style="width: 100px; margin-right: 15px;">
		  		
		  	<p style="width:60px;">
		  		Periodo: 
		  	</p>
		  		<input readonly="readonly" type="text" value="<?php echo $this->periodo;?>" style="width: 100px; margin-right: 15px;">
	   	</div>
	</div>

	<div id="mensaje" style="text-align:center;clear: both;height: 28px;margin: 4px;width: 250px;float: left;"></div>
	<div style="float: right;margin: 5px;">
		<img src="<?php  echo $this->htmlHead()->img();?>/cms/icons/diskette.png" style="cursor: pointer;" onclick="savecrit()" />
	</div>	
<div id="grilla_b" style="height:275px; overflow: scroll; clear: both;border: 1px solid #D6DFE9;">
	
	<?php
		$i=1;$j=1; $namet = ''; $cantadi = 6; $visible = '';//for default;

			$namet = 'Competencias'; $namec = '*'; $namesp = 'Califica'; $cantadi = 3; $visible = 'visibility:hidden;';
			//default: $namet = 'CRITERIO'; $namec = 'Evaluaci&oacuten'; $namesp = 'Cap. espec&iacute;fica'; break;

		foreach($this->data as $value){ ?>
			<div id="divfila_<?=$j?>"  style="float: left;width: 1500px;border: 1px solid #D6DFE9;background-color: #fafafa;">
				<div class="fila" style="height: 2px;">&nbsp;</div>
				<div class="fila" style="background-color: #ebe0e0;height: 25px;">
					<p style="width: 100px;margin-left: 5px;font-size: 12px;color: #811d12;"><b><?php echo $namet.' '.$j;?></b></p>
						<input type="hidden" name="<?php echo 'c'.$j.'critcod';?>" id="critcod"  value="<?php echo $value['critcod'];?>" />
						<input type="text" name="<?php echo 'c'.$j.'critpeso';?>" id="critpeso" style="width:30px;" value="<?php echo $value['critpeso'];?>" onkeypress="return validarNumerosFer(event);" maxlength="2" readonly/>
						<input type="text" name="<?php echo 'c'.$j.'critdes';?>" id="critdes" style="width:376px;" value="<?php echo $value['critdes'];?>" readonly />
						<input type="text" name="<?php echo $j.'_compet';?>" id="compet" style="width:450px;" value="" readonly />
				</div>
				<div class="fila" style="background-color: #b4bec3;height: 25px;"><p style="width: 150px;margin-left: 5px;margin-right:15px;color: #811d12;"><b>Desempeños :</b></p>
					<!--<p style="color:#FFF;width: 204px;height:18px; margin-left: 20px;text-align: center;border: 1px solid #FFF;"><b><?php //echo $namec; ?> 1</b></p>
					<p style="color:#FFF;width: 204px;height:18px; margin-left: 20px;text-align: center;border: 1px solid #FFF;"><b><?php //echo $namec; ?> 2</b></p>
					<p style="color:#FFF;width: 204px;height:18px; margin-left: 20px;text-align: center;border: 1px solid #FFF;"><b><?php //echo $namec; ?> 3</b></p>
					<p style="color:#FFF;width: 204px;height:18px; margin-left: 20px;text-align: center;border: 1px solid #FFF;"><b><?php //echo $namec; ?> 4</b></p>
					<p style="color:#FFF;width: 204px;height:18px; margin-left: 20px;text-align: center;border: 1px solid #FFF;"><b><?php //echo $namec; ?> 5</b></p>
					<p style="color:#FFF;width: 204px;height:18px; margin-left: 20px;text-align: center;border: 1px solid #FFF;"><b><?php //echo $namec; ?> 6</b></p>-->
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_1';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_2';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_3';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_4';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_5';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_6';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_7';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_8';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_9';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_10';?>" id="desempenios" style="width:100px;" value=""  />
					<input type="text" name="<?php echo 'desenpenio_'.$j.'_11';?>" id="desempenios" style="width:100px;" value=""  />
				</div>
				<!-- <div class="fila"><p style="width: 78px;margin-left: 10px;color: #811d12;"><b><?php //echo $namec; ?></b></p></div>-->
				<div class="fila" style="display:none;">
				<?php 		
					$k=1;
					/*echo "<pre>";
					print_r($value);
					echo "</pre>";
					exit;*/
					foreach($value as $indiceone=>$valueone){
						
						if(array_key_exists('eval'.$k.'des',$value)){
							//echo "aqui"; exit;
							$selp="";$sels="";$dis="";$hidden="";	
								//if($value['eval'.$k.'cal']=='P'){
									$selp="selected";
								/*}
								if($value['eval'.$k.'cal']=='S'){
									$sels="selected";
								}
								if($value['eval'.$k.'peso']==""){
									$dis="disabled";
									$hidden="<input type=hidden name='c".$j."eval".$k."cal' value=''>";
								}else{
									$dis="";
									$hidden="";
								}*/

							if(CcolCod!='0077'){		
					?>		 				
						<p style="width: 100px;margin-left: 20px; display:none;"><b><?php echo $namesp.' '.$k;?></b></p>
							<select name="<?php echo 'c'.$j.'eval'.$k.'cal';?>" id="<?php echo 'eval'.$k.'cal';?> " <?php echo $dis;?> style="width: 120px;display:none;">
								<option value="P" <?php echo $selp;?> >Promedio</option>
							
							</select>
							<?php echo $hidden;?>							
					<?php
							}else{
								echo "<input type=hidden name='c".$j."eval".$k."cal' value='".$value['eval'.$k.'cal']."'>";
							}
						}
						$k++;
					}
					?>
				</div>
				<!-- <div class="fila">
					<p style="width: 100%;margin-left: 14px;color: #811d12;">
						<b>Instrumento evaluación</b>
					</p>
				</div> -->
				
				<?php 
					$r=1;
					foreach($value as $indiceone=>$valueone){
				
						if(array_key_exists('eval'.$r.'des',$value)){
							echo '	<div class="fila" ><div style="float:left; margin-left:10px; width:100px; margin-right:10px;"><b>Sit. Evaluacion '.$r.' </b></div>';
				?>
								<div style='float:left;'>
										<p>
										<!-- destrezas -->
											<input type="text" name="<?php echo 'c'.$j.'eval'.$r.'peso';?>" id="<?php echo 'eval'.$r.'peso';?>"  readonly="readonly" value="<?php echo $value['eval'.$r.'peso'];?>" style="width:30px;background-color: yellow;" >
		<!-- onkeyup="validDestresa(<?=$j?>,<?=$r?>,this.value,this.id);" -->
										</p>
										<p style="padding-right: 20px;">
											<input type="text" <?= ($this->tipcod=='A')?'':'readonly="readonly"'?>   name="<?php echo 'c'.$j.'eval'.$r.'des';?>"  id="<?php echo 'eval'.$r.'des';?>" tflag="<?=(!empty($value['eval'.$r.'des']))?1:0 ?>" value="<?php echo $value['eval'.$r.'des'];?>" class="<?='eval'.$r.'des'?>"  style="width:150px;background-color: transparent;">
										</p>
							</div>
													
				<?php 				
						echo '	</div >';				
						}
					
						$r++;
					}
				?>
				
				<div class="fila" style="border-top: 1px solid #b4bec3;"></div>

				<div id="divgrupo_<?=$j?>" style="display:none;" >				
				<?php 		
					$q=1;
					foreach($value as $indiceone=>$valueone){
				
						if(array_key_exists('eval'.$q.'des',$value)){
							//if($q<=$cantadi){
				?>
							<div class="fila" >
								<p style="width: 68px;margin-left: 29px;"><?//="Fila :".$j?></p>
								<p style="width: 10px;color: #000"><b><?php echo $q;?></b></td>
								<p><input type="text" style="width:30px;background-color:#F9FF9A;"  name="<?php echo 'c'.$j.'ev1'.$q.'pes';?>"   id="<?php echo 'c'.$j.'ev1'.$q.'pes';?>" value="<?php echo $value['ev1'.$q.'pes'];?>" maxlength="2" onKeyPress="return soloNumeros(event)"   ></p>
								<p style="padding-right: 20px;"><input type="text" style="width:150px;" name="<?php echo 'c'.$j.'ev1'.$q.'des';?>" tcarga="<?=(!empty($value['ev1'.$q.'des']))?1:0 ?>" id="<?php echo 'c'.$j.'ev1'.$q.'des';?>" value="<?php echo $value['ev1'.$q.'des'];?>" ></p>
								<p><input type="text" style="width:30px;background-color:#F9FF9A;"  name="<?php echo 'c'.$j.'ev2'.$q.'pes';?>" id="<?php echo 'c'.$j.'ev2'.$q.'pes';?>" value="<?php echo $value['ev2'.$q.'pes'];?>" maxlength="2" onKeyPress="return soloNumeros(event)"  ></p>
								<p style="padding-right: 20px;"><input type="text" style="width:150px;" name="<?php echo 'c'.$j.'ev2'.$q.'des';?>" tcarga="<?=(!empty($value['ev2'.$q.'des']))?1:0 ?>" id="<?php echo 'c'.$j.'ev2'.$q.'des';?>" value="<?php echo $value['ev2'.$q.'des'];?>"></p>
								<p><input type="text" style="width:30px;background-color:#F9FF9A;"  name="<?php echo 'c'.$j.'ev3'.$q.'pes';?>"  id="<?php echo 'c'.$j.'ev3'.$q.'pes';?>" value="<?php echo $value['ev3'.$q.'pes'];?>" maxlength="2" onKeyPress="return soloNumeros(event)"  ></p>
								<p style="padding-right: 20px;"><input type="text" style="width:150px;" name="<?php echo 'c'.$j.'ev3'.$q.'des';?>" tcarga="<?=(!empty($value['ev3'.$q.'des']))?1:0 ?>" id="<?php echo 'c'.$j.'ev3'.$q.'des';?>" value="<?php echo $value['ev3'.$q.'des'];?>"></p>
								<p><input type="text" style="width:30px;background-color:#F9FF9A;"  name="<?php echo 'c'.$j.'ev4'.$q.'pes';?>"  id="<?php echo 'c'.$j.'ev4'.$q.'pes';?>" value="<?php echo $value['ev4'.$q.'pes'];?>" maxlength="2" onKeyPress="return soloNumeros(event)"  ></p>
								<p style="padding-right: 20px;"><input type="text" style="width:150px;" name="<?php echo 'c'.$j.'ev4'.$q.'des';?>" tcarga="<?=(!empty($value['ev4'.$q.'des']))?1:0 ?>" id="<?php echo 'c'.$j.'ev4'.$q.'des';?>" value="<?php echo $value['ev4'.$q.'des'];?>"></p>
								<p><input type="text" style="width:30px;background-color:#F9FF9A;"  name="<?php echo 'c'.$j.'ev5'.$q.'pes';?>"  id="<?php echo 'c'.$j.'ev5'.$q.'pes';?>" value="<?php echo $value['ev5'.$q.'pes'];?>" maxlength="2" onKeyPress="return soloNumeros(event)"  ></p>
								<p style="padding-right: 20px;"><input type="text" style="width:150px;" name="<?php echo 'c'.$j.'ev5'.$q.'des';?>" tcarga="<?=(!empty($value['ev5'.$q.'des']))?1:0 ?>" id="<?php echo 'c'.$j.'ev5'.$q.'des';?>" value="<?php echo $value['ev5'.$q.'des'];?>"></p>
								<p><input type="text" style="width:30px;background-color:#F9FF9A;"  name="<?php echo 'c'.$j.'ev6'.$q.'pes';?>"  id="<?php echo 'c'.$j.'ev6'.$q.'pes';?>" value="<?php echo $value['ev6'.$q.'pes'];?>" maxlength="2" onKeyPress="return soloNumeros(event)"  ></p>
								<p style="padding-right: 20px;"><input type="text" style="width:150px;" name="<?php echo 'c'.$j.'ev6'.$q.'des';?>" tcarga="<?=(!empty($value['ev6'.$q.'des']))?1:0 ?>" id="<?php echo 'c'.$j.'ev6'.$q.'des';?>" value="<?php echo $value['ev6'.$q.'des'];?>"></p>
							</div>
							
				<?php 
							//}
						}
						$q++;
					}		 
				$j++;
				?>
				</div>
			<div class="fila"><p>&nbsp;</p></div>	
			</div>
		<?php 
		}
	?>
	
</div>
</form>
<script>

function soloNumeros(e){
	var key = window.Event ? e.which : e.keyCode
	return (key >= 48 && key <= 57)
}


$(document).ready(function(){
	if($.trim($('input:text[name=c1critdes]').val())=="Actitud ante el Área")
		$("#divfila_1 :input").attr("disabled", "disabled");
	if($.trim($('input:text[name=c2critdes]').val())=="Actitud ante el Área")
		$("#divfila_2 :input").attr("disabled", "disabled");
	if($.trim($('input:text[name=c3critdes]').val())=="Actitud ante el Área")
		$("#divfila_3 :input").attr("disabled", "disabled");
	if($.trim($('input:text[name=c4critdes]').val())=="Actitud ante el Área")
		$("#divfila_4 :input").attr("disabled", "disabled");
	if($.trim($('input:text[name=c5critdes]').val())=="Actitud ante el Área")
		$("#divfila_5 :input").attr("disabled", "disabled");
	if($.trim($('input:text[name=c6critdes]').val())=="Actitud ante el Área")
		$("#divfila_6 :input").attr("disabled", "disabled");
	if($.trim($('input:text[name=c7critdes]').val())=="Actitud ante el Área")
		$("#divfila_7 :input").attr("disabled", "disabled");
	if($.trim($('input:text[name=c8critdes]').val())=="Actitud ante el Área")
		$("#divfila_8 :input").attr("disabled", "disabled");									
});
/*
function disableselect(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
*/
function validarNumerosFer(evt){	
	var charCode = (evt.which) ? evt.which : evt.keyCode;
			//alert(charCode);
			if ((charCode >= 97 && charCode <= 122) || (charCode >= 65 && charCode <= 90)){
				return false;
			}
}
$(document).ready(function() {
	
});
function val_evdesc(f,a,b){	
	var evpes=$('#c'+f+'ev'+a+b+'pes').val();
	if(evpes==""){
		$('#c'+f+'ev'+a+b+'des').attr("readonly",true);
		$('#c'+f+'ev'+a+b+'des').attr("value","");
	}else{		
		$('#c'+f+'ev'+a+b+'des').attr("readonly",false);		
	}
}

function validDestresa(x,y,val,id){
	var tcarga = $("#"+id).attr("tflag");
	if(tcarga=='1'){  
		var data = val; var cont=0;
		for(iDh=1;iDh<=6;iDh++){
			var campo2 = 'c'+x+'ev'+y+iDh+'des';
			var field = $("input[id="+campo2+"]").val();
			if($.trim(field)==''){  
				cont++;
			}
		}
		if(cont>0){
			alert("No puede eliminar la Competencias, tiene que eliminar primero sus Indicadores.")
			$("#"+id).val(data);
		}
	}
}

function savecrit(){
//alert(document.getElementsByName("c1eval1des")[0].value);
//alert($("input[name='c1eval1des']").val());
//for(iCv=1;iCv<=5;iCv++){
//c1critdes
  /*if($("c1critdes").val()==''){
   alert("Tiene que Ingresar el valor de la Capacidad");
   $("c"+iCv+"critdes").focus();
   return false;
  }*/
	var contBloque = 0;
	for(i=1;i<=9;i++){
		var total = 0
    $("#divgrupo_"+i).find(':input').each(function (){ 
    	var elemento= this;
    	var vid = elemento.id;
    	if(vid.indexOf('pes')!=-1) {
    		//alert("ID : "+elemento.id+" Valor : " + elemento.value); 
    		total += (elemento.value!='')?parseInt(elemento.value):0;
    	}
    });   			
    if(total>20) {
    	contBloque +=1;
    	$("#divgrupo_"+i).addClass("marcaBloque");
    } else {
    	$("#divgrupo_"+i).removeClass("marcaBloque");
    }
	}
	if(contBloque>0){
		alert('LA SUMA TOTAL DE PESOS DE LA COMPETENCIA NO PUEDE EXCEDER DE 20 PUNTOS.\NCORREGIR LOS CUADROS REMARCADOS EN ROJO.');
	return false;
	}


var cantador =0; 
for(iDv=1;iDv<=6;iDv++){
	var campo = 'eval'+iDv+'des';
	var bloq =0;
	// ------------ recorro las destrezas en forma vertical -----------------------------
	$('.'+campo).each(function(){
	bloq ++;
	var val  = $(this).attr('value');
	var tcarga = $(this).attr("tflag");
	if($.trim(val)=='' /*&& tcarga=='1'*/){
	// ---- validando si tiene indicadores vacios los indicadores internos de la destreza 	
	  //for(iDvx=1;iDvx<=5;iDvx++){
	  	var cantErr =0;
	    for(iDh=1;iDh<=6;iDh++){
	      var campo = 'c'+bloq+'ev'+iDv+iDh+'des';
	      if($.trim($("input[name="+campo+"]").val())!=''){ 
			cantErr ++; 
	      }
	  	}
	  //}
	 // ---------------------------------------------------------------------------------
	  if(cantErr>0){
	  	$(this).addClass("marcaError");
	  	cantador++;
	  } else {
		$(this).removeClass("marcaError");	
	  }
		
	} else {
		$(this).removeClass("marcaError");	
	}
	});
}
if(cantador>0){
	alert("Tiene que Ingresar la Descripcion de las Capacidad que tienen indicadores registrados.");
	return false;
}

  iniCrit:
  for(iDv=1;iDv<=5;iDv++){
  	flg=0;  var arraIndicador = new Array(); var i=0; arrError = new Array();
    for(iDh=1;iDh<=6;iDh++){
      var campo = 'c'+iDv+'eval'+iDh+'des';
      if($.trim($("input[name="+campo+"]").val())!=''){ 
          
          for(iDi=1;iDi<=6;iDi++){
              var campo2 = 'c'+iDv+'ev'+iDh+iDi+'des'; //c1ev11des -- n1e6a10
              var campoField = 'n'+iDv+'e'+iDh+"a"+iDi; 
              var tcarga = $("input[id="+campo2+"]").attr("tcarga");
              var field = $("input[id="+campo2+"]").val();
               //alert(tcarga + "**" + xx );
              if($.trim(field)=='' && tcarga=='1'){  
                 arraIndicador[i]=campo2+"::"+campoField;
                 arrError[i]=" Destreza : "+iDh+" Indicador :"+iDv ;
                 //alert("===>>>"+arraIndicador[i]);
                 i++;
              }
          }

      }
    }

			//alert("Longitud :"+arraIndicador.length);
          if(arraIndicador.length>0){
			flg=1;
           //alert("No puede borrar las descripciones de los indicadores de la Destreza:"+iDh+" Capacidad:"+iDv+"\n Por que hay Notas registradas.");
           //$("input[id="+campo2+"]").focus();
           break iniCrit;
          }

  }

  if(flg==1){ //alert('1');
//alert(arraIndicador.toString());
//var datosJSON = JSON.stringify(arraIndicador);
var g;
/*var s="c1ev21des: 'c1ev21des',c1ev22des: 'c1ev22des'";
var xxx = eval("g = {"+s+"}");*/

        var cadHtml = '';
        for(x=0;x<arraIndicador.length;x++){
        	var parteInd = arraIndicador[x].split("::");
			cadHtml +=  parteInd[0] +": '"+arraIndicador[x]+"'," ;
        }

		cadHtml += " nemo  : '"+ $("#NEMO").val()+"'," ;
		cadHtml += " cursocod  : '"+ $("#CURSOCODE").val()+"'," ;
		cadHtml += " bimecod  : '"+ $("#BIMECOD").val()+"'," ;
		cadHtml += " unicod  : '"+ $("#UNICOD").val()+"'," ;
		cadHtml += " instrucod  : '"+ $("#INSTRUCOD").val()+"'," ;

        cadHtml = cadHtml.substring(0,cadHtml.length-1);
        var dataJSON = eval("g = {"+cadHtml+"}");
	var marc =0;
  	$.ajax({
	   type: "POST",
           dataType: "json",
	   data: dataJSON,	
	   url:"/academico/definition-criterio-peso-tres-niveles/verifica",
	   beforeSend:inicioValida,
	   success: function(json){
	   	 $('#mensaje').hide();
	   	 var dataJson =json['errores'].length; 
	   	 if(dataJson>0){
	   	 	 $('input').removeClass('marcaError');
	   	 	 
		   	 $.each(json['errores'], function(index, value){
		   	 	//alert(index+"::"+value.tres+" => "+value.campo);
		   	 	if(value.tres>0){
		   	 		$("#"+value.campo).addClass("marcaError");
		   	 		marc=1; //alert('2');
             	}
		   	 	else {
		   	 		$("#"+value.campo).removeClass("marcaError");	
		   	 		//return true; 	 
		   	 		//alert('3');  	 	
		   	 	}
		   	 });

		 
		   	if(marc==1){
		   	 		alert("No Puede Borrar los Indicadores marcados por que tienen notas registradas.");
             		//return false;
             } else {
					envioAjax();
             }

	     } else { envioAjax();}
	   }
	});
  } else {
    envioAjax();
   }

//}
//alert(marc);

		   /*	if(marc==1){
		   	 		alert("No Puede Borrar los Indicadores marcados por que tienen notas registradas.");
      				return false;
            } else { alert('ok');*/
				   /* var form=$('#form1').serialize();
				    $.ajax({
				 	   async:true,
				 	   type: "POST",
				 	   dataType: "html",
				 	   contentType: "application/x-www-form-urlencoded",
				 	   url:"/academico/definition-criterio-peso-tres-niveles/storecrit/caso/2/nemo/<?php echo $this->nemo;?>/bimecod/<?php echo $this->pericod;?>/cursocod/<?php echo $this->cursocod;?>/",
				 	   data:form,
				 	   beforeSend:inicioCriterio,
				 	   success:llegadaCriterio,
				 	   timeout:4000
				 	});          */  	
           /* }*/
}

function envioAjax(){
					var form=$('#form1').serialize();
				    $.ajax({
				 	   async:true,
				 	   type: "POST",
				 	   dataType: "html",
				 	   contentType: "application/x-www-form-urlencoded",
				 	   url:"/academico/definition-criterio-peso-tres-niveles/storecrit/caso/2/nemo/<?php echo $this->nemo;?>/unicod/<?php echo $this->unicod;?>/bimecod/<?php echo $this->pericod;?>/cursocod/<?php echo $this->cursocod;?>/",
				 	   data:form,
				 	   beforeSend:inicioCriterio,
				 	   success:llegadaCriterio,
				 	   timeout:4000
				 	}); 
}

function savecrit2(){

var resPrueba = verificaCampoIndicadores();

alert("Fin : "+resPrueba); //return false;

if(resPrueba){
    var form=$('#form1').serialize();
    $.ajax({
 	   async:true,
 	   type: "POST",
 	   dataType: "html",
 	   contentType: "application/x-www-form-urlencoded",
 	   url:"/academico/definition-criterio-peso-tres-niveles/storecrit/caso/2/nemo/<?php echo $this->nemo;?>/bimecod/<?php echo $this->pericod;?>/unicod/<?php echo $this->unicod;?>/cursocod/<?php echo $this->cursocod;?>/",
 	   data:form,
 	   beforeSend:inicioCriterio,
 	   success:llegadaCriterio,
 	   timeout:4000
 	});
}

}

function inicioCriterio(){
	$('#mensaje').show();
	$('#mensaje').html('<img src="<?php  echo $this->htmlHead()->img();?>/cms/cargando.gif" />');
}
 
 function inicioValida(){
 	$('#mensaje').show();
	$('#mensaje').html('<img src="<?php  echo $this->htmlHead()->img();?>/cms/cargando.gif" /><b> Validando indicadores....</b>');
}

function llegadaCriterio(datos){
	$('#mensaje').html(datos); 
	setTimeout("$('#dialog-modal').remove();",2000); 
	jalar_grid_nota_standar('san-jose');
}
</script>	
			
<?php echo $this->script;
echo $this->scriptdiferente;?>