<script src="<?php echo $Position; ?>assets/plugins/jquery/jquery.min.js"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="<?php echo $Position; ?>assets/plugins/bootstrap/js/popper.min.js"></script>
<script src="<?php echo $Position; ?>assets/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- slimscrollbar scrollbar JavaScript -->
<script src="<?php echo $Position; ?>js/jquery.slimscroll.js"></script>
<!--Wave Effects -->
<script src="<?php echo $Position; ?>js/waves.js"></script>
<!--Menu sidebar -->
<script src="<?php echo $Position; ?>js/sidebarmenu.js"></script>
<!--stickey kit -->
<script src="<?php echo $Position; ?>assets/plugins/sticky-kit-master/dist/sticky-kit.min.js"></script>
<script src="<?php echo $Position; ?>assets/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="<?php echo $Position; ?>js/chosen/chosen.jquery.min.js"></script>
<!-- Sortable -->
<script src="<?php echo $Position; ?>js/sortable/jquery.sortable.js"></script>
<!--Custom JavaScript -->
<script src="<?php echo $Position; ?>js/custom.min.js"></script>
<script src="<?php echo $Position; ?>assets/plugins/tinymce/tinymce.min.js"></script>
<!-- Parsley -->
<script src="<?php echo $Position; ?>js/parsley/parsley.min.js"></script>
<script src="<?php echo $Position; ?>js/parsley/parsley.extend.js"></script>
<!-- Date Picker Plugin JavaScript -->
<script src="<?php echo $Position; ?>assets/plugins/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<!-- icheck -->
<script src="<?php echo $Position; ?>assets/plugins/icheck/icheck.min.js"></script>
<script src="<?php echo $Position; ?>assets/plugins/icheck/icheck.init.js"></script>
<!-- Color Picker Plugin JavaScript -->
<script src="<?php echo $Position ; ?>assets/plugins/jquery-asColorPicker-master/libs/jquery-asColor.js"></script>
<script src="<?php echo $Position ; ?>assets/plugins/jquery-asColorPicker-master/libs/jquery-asGradient.js"></script>
<script src="<?php echo $Position ; ?>assets/plugins/jquery-asColorPicker-master/dist/jquery-asColorPicker.min.js"></script>
<!-- Sweet-Alert  -->
<script src="<?php echo $Position; ?>assets/plugins/sweetalert/sweetalert.min.js"></script>
<!-- This is data table -->
<script src="<?php echo $Position; ?>assets/plugins/datatables/jquery.dataTables.min.js"></script>
<!-- jQuery file upload -->
<script src="<?php echo $Position; ?>assets/plugins/dropify/dist/js/dropify.min.js"></script>
<script>
  $(document).ready(function() {

    // Colorpicker
    $(".colorpicker").asColorPicker();
    $(".complex-colorpicker").asColorPicker({
        mode: 'complex'
    });
    $(".gradient-colorpicker").asColorPicker({
        mode: 'gradient'
    });
    // End Colorpicker

    // Actualiza Imagenes
    $("img").each(function(){
      $(this).attr('src', $(this).attr('src')+'?'+Math.random());
    });

    // Basic
    $('.dropify').dropify();

    // Translated
    $('.dropify-fr').dropify({
        messages: {
            default: 'Glissez-déposez un fichier ici ou cliquez',
            replace: 'Glissez-déposez un fichier ou cliquez pour remplacer',
            remove: 'Supprimer',
            error: 'Désolé, le fichier trop volumineux'
        }
    });

    // Used events
    var drEvent = $('#input-file-events').dropify();

    drEvent.on('dropify.beforeClear', function(event, element) {
        return confirm("Do you really want to delete \"" + element.file.name + "\" ?");
    });

    drEvent.on('dropify.afterClear', function(event, element) {
        alert('File deleted');
    });

    drEvent.on('dropify.errors', function(event, element) {
        console.log('Has Errors');
    });

    var drDestroy = $('#input-file-to-destroy').dropify();
    drDestroy = drDestroy.data('dropify')
    $('#toggleDropify').on('click', function(e) {
        e.preventDefault();
        if (drDestroy.isDropified()) {
            drDestroy.destroy();
        } else {
            drDestroy.init();
        }
    });
  });
</script>

<script>

  <?php if( $Save == 'Ok' || $_GET['New'] == 'Ok' ){ ?>
  $( document ).ready(function() {
      swal({
        title: "¡Guardado!",
        text: "El elemento se ha guardado correctamente.",
        timer: 2000,
        showConfirmButton: false
      });
  });
  <?php } ?>

  $(".chosen-select").chosen();

  $('.page-titles-fixed').each(function() {
    AnchoCont = $(window).width() - 260;
    $(this).width( AnchoCont );
  });

  $('.page-titles-fixed').each(function() {
    //AnchoCont = $(window).width() - 260;
    AnchoCont = $('.inner-fixed-content').width();
    $(this).width( AnchoCont );
  });

  $(window).resize(function(){

    $('.page-titles-fixed').each(function() {
      AnchoCont = $(window).width() - 260;
      $(this).width( AnchoCont );
    });

    $('.page-titles-fixed').each(function() {
      //AnchoCont = $(window).width() - 260;
      AnchoCont = $('.inner-fixed-content').width();
      $(this).width( AnchoCont );
    });

  }).resize();

  //Filtrar
  $( ".BtnFiltrar" ).click(function() {
    $('#Filtrar').fadeToggle( "slow", function() {
      // Animation complete
    });
  });
  // End Filtrar

  //Retira ItemOpc
  $(document.body).on('click', '.DelItemOpc' ,function(){
    console.log('....');
    $(this).parents('.ItemOpc').remove();
  });
  //End Retira ItemOpc

  //Datepicker
  $('.datepicker').datepicker({
    autoclose: true,
    todayHighlight: true,
    format: "dd / MM / yyyy",
    startView: 0
  });
  //End Datepicker

  //Recordatorio Guardado
  <?php if( $AlertSave == 'Ok' ){ ?>
    swal({
      title: "¡Alerta!",
      text: "Alerta envíada",
      showConfirmButton: true
    });
  <?php } ?>
  //End Recordatorio Guardado

  //Recordatorio Guardado
  <?php if( $TicketSave == 'Ok' ){ ?>
    swal({
      title: "Ticket!",
      text: "El ticket de soporte fue guardado.",
      showConfirmButton: true
    });
  <?php } ?>
  //End Recordatorio Guardado

  //Mostrar Recordatorio Top
  $(document.body).on('click', '.BtnSeeRec' ,function(){

    //$('#RecMoTitulo').html($(this).data('id'));
    $('#RecMoTitulo').html($(this).data('titulo'));
    $('#RecMoMensaje').html($(this).data('mensaje'));
    $('#RecMoFecha').html($(this).data('fecha'));
    $('#RecMoHora').html($(this).data('hora'));
    $('#RecordatorioInfo').modal('show');
  });
  //End Mostrar Recordatorio Top

  //Mostrar Ticket Top
  $(document.body).on('click', '.BtnSeeTicket' ,function(){

    //$('#RecMoTitulo').html($(this).data('id'));
    var TicketMoId = $(this).data('id');
    $('#TicketMoTitulo').html($(this).data('titulo'));
    $('#TicketMoMensaje').html($(this).data('mensaje'));
    $('#TicketMoFecha').html($(this).data('fecha'));
    $('#TicketMoHora').html($(this).data('hora'));
    var OnClick = "window.location.href='<?php echo $Position; ?>soporte/ticket?Id="+TicketMoId+"'";
    $("#BtnTicketSeg").attr("onclick",OnClick);
    $('#TicketInfo').modal('show');
  });
  //End Mostrar Ticket Top

  function resizeIframe(obj) {
    obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
  }
</script>
<script>
$(document).ready(function() {

  AnchoScreen = $( window ).width();
  if( $( '.fix-sidebar' ).hasClass( ".mini-sidebar" ) ){
    Ancho = AnchoScreen - 60;
  }else{
    Ancho = AnchoScreen - 240;
  }
  $('.page-titles-fixed').width(Ancho);

  $( window ).resize(function() {
    AnchoScreen = $( window ).width();
    if( $( '.fix-sidebar' ).hasClass( ".mini-sidebar" ) ){
      Ancho = AnchoScreen - 60;
    }else{
      Ancho = AnchoScreen - 240;
    }
    $('.page-titles-fixed').width(Ancho);
  });

  $('.sidebartoggler').click(function(){
    AnchoScreen = $( window ).width();
    if( $( '.fix-sidebar' ).hasClass( '.mini-sidebar' ) ){
      //Ancho = AnchoScreen - 60;
      //alert('Si');
    }else{
      //Ancho = AnchoScreen - 240;
      //alert('No');
    }
    //$('.page-titles-fixed').width(Ancho);
  });


});
</script>
