function fcontacto(f) {
	var datos = $(f).serialize();
	$(':input', f).attr('disabled','disabled');
	$('#frmdo .consola').html('<ul><li>Cargando...</li></ul>').delay(100).load('contacto.php',datos);
}
$(function () {
	$('#btn-menu-principal').click(function(){
		var $menu = $('#menu-lateral');
		if (0 == $menu.offset().left) {
			$('.submenu').hide();
			$menu.animate({'left':'-290px'},'slow');
			$(this).html('<img src="images/flecha-mostrar.png" alt="&gt;" />');
			change = true;
// 			$('body').css({'background':'#000 url(fondos/index.jpg) top center no-repeat'});
		} else {
			$menu.animate({'left':'0px'},'slow');
			$(this).html('<img src="images/flecha-ocultar.png" alt="&gt;" />');
		}
	});
	$('.mostrar-submenu').click(function () {
		var klass = $(this).attr('class');
		$('.submenu').hide();
		var matrix = /submenu\:([a-z0-9\-]+)/.exec(klass);
		if ($.isArray(matrix)) {
			$('#' + matrix[1]).show('slow');
			change = false;
		}
		/*fondo*/
		matrix = /fondo\:([a-z0-9\-\.]+)/.exec(klass);
		if ($.isArray(matrix)) {
			$('body').css({'background':'#000 url(fondos/' + matrix[1] + ') top center no-repeat'});
		}
	});
	$('.cerrar-submenu').click(function () {
		var klass = $(this).attr('class');
		$('.submenu').hide();
		var matrix = /submenu\:([a-z0-9\-]+)/.exec(klass);
		if ($.isArray(matrix)) {
			$('#' + matrix[1]).show('slow');
		} else {
			change = true;
		}
		/*fondo*/
		matrix = /fondo\:([a-z0-9\-\.]+)/.exec(klass);
		if ($.isArray(matrix)) {
			$('body').css({'background':'#000 url(fondos/' + matrix[1] + ') top center no-repeat'});
		}
	});

	$().piroBox_ext({
		piro_speed : 700,
		bg_alpha : 0.5,
		piro_scroll : true
	});

	$('.mostrar-galeria').click (function () {
		var matrix = /galeria\:([a-z0-9\-]+)/.exec($(this).attr('class'));
		if ($.isArray(matrix)) {
			if (0 == $('#' + matrix[1]).length) {
				$('#target-' + matrix[1]).load(matrix[1] + '.html', function () {
					$('#target-' + matrix[1]).piroBox_ext({
						piro_speed : 700,
						bg_alpha : 0.5,
						piro_scroll : true
					});
					$('#' + matrix[1]).click();
				});
			} else {
				$('#' + matrix[1]).click();
			}
		}
	});

	$('#btn-video-rym').click(function() {$('#video-rym').click()});
	$('#btn-video-canonismo').click(function() {$('#video-canonismo').click()});
	$('#btn-video-rafting').click(function() {$('#video-rafting').click()});
	$('#btn-video-tirolesa').click(function() {$('#video-tirolesa').click()});
});
