<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html lang="es">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<title>:::SISTEMA DE ANIVERSARIO:::</title>

		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
                
                
                
		<link rel="stylesheet" href="../assets/css/bootstrap.css" />
		<link rel="stylesheet" href="../assets/css/font-awesome.css" />
                <link rel="stylesheet" href="../assets/css/jquery-ui.css" />
		<link rel="stylesheet" href="../assets/css/ace-fonts.css" />
                
		<link rel="stylesheet" href="../assets/css/ace.css" class="ace-main-stylesheet" id="main-ace-style" />
		<script src="../assets/js/ace-extra.js"></script>
                <link rel="stylesheet" href="../assets/css/chosen.css" />
                
                <link href="../reloj/compiled/flipclock.css" rel="stylesheet" type="text/css"/>
                
		<!--<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>-->
                
                
                
		
	</head>

	<body class="login-layout blur-login" onload="cargar();" style=" background-repeat: no-repeat; background-attachment: fixed;">
		<!-- #section:basics/navbar.layout -->
		

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">
			

			<!-- #section:basics/sidebar -->
			

			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="row">
					<div class="col-sm-10 col-sm-offset-1">
						<div >
							<div class="center">
								<h1>
                                                                    <i class="ace-icon fa fa-clock-o  green"></i>
                                                                    <span class="red">Sistema de </span>
                                                                    <span class="white" id="id-text2"> Asistencias Aniversario 2015</span>
                                                                    <input style="opacity: 0" type="checkbox" id="temporal">
								</h1>
                                                        </div>
                                                </div>
						<div class="login-container">
							<div class="center">
                                                            <input type='hidden' id="control" value="m">
                                                            <input type='hidden' id="busquedaReporte" value="todo">
                                                            <div id="DivReloj" class="clock" style="margin:2em;"></div>
                                                        </div>
                                                    
                                                    
							<div class="space-6"></div>

							<div class="position-relative">
                                                            <div id='divMarcacion'>
                                                                <center>
                                                                    <input id='tipo' type='hidden' value='m'>
                                                                    <table border='1' style='width: 100%;'>
                                                                        <tr>
                                                                            <td>
                                                                                <input id='busqueda' type='text' class='form-control' style='border-radius: 5px; border-color: grey;' placeholder='Marcación con fotocheck, dni y apellidos' onkeypress='enter(event);'>
                                                                            </td>
                                                                            <td style='width: 35px; text-align: right;' align='center'>
                                                                                <span id='tipoBusqueda'>
                                                                                    <a href='javascript:irReporte();' title='Cambiar a reporte'><i class='fa fa-credit-card white bigger-200 '></i></a>
                                                                                </span>
                                                                            </td>
                                                                            <td style='width: 35px; text-align: right;' align='center'>
                                                                                <span id='extras'>
                                                                                    <a href='javascript:extras();' title='Alimentación extra'><i class='fa fa-ticket white bigger-200 '></i></a>
                                                                                </span>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </center>
                                                            </div>
                                                            
							</div><!-- /.position-relative -->
						</div><br>
                                              
					</div><!-- /.col -->
				</div><!-- /.row -->
                                
                                <div class="col-sm-12" style="width:100%; height: 10px;"></div>
                                <div  class="col-sm-12" style="width:100%;">
                                    <div  class="col-sm-2"></div>
                                    <div  class="col-sm-8" style="color: #2c5976; ">
                                        
                                       
                                       <div class="login-box visible widget-box no-border " style='width:100%;' id="login-box">
                                            <div class="widget-body">
                                                <div class="widget-main">
											
                                                    <div id="divBusqueda" >
                                                        <center>
                                                            <h1>Bienvenidos al Aniversario 2015</h1>
                                                        </center>
                                                    </div>
                                                    
                                                    
                                                        <!--ALERTAS-->
                                                        
                                                        
                                                        <div id="dialog-quitarAsis" class="hide">
                                                            <br>
                                                                ¿Desea quitar el registro de marcación?
                                                            <br><br>
                                                        </div>
                                                        
                                                        <div id="dialog-quitarAlim" class="hide">
                                                            <br>
                                                                ¿Desea quitar el registro de alimentación?
                                                            <br><br>
                                                        </div>
                                                        
                                                        <div id="dialog-satisfaccion" class="hide">
                                                            <br>
                                                                Se realizó con éxito.
                                                            <br><br>
                                                        </div>
                                                        
                                                        <div id="dialog-extrasOk" class="hide">
                                                            <br>
                                                                Se realizó con éxito.
                                                            <br><br>
                                                        </div>
                                                        
                                                        <div id="dialog-extra" class="hide">
                                                            <br>
                                                            <div id='divExtra'>
        
                                                            </div>
                                                            <br><br>
                                                        </div>
                                                        
                                                       <!--ALERTAS--> 
                                                       
                                                        
                                                </div><!-- /.widget-main -->
                                            </div><!-- /.widget-body -->
                                        </div>
                                        
    
                                    </div>
                                    <div  class="col-sm-2"></div>
                                </div>
                                
                                <div id="divControl">
<!--                                    <a class='btn-scroll-up btn btn-sm btn-inverse display' id='btn-scroll-up' href='javascript:verReporteGeneral();'>
                                        <i class="fa fa-file-text-o white bigger-110 "></i> 
                                        REPORTES
                                    </a>-->
                                </div>
                                
                                
			</div><!-- /.main-content -->

			

			
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
                
                 
                
		<script type="text/javascript">
			window.jQuery || document.write("<script src='../assets/js/jquery.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->

		<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='../assets/js/jquery1x.js'>"+"<"+"/script>");
</script>
<![endif]-->
		<script type="text/javascript">
			if('ontouchstart' in document.documentElement) document.write("<script src='../assets/js/jquery.mobile.custom.js'>"+"<"+"/script>");
		</script>
                
                
                
		<script src="../assets/js/bootstrap.js"></script>

		<!-- page specific plugin scripts -->
<!--                 <script type="text/javascript" src="../assets/js/jquery-1.7.2.min.js"></script>-->
                <script src="../assets/js/jquery-ui.js"></script>
		<script src="../assets/js/jquery.ui.touch-punch.js"></script>
               
                 
		<!--[if lte IE 8]>
		  <script src="../assets/js/excanvas.js"></script>
		<![endif]-->
		<script src="../assets/js/jquery-ui.custom.js"></script>
		<script src="../assets/js/jquery.ui.touch-punch.js"></script>
		<script src="../assets/js/jquery.easypiechart.js"></script>
		<script src="../assets/js/jquery.sparkline.js"></script>
		<script src="../assets/js/flot/jquery.flot.js"></script>
		<script src="../assets/js/flot/jquery.flot.pie.js"></script>
		<script src="../assets/js/flot/jquery.flot.resize.js"></script>
                <script src="../assets/js/bootstrap-tag.js"></script>

		<!-- ace scripts -->
		<script src="../assets/js/ace/elements.scroller.js"></script>
		<script src="../assets/js/ace/elements.colorpicker.js"></script>
		<script src="../assets/js/ace/elements.fileinput.js"></script>
		<script src="../assets/js/ace/elements.typeahead.js"></script>
		<script src="../assets/js/ace/elements.wysiwyg.js"></script>
		<script src="../assets/js/ace/elements.spinner.js"></script>
		<script src="../assets/js/ace/elements.treeview.js"></script>
		<script src="../assets/js/ace/elements.wizard.js"></script>
		<script src="../assets/js/ace/elements.aside.js"></script>
		<script src="../assets/js/ace/ace.js"></script>
		<script src="../assets/js/ace/ace.ajax-content.js"></script>
		<script src="../assets/js/ace/ace.touch-drag.js"></script>
		<script src="../assets/js/ace/ace.sidebar.js"></script>
		<script src="../assets/js/ace/ace.sidebar-scroll-1.js"></script>
		<script src="../assets/js/ace/ace.submenu-hover.js"></script>
		<script src="../assets/js/ace/ace.widget-box.js"></script>
		<script src="../assets/js/ace/ace.settings.js"></script>
		<script src="../assets/js/ace/ace.settings-rtl.js"></script>
		<script src="../assets/js/ace/ace.settings-skin.js"></script>
		<script src="../assets/js/ace/ace.widget-on-reload.js"></script>
		<script src="../assets/js/ace/ace.searchbox-autocomplete.js"></script>
                
                
               
                <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
                <!--<link rel="stylesheet" href="css/template.css" type="text/css"/>-->
                
                
		<!-- inline scripts related to this page -->
		<script type="text/javascript">
                        
			jQuery(function($) 
                        {
                            $.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
					_title: function(title) {
						var $title = this.options.title || '&nbsp;'
						if( ("title_html" in this.options) && this.options.title_html == true )
							title.html($title);
						else title.text($title);
					}
				}));
                                
                            var tag_input = $('#form-field-tags');
				try{
					tag_input.tag(
					  {
						placeholder:tag_input.attr('placeholder'),
						//enable typeahead by specifying the source array
                                                //var cadena = "dsd,dsds,dsdaaaasd,ssss";
                                                //var array = {"ddd","fff"};
						//source: array //["Fernando","Wilmer"] //["yotube","google","facebook"]//ace.vars['US_STATES'],//defined in ace.js >> ace.enable_search_ahead
						
						//or fetch data from database, fetch those that match "query"
                                                
                                                
						source: function(query, process) {
						  //$.ajax({url: 'remote_source.php?q='+encodeURIComponent(query)})
						  $.ajax({
                                                            url: '../ServletAniversario?Accion=cargarTags',
                                                            data: 'query='+query,
                                                        })
						  .success(function(resultado){
                                                      var array = resultado.split("#");
							process(array);
						  });
						}
                                                
                                                
                                                
						
					  }
					)
			
					//programmatically add a new
					var $tag_obj = $('#form-field-tags').data('tag');
					$tag_obj.add('Programmatically Added');
				}
				catch(e) {
					//display a textarea for old IE, because it doesn't support this plugin or another one I tried!
					tag_input.after('<textarea id="'+tag_input.attr('id')+'" name="'+tag_input.attr('name')+'" rows="3">'+tag_input.val()+'</textarea>').remove();
					//$('#form-field-tags').autosize({append: "\n"});
				}
                                
                                
                                
                                
                                
                                $('.chosen-select').chosen({allow_single_deselect:true});
                                
                                $('[data-rel=tooltip]').tooltip();
				$('[data-rel=popover]').popover({html:true});
                                
				//override dialog's title function to allow for HTML titles
				
			
				
			
				
                                
				$('.easy-pie-chart.percentage').each(function(){
					var $box = $(this).closest('.infobox');
					var barColor = $(this).data('color') || (!$box.hasClass('infobox-dark') ? $box.css('color') : 'rgba(255,255,255,0.95)');
					var trackColor = barColor == 'rgba(255,255,255,0.95)' ? 'rgba(255,255,255,0.25)' : '#E2E2E2';
					var size = parseInt($(this).data('size')) || 50;
					$(this).easyPieChart({
						barColor: barColor,
						trackColor: trackColor,
						scaleColor: false,
						lineCap: 'butt',
						lineWidth: parseInt(size/10),
						animate: /msie\s*(8|7|6)/.test(navigator.userAgent.toLowerCase()) ? false : 1000,
						size: size
					});
				})
			
				$('.sparkline').each(function(){
					var $box = $(this).closest('.infobox');
					var barColor = !$box.hasClass('infobox-dark') ? $box.css('color') : '#FFF';
					$(this).sparkline('html',
                                                                    {
                                                                           tagValuesAttribute:'data-values',
                                                                           type: 'bar',
                                                                           barColor: barColor ,
                                                                           chartRangeMin:$(this).data('min') || 0
                                                                    });
				});
			
			
			  //flot chart resize plugin, somehow manipulates default browser resize event to optimize it!
			  //but sometimes it brings up errors with normal resize event handlers
			  $.resize.throttleWindow = false;
			
			  var placeholder = $('#piechart-placeholder').css({'width':'90%' , 'min-height':'150px'});
			  var data = [
				{ label: "social networks",  data: 38.7, color: "#68BC31"},
				{ label: "search engines",  data: 24.5, color: "#2091CF"},
				{ label: "ad campaigns",  data: 8.2, color: "#AF4E96"},
				{ label: "direct traffic",  data: 18.6, color: "#DA5430"},
				{ label: "other",  data: 10, color: "#FEE074"}
			  ]
			  function drawPieChart(placeholder, data, position) {
			 	  $.plot(placeholder, data, {
					series: {
						pie: {
							show: true,
							tilt:0.8,
							highlight: {
								opacity: 0.25
							},
							stroke: {
								color: '#fff',
								width: 2
							},
							startAngle: 2
						}
					},
					legend: {
						show: true,
						position: position || "ne", 
						labelBoxBorderColor: null,
						margin:[-30,15]
					}
					,
					grid: {
						hoverable: true,
						clickable: true
					}
				 })
			 }
			 drawPieChart(placeholder, data);
			
			 /**
			 we saved the drawing function and the data to redraw with different position later when switching to RTL mode dynamically
			 so that's not needed actually.
			 */
			 placeholder.data('chart', data);
			 placeholder.data('draw', drawPieChart);
			
			
			  //pie chart tooltip example
			  var $tooltip = $("<div class='tooltip top in'><div class='tooltip-inner'></div></div>").hide().appendTo('body');
			  var previousPoint = null;
			
			  placeholder.on('plothover', function (event, pos, item) {
				if(item) {
					if (previousPoint != item.seriesIndex) {
						previousPoint = item.seriesIndex;
						var tip = item.series['label'] + " : " + item.series['percent']+'%';
						$tooltip.show().children(0).text(tip);
					}
					$tooltip.css({top:pos.pageY + 10, left:pos.pageX + 10});
				} else {
					$tooltip.hide();
					previousPoint = null;
				}
				
			 });
			
				/////////////////////////////////////
				$(document).one('ajaxloadstart.page', function(e) {
					$tooltip.remove();
				});
			
			
			
			
				var d1 = [];
				for (var i = 0; i < Math.PI * 2; i += 0.5) {
					d1.push([i, Math.sin(i)]);
				}
			
				var d2 = [];
				for (var i = 0; i < Math.PI * 2; i += 0.5) {
					d2.push([i, Math.cos(i)]);
				}
			
				var d3 = [];
				for (var i = 0; i < Math.PI * 2; i += 0.2) {
					d3.push([i, Math.tan(i)]);
				}
				
			
				var sales_charts = $('#sales-charts').css({'width':'100%' , 'height':'220px'});
				$.plot("#sales-charts", [
					{ label: "Domains", data: d1 },
					{ label: "Hosting", data: d2 },
					{ label: "Services", data: d3 }
				], {
					hoverable: true,
					shadowSize: 0,
					series: {
						lines: { show: true },
						points: { show: true }
					},
					xaxis: {
						tickLength: 0
					},
					yaxis: {
						ticks: 10,
						min: -2,
						max: 2,
						tickDecimals: 3
					},
					grid: {
						backgroundColor: { colors: [ "#fff", "#fff" ] },
						borderWidth: 1,
						borderColor:'#555'
					}
				});
			
			
				$('#recent-box [data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('.tab-content')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					//var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			
			
				$('.dialogs,.comments').ace_scroll({
					size: 300
			    });
				
				
				//Android's default browser somehow is confused when tapping on label which will lead to dragging the task
				//so disable dragging when clicking on label
				var agent = navigator.userAgent.toLowerCase();
				if("ontouchstart" in document && /applewebkit/.test(agent) && /android/.test(agent))
				  $('#tasks').on('touchstart', function(e){
					var li = $(e.target).closest('#tasks li');
					if(li.length == 0)return;
					var label = li.find('label.inline').get(0);
					if(label == e.target || $.contains(label, e.target)) e.stopImmediatePropagation() ;
				});
			
				$('#tasks').sortable({
					opacity:0.8,
					revert:true,
					forceHelperSize:true,
					placeholder: 'draggable-placeholder',
					forcePlaceholderSize:true,
					tolerance:'pointer',
					stop: function( event, ui ) {
						//just for Chrome!!!! so that dropdowns on items don't appear below other items after being moved
						$(ui.item).css('z-index', 'auto');
					}
					}
				);
				$('#tasks').disableSelection();
				$('#tasks input:checkbox').removeAttr('checked').on('click', function(){
					if(this.checked) $(this).closest('li').addClass('selected');
					else $(this).closest('li').removeClass('selected');
				});
			
			
				//show the dropdowns on top or bottom depending on window height and menu position
				$('#task-tab .dropdown-hover').on('mouseenter', function(e) {
					var offset = $(this).offset();
			
					var $w = $(window)
					if (offset.top > $w.scrollTop() + $w.innerHeight() - 100) 
						$(this).addClass('dropup');
					else $(this).removeClass('dropup');
				});
                                
                                
                                
			
                        
                        
			});
                        
                    //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                    
                    
                    
                        
                        
                        
                        
                        //-------------------------------
                        
                        
                        
                    function cargar(){
                        reloj();
                        $("#tipo").val("m");
                        $("#tipoBusqueda").html("<a href='javascript:irReporte();' title='Cambiar a reporte'><i class='fa fa-credit-card white bigger-200 '></i></a>");
                        $("#busqueda").focus();
                        verMarcador();
                    }
                    
                    function reloj(){
                        var clock;
                        clock = $('.clock').FlipClock({
                                clockFace: 'TwelveHourClock'
                        });
                    }
                    
                    function tipoBusqueda(){
                        var tipo = $("#tipo").val();
                        var busqueda=$('#busqueda').val(); 
                        if(tipo=="m"){
                            consultarAsistencia(busqueda);
                        }else{
                            consultarReporte(busqueda);
                        }
                    }
                    
                    function consultarReporte(busqueda){
//                        var busqueda=$('#busqueda').val(); 
			  $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=consultarReporte',
                                data:'busqueda='+busqueda,
                                success:function(resultado){
                                    $('#divBusqueda').html(resultado);
                                },complete: function (){
                                    $("#busqueda").val(""); 
                              }
			  });  
                    }
                    
                    function consultarAsistencia(busqueda){
//			  var busqueda=$('#busqueda').val(); 
			  $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=consultarAsistencia',
                                data:'busqueda='+busqueda,
                                success:function(resultado){
                                    $('#divBusqueda').html(resultado);
                                },complete: function (){
                                    $("#busqueda").val(""); 
                              }
			  });  	
                    }
                    
                    
                    
                    function resgistrarAsistencia(codper){
			  var busqueda=codper; 
			  $.ajax({
				  type:'POST',
				  url:'../ServletAsistencia?accion=consultarAsistencia',
				  data:'busqueda='+busqueda,
				  success:function(resultado){
                                      $('#divBusqueda').html(resultado);
				  },complete: function (){
                                      $("#busqueda").val("");
                                      
				}
			  });  	
                    }
                    
                    
                    function verAsistencia(codAsis,codper,marcacion,alimentacion,apellidos,nombres){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=mostrarAsistencia',
                                data:'codper='+codper+'&marcacion='+marcacion+'&alimentacion='+alimentacion+'&apellidos='+apellidos+'&nombres='+nombres+'&codAsis='+codAsis,
                                success:function(resultado){
                                    $('#divBusqueda').html(resultado);
                                },complete: function (){
                                    var estAli = $("#estAli").val();
                                    if(estAli==-1){
                                        $("#busqueda").focus();
                                    }else{
                                        if(alimentacion==0){
                                            $("#temporal").focus();
                                        }else{
                                            $("#busqueda").focus();
                                        }
                                    }
                                        
                                        
//                                      $("#busqueda").val("");
//                                      $("#busqueda").focus();
                              }
                        });  	
                    }
                    
                    function registrarAlimento(codAsis,codper){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=registrarAlimento',
                                data:'codAsis='+codAsis+'&codper='+codper,
                                success:function(resultado){
                                    
                                    //$('#divBusqueda').html(resultado);
                                },complete: function (){
                                    resgistrarAsistencia(codper);
                            }
                        });
                    }
                    
                    
                    function refrescar(){
                        $('#divBusqueda').html("<center><h1>Bienvenidos al Aniversario 2015</h1></center>");
                    }
                    
                    function irReporte(){
                        var tipo = $("#tipo").val("r");
                        $("#tipoBusqueda").html("<a href='javascript:irMarcacion();' title='Cambiar a marcación'><i class='fa fa-file-text-o white bigger-200 '></i></a>");
                        $("#busqueda").val("");
                        $("#busqueda").focus();
                        $('#divBusqueda').html("<center><h1>Bienvenidos al Aniversario 2015</h1></center>");
                    }
                    
                    function irMarcacion(){
                        var tipo = $("#tipo").val("m");
                        $("#tipoBusqueda").html("<a href='javascript:irReporte();' title='Cambiar a reporte'><i class='fa fa-credit-card white bigger-200 '></i></a>");
                        $("#busqueda").val("");
                        $("#busqueda").focus();
                        $('#divBusqueda').html("<center><h1>Bienvenidos al Aniversario 2015</h1></center>");
                    }
                    
                    function popup_quitarAsis(codAsis,busqueda){
                        $( "#dialog-quitarAsis" ).removeClass('hide').dialog({
                            resizable: false,
                            width: 300,
                            modal: true,
                            title: "<div class='widget-color-blue' ><div class='widget-header white' ><h4 class='smaller' ><i class='ace-icon fa fa-check-circle white'></i> <span class='white'>Conformidad</span></h4></div></div>",
                            title_html: true,
                            buttons: [
                                {
                                    html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp; SI",
                                    "class" : "btn btn-primary btn-xs",
                                    click: function() {
                                        quitarAsis(codAsis,busqueda);
                                    }
                                },{
                                    html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; NO",
                                    "class" : "btn btn-danger btn-xs",
                                    click: function() {
                                        $( this ).dialog( "close" ); 
                                    }
                                }
                            ]
                        });
                    }
                    
                    
                    function quitarAsis(codAsis,busqueda){
                        $( "#dialog-quitarAsis" ).dialog( "close" );
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=quitarAsistencia',
                                data:'codAsis='+codAsis,
                                success:function(resultado){
                                    if(resultado==1){
                                        confirmacion();
                                    }
                                },complete: function (){
                                    consultarReporte(busqueda);
                                }
                        });
                    }
                    
                    function popup_quitarAlim(codAsis,busqueda){
                        $( "#dialog-quitarAlim" ).removeClass('hide').dialog({
                            resizable: false,
                            width: 300,
                            modal: true,
                            title: "<div class='widget-color-blue' ><div class='widget-header white' ><h4 class='smaller' ><i class='ace-icon fa fa-check-circle white'></i> <span class='white'>Conformidad</span></h4></div></div>",
                            title_html: true,
                            buttons: [
                                {
                                    html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp; SI",
                                    "class" : "btn btn-primary btn-xs",
                                    click: function() {
                                        quitarAlim(codAsis,busqueda);
                                    }
                                },{
                                    html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; NO",
                                    "class" : "btn btn-danger btn-xs",
                                    click: function() {
                                        $( this ).dialog( "close" ); 
                                    }
                                }
                            ]
                        });
                    }
                    
                    function quitarAlim(codAsis,busqueda){
                        $( "#dialog-quitarAlim" ).dialog( "close" );
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=quitarAlimentacion',
                                data:'codAsis='+codAsis,
                                success:function(resultado){
                                    if(resultado==1){
                                        confirmacion();
                                    }
                                },complete: function (){
                                    consultarReporte(busqueda);
                                }
                        });
                    }
                    
                    function confirmacion(){
                        $( "#dialog-satisfaccion" ).removeClass('hide').dialog({
                            resizable: false,
                            modal: true,
                            title: "<div class='widget-color-green' ><div class='widget-header white' ><h4 class='smaller' ><i class='ace-icon fa fa-tags white'></i> <span class='white'>Notificación</span></h4></div></div>",
                            title_html: true,
                            buttons: [
                                {
                                    html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp; ACEPTAR",
                                    "class" : "btn btn-success btn-xs",
                                    click: function() {
                                        $( this ).dialog( "close" );
                                    }
                                }
                            ]
                        });
                    }
                    
                    function verReporteGeneral(){
                        $("#busquedaReporte").val("todo");
                        $("#control").val("r");
                        $("#divBusqueda").html("");
                        $("#DivReloj").html("");
                        $("#divMarcacion").html("");
                        $("#divControl").html("<a class='btn-scroll-up btn btn-sm btn-inverse display' id='btn-scroll-up' href='javascript:verMarcador();'><i class='fa fa-file-text-o white bigger-110 '></i> VER MARCACIÓN</a>");
                        verReportesAniversario();
                        
                    }
                    
                    function verMarcador(){
                        $("#control").val("m");
                        $("#divMarcacion").html("<center><input id='tipo' type='hidden' value='m'><table border='0' style='width: 100%;'><tr><td><input id='busqueda' type='text' class='form-control' style='border-radius: 5px; border-color: grey;' placeholder='Marcación con fotocheck, dni y apellidos' onkeypress='enter(event);'></td><td style='width: 35px; text-align: right;' align='center'><span id='tipoBusqueda'><a href='javascript:irReporte();' title='Cambiar a reporte'><i class='fa fa-credit-card white bigger-200 '></i></a></span></td><td style='width: 35px; text-align: right;' align='center'><span id='extras'><a href='javascript:extras();' title='Alimetación extra'><i class='fa fa-ticket white bigger-200 '></i></a></span></td></tr></table></center>");
                        $("#divControl").html("<a class='btn-scroll-up btn btn-sm btn-inverse display' id='btn-scroll-up' href='javascript:verReporteGeneral();'><i class='fa fa-file-text-o white bigger-110 '></i> REPORTES</a>");
                        reloj();
                        $('#divBusqueda').html("<center><h1>Bienvenidos al Aniversario 2015</h1></center>");
                        $("#busqueda").focus();
                        
                    }
                    
                    
                    function verReportesAniversario(){
                        $.ajax({
                            type:'POST',
                            url:'../ServletAsistencia?accion=verReportes',
                            data: null,
                            success:function(resultado){
                                $("#divBusqueda").html(resultado)
                            },complete: function (){
                                listarReporteGeneral(1);
                            }
                        });
                    }
                    
                    
                    
                    function listarReporteGeneral(pagina){
                        var cantidad = 10;
                        var busqueda = $("#busquedaReporte").val(); // INICIA CON VALOR "todo";
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=listarReporteGeneral',
                                data:'busqueda='+busqueda+'&cantidad='+cantidad+'&pagina='+pagina,
                                success:function(resultado){
                                    $("#divReporteAsistencia").html(resultado)
                                },complete: function (){
                                    AsistenciaPorComision();
                                }
                        });
                    }
                    
                    function busquedaPersonal(){
                        var busqueda = "todo"; // INICIA CON VALOR "todo";
                        var nombre = 'cmbPer';
                        var Accion = 'buscarPersona();';
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=filtroPersonalReg',
                                data:'busqueda='+busqueda+'&nombre='+nombre+'&Accion='+Accion,
                                success:function(resultado){
                                    $("#ap").html(resultado)
                                },complete: function (){
                                    $('.chosen-select').chosen({allow_single_deselect:true});
                                    $("#cmbPer_chosen").focus();
                                }
                        });
                        
                    }
                    
                    function buscarPersona(){
                        var cmbPer= $("#cmbPer").val();
                        $("#busquedaReporte").val(cmbPer);
                        listarReporteGeneral(1);
                    }
                    
                    function restaurar(){
                        $("#busquedaReporte").val("todo");
                        listarReporteGeneral(1);
                    }
                    
                    function AsistenciaPorComision(){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=AsistenciaPorComision',
                                data: null,
                                success:function(resultado){
                                    $("#divAsistenciaPorComision").html(resultado)
                                },complete: function (){
                                    AlimentacionPorComision();
                                }
                        });
                    }
                    
                    function AlimentacionPorComision(){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=AlimentacionPorComision',
                                data: null,
                                success:function(resultado){
                                    $("#divAlimentacionPorComision").html(resultado)
                                },complete: function (){
                                    reporteExtras();
                                }
                        });
                    }
                    
                    function reporteExtras(){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=reporteExtrasAlimentacion',
                                data: null,
                                success:function(resultado){
                                    $("#divExtrasAlimentacion").html(resultado)
                                },complete: function (){
                                    
                                }
                        });
                    }
                    
                    function imprimirExtras(){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=reporteExtrasAlimentacionImp',
                                data: null,
                                success:function(resultado){
                                    $("#divExtrasAlimentacionImp").html(resultado)
                                },complete: function (){
                                    var ficha=$("#divExtrasAlimentacionImp").html();
                                    var ventimp=window.open(' ','_blank');
                                    ventimp.document.write(ficha);
                                    ventimp.document.close();
                                    ventimp.print();
                                    ventimp.close();
                                }
                        }); 
                    }
                    
                    function imprimirAsistencia(){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=AsistenciaPorComisionImp',
                                data: null,
                                success:function(resultado){
                                    $("#divAsistenciaPorComisionImp").html(resultado)
                                },complete: function (){
                                    var ficha=$("#divAsistenciaPorComisionImp").html();
                                    var ventimp=window.open(' ','_blank');
                                    ventimp.document.write(ficha);
                                    ventimp.document.close();
                                    ventimp.print();
                                    ventimp.close();
                                }
                        });             
                    }
                    
                    function imprimirAlimentacion(){
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=AlimentacionPorComisionImp',
                                data: null,
                                success:function(resultado){
                                    $("#divAlimentacionPorComisionImp").html(resultado)
                                },complete: function (){
                                    var ficha=$("#divAlimentacionPorComisionImp").html();
                                    var ventimp=window.open(' ','_blank');
                                    ventimp.document.write(ficha);
                                    ventimp.document.close();
                                    ventimp.print();
                                    ventimp.close();
                                }
                        });             
                    }
                    
                    function extras(){
                         $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=extras',
                                data: null,
                                success:function(resultado){
                                    $("#divExtra").html(resultado)
                                },complete: function (){
                                    $('.chosen-select').chosen({allow_single_deselect:true});
                                    popup_extras();
                                }
                        }); 
                    }
                    
                    function popup_extras(){
                        $( "#dialog-extra" ).removeClass('hide').dialog({
                            resizable: false,
                            width: 400,
                            modal: true,
                            title: "<div class='widget-color-blue' ><div class='widget-header white' ><h4 class='smaller' ><i class='ace-icon fa fa-check-circle white'></i> <span class='white'>Alimentación extra</span></h4></div></div>",
                            title_html: true,
                            buttons: [
                                {
                                    html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp; REGISTRAR",
                                    "class" : "btn btn-primary btn-xs",
                                    click: function() {
                                        registrarExtras();
                                    }
                                },{
                                    html: "<i class='ace-icon fa fa-times bigger-110'></i>&nbsp; CANCELAR",
                                    "class" : "btn btn-danger btn-xs",
                                    click: function() {
                                        $( this ).dialog( "close" ); 
                                    }
                                }
                            ]
                        });
                    }
                    
                    function registrarExtras(){
                        $( "#dialog-extra" ).dialog( "close" );
                        var codDia = $("#codDia").val();
                        var resp = $("#resp").val();
                        var des = $("#des").val();
                        var alm = $("#alm").val();
                        var lon = $("#lon").val();
                        var cen = $("#cen").val();
                        $.ajax({
                                type:'POST',
                                url:'../ServletAsistencia?accion=registrarExtras',
                                data: 'codDia='+codDia+'&resp='+resp+'&des='+des+'&alm='+alm+'&lon='+lon+'&cen='+cen,
                                success:function(resultado){
                                    if(resultado==1){
                                        extras_ok();
                                    }else{
                                        alert("error");
                                    }
                                },complete: function (){
                                    //popup_extras();
                                }
                        }); 
                    }
                    
                    function extras_ok(){
                        $( "#dialog-extrasOk" ).removeClass('hide').dialog({
                            resizable: false,
                            modal: true,
                            title: "<div class='widget-color-green' ><div class='widget-header white' ><h4 class='smaller' ><i class='ace-icon fa fa-tags white'></i> <span class='white'>Notificación</span></h4></div></div>",
                            title_html: true,
                            buttons: [
                                {
                                    html: "<i class='ace-icon fa fa-check bigger-110'></i>&nbsp; ACEPTAR",
                                    "class" : "btn btn-success btn-xs",
                                    click: function() {
                                        $( this ).dialog( "close" );
                                    }
                                }
                            ]
                        });
                    }
                    
                    
                    
                    function enter(e) {
                        tecla = (document.all) ? e.keyCode : e.which;
                        if (tecla==13) tipoBusqueda();
                    }

                    $('input').keypress(function(e){
                        if(e.which == 13){
                            return false;
                        }
                    });
                      
                       
                        
                    
		</script>
                

		<!-- the following scripts are used in demo only for onpage help and you don't need them -->
               
		<link rel="stylesheet" href="../assets/css/ace.onpage-help.css" />
		<link rel="stylesheet" href="../docs/assets/js/themes/sunburst.css" />
                
		<script type="text/javascript"> ace.vars['base'] = '..'; </script>
		<script src="../assets/js/ace/elements.onpage-help.js"></script>
		<script src="../assets/js/ace/ace.onpage-help.js"></script>
		<script src="../docs/assets/js/rainbow.js"></script>
		<script src="../docs/assets/js/language/generic.js"></script>
		<script src="../docs/assets/js/language/html.js"></script>
		<script src="../docs/assets/js/language/css.js"></script>
		<script src="../docs/assets/js/language/javascript.js"></script>
                <script src="../assets/js/chosen.jquery.js"></script>
                
                
                
                <script src="js/languages/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
                <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
                
                <!--<script src="style/jquery.kolorpicker.js" type="text/javascript"></script>
                <link rel="stylesheet" href="style/kolorpicker.css" type="text/css" media="screen, tv, projection, print" />
                -->
                <script src="../reloj/compiled/flipclock.js" type="text/javascript"></script>
            
                <script>
                    $('input').keypress(function(e){
                            if(e.which == 13){
                                return false;
                            }
                        });
                </script>
</html>
