var pathname = window.location.pathname;

$('.head ul li a').hover(function(){
        $('span.l',this).stop(true,true).animate({'height':'10px'})
        $(this).parent().find("ul.submenu").stop(true,true).show('slide',{direction:'up'},300)
        $(this).parent().hover(function() {}, function(){
			$('span.l',this).stop(true,true).animate({'height':'0px'})
            $(this).find("ul.submenu").stop(true,true).hide('slide',{direction:'up'},300)
            });
                        },function(){})


			
$st=0;
function gal($id){
    if($id!=$st)
    $('.imgal ul li:eq('+$st+')').stop(true,true).show().css('',function(){
        $('img',this).fadeOut()
        $('div.neg',this).hide("slide", { direction: "down" },'slow',function(){
            $('.imgal ul li:eq('+$id+')').show().css('',function(){
                $('img',this).hide().load().fadeIn().parent().
                find('div.neg').show("slide", { direction: "down" },'slow',function(){
                    $('.imgal ul li:eq('+$st+')').hide()
                    $st=$id
                })
            })
        })
        
    })
    return false
}

$('.title').hide().css('',function(){
	$(this).show()
    $t= $(this).css('top').replace('px','')
    $t=parseFloat($t)
    $(this).css({'top':($t+100)+'px'}).css('',function(){
								setTimeout(function(){
													$('.title').animate({'top':$t+'px'},'slow')
													},500)					   
													   })
    
    
})

$('.titleH').hide().css('',function(){
	$(this).show()
    $t= $(this).css('top').replace('px','')
    $t=parseFloat($t)
    $(this).css({'top':($t+140)+'px'}).css('',function(){
			setTimeout(function(){
								$('.titleH').animate({'top':$t+'px'},'slow')
								},700)										   
													   })
    
    
})
//$('').hide().show('slide',{direction:'down'},500)

if(pathname.indexOf('galeria')>=0){
	$(".scrollable").scrollable({ vertical: true, mousewheel: true }).navigator()
    $id=0
    $('.scrollable .items a').css('',function(){
        $(this).attr('href','#'+ $id++)
    })
    
    $('.imgal ul li').hide().css('',function(){ 
        $('img',this).hide()
        $('div.neg',this).hide()
    })
    $('.imgal ul li:eq('+$st+')').show().css('',function(){
        $('img',this).show()
        $('div.neg',this).show()
    })
    $('.scrollable .items a').click(function(){
        gal($(this).attr('href').replace('#',''))
        return false
    })
}else if(pathname.indexOf('noticia.php')>=0)
	$('#slide').cycle({pager:'.pag',fx:'fade',timeout: 0})
else if(pathname.indexOf('reservaciones')>=0)
	reserva()
else if(pathname.indexOf('bolsa-trabajo')>=0 || pathname.indexOf('noticia')>=0 || pathname.indexOf('como-llegar')>=0 || pathname.indexOf('promocion')>=0 || pathname.indexOf('habitaciones')>=0  || pathname.indexOf('nosotros')>=0 || pathname.indexOf('negocios-leon')>=0
 || pathname.indexOf('instalaciones-y-servicios')>=0){}
else{
    reserva()
	$('#slide').innerfade({ speed: 'slow', timeout: 4000, type: 'sequence', containerheight: '220px' });
	}


$('a[href*=#]').click(function(){
	$tar=$(this).attr('href')
	if($tar.length>1){
		target = $($tar).offset().top
		$('html,body').animate({scrollTop: target}, 1000)
		}
	
	return false
								})

function reserva(){
	var dates = $( "#Fllegada, #Fsalida" ).datepicker({
            dateFormat: 'yy/mm/dd',
            dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
                monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo',
                    'Junio', 'Julio', 'Agosto', 'Septiembre',
                    'Octubre', 'Noviembre', 'Diciembre'],
                monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr',
                    'May', 'Jun', 'Jul', 'Ago',
                    'Sep', 'Oct', 'Nov', 'Dic'],
			onSelect: function( selectedDate ) {
				var option = this.id == "Fllegada" ? "minDate" : "maxDate",
					instance = $( this ).data( "datepicker" ),
					date = $.datepicker.parseDate(
						instance.settings.dateFormat ||
						$.datepicker._defaults.dateFormat,
						selectedDate, instance.settings );
				dates.not( this ).datepicker( "option", option, date );
			}
		})
	}
//$('head').prepend('<script type="text/javascript" src="http://ruta54.com/clima/clima-express.php"></script>')
