//      common.js
//
//      Copyright 2011 Crafter <Crafter@R2D2>
//
//      This program is free software; you can redistribute it and/or modify
//      it under the terms of the GNU General Public License as published by
//      the Free Software Foundation; either version 2 of the License, or
//      (at your option) any later version.
//
//      This program is distributed in the hope that it will be useful,
//      but WITHOUT ANY WARRANTY; without even the implied warranty of
//      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//      GNU General Public License for more details.
//
//      You should have received a copy of the GNU General Public License
//      along with this program; if not, write to the Free Software
//      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
//      MA 02110-1301, USA.
//
//

/* Date Picker Jquery UI */

	$(function() {
		$( ".date-pick" ).datepicker({
			constrainInput: false,
			buttonText: 'Escoge la Fecha',
			showOn: "button",
			buttonImage: "/images/icons/calendar.png",
			buttonImageOnly: true,
			dayNamesMin: ['Dom', 'Lun', 'Mar', 'Mie', 'Jue', 'Vie', 'Sab'],
			monthNamesShort: ['Enero','Febrero','Marzo','Abril','Mayo','Junio',
			'Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
			yearRange: '1900:2080',
			dateFormat: 'dd/mm/yy',
			changeMonth: true,
			changeYear: true
		});
	});

function borrar(id) {

	$('a.delete').click(function(e) {
		if(confirm('Seguro de Eliminar este registro?')){
			e.preventDefault();
			var parent = $(this).parent();
			$.ajax({
				type: 'post',
				url: 'index.php',
				data: 'modules=delete_centro&id=' + id,
				beforeSend: function() {
					parent.animate({'backgroundColor':'#fb6c6c'},300);
				},
				success: function() {
					parent.slideUp(300,function() {
						parent.remove();
					});
				}
			});
		}
	});
};

