// JavaScript Document
// JQuery
$(document).ready(function () {
	/* estilo de botones */
	$('input:text').addClass("inputText");
	$('input:file').addClass("inputText");
	$('input:button, input:submit, input:reset').addClass("inputButton");
	
	$("input:text.solonumeros").keypress( function(event) {
		var charCode = (event.which) ? event.which : event.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57))
			return false;
		return true;
	});

	/* cuadros de fecha */
	$('.fecha').datepicker({
		buttonImage: '../css/ico_calendario.png',
		dateFormat: 'dd/mm/yy',
		dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'ju', 'Vi', 'Sa'],
		monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'],
		selectOtherMonths: true,
		onClose: function () {
			if ($(this).val() != '') {
				if (!isDate($(this).val())) {
					$(this).val('');
				}
			}
		},
		onSelect: function () {
			if ($(this).val() != '') {
				if (!isDate($(this).val())) {
					$(this).val('');
				}
			}
		}
	});

	/* color box */
	$('.colorboxS').colorbox({
		width: "500",
		height: "400",
		iframe: true
	});
	$('.colorboxM').colorbox({
		width: "700",
		height: "450",
		iframe: true
	});
	$('.colorboxL').colorbox({
		width: "900",
		height: "500",
		iframe: true
	});
	$('.colorboxSa').colorbox({
		width: "500",
		height: "400",
		iframe: false
	});
	$('.colorboxMa').colorbox({
		width: "700",
		height: "450",
		iframe: false
	});
	$('.colorboxLa').colorbox({
		width: "900",
		height: "500",
		iframe: false
	});
	
	//Google
	var _gaq = _gaq || [];
	  _gaq.push(['_setAccount', 'UA-8385552-2']);
	  _gaq.push(['_trackPageview']);
	
	  (function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	  })();
});
