/* -------------------------------------------------------------------------------------------
--	JAVASCRIPT CASA GUATEMALA	----------------------------------------------------------------
--	Realizacion: digival.es 		-------------------------------------------------------------
--	joseignacio.marcos@digival.es -------------------------------------------------------------
------------------------------------------------------------------------------------------- */

function iniciaCasa(){

	//ORDENACIONES DE TABLAS
	if($("#myTable").length){
	   $("#myTable").tablesorter(); 
	}
	if($("#myTable2").length){
		$("#myTable2").tablesorter(); 
	}
	
	//CREACION DE LOS CALENDARIOS PARA SELECCION DE FECHA
	if($('#fecha').length){
		// Datepicker
		$('#fecha').datepicker({
			inline: true,
			dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
			monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
			firstDay: 1,
			dateFormat: 'dd-mm-yy'
		});
	}
	
	if($('#fechaFactura').length){
		// Datepicker
		$('#fechaFactura').datepicker({
			inline: true,
			dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
			monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
			firstDay: 1,
			dateFormat: 'dd-mm-yy'
		});
		
		$('#fechaPagado').datepicker({
			inline: true,
			dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
			monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
			firstDay: 1,
			dateFormat: 'dd-mm-yy'
		});
	}
	
	
	//FUNCION PARA CONTROLAR LA ELIMINACION DEL REGISTRO
	if($('.eliminaNot').length){
		$('.eliminaNot').click(function (event) { 
			if(!confirm('¿Desea eliminar el registro?')){
				event.preventDefault();
			}
		});
	}
	
}; 

/* -------------------------------------------------------------------------------------------
LOAD -----------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- */ 
$(document).ready(iniciaCasa);