$(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto();
    $('#slide').cycle({ 
        fx:     'fade', 
        speed:  'fast', 
        next:   '.Next', 
        prev:   '.Prev' 
    });
    $('#slide2').cycle({ 
        fx:     'fade', 
        speed:  'fast', 
        next:   '.Next', 
        prev:   '.Prev' 
    });
    $( ".Date" ).datepicker();
    $('.Passeios li').hover(function(){
        $('.Passeios li').removeClass('Atual');
        $(this).addClass('Atual');
    })

    
    $('.Apagar').click(function(){
        if(this.value == this.defaultValue) {
            this.value = '';
            if (this.name == 'telefone'){
                $(this).mask('(99) 9999-9999');
            }
        }
    });
    $('.Apagar').blur(function(){
        if (this.value == ''){
            this.value = this.defaultValue;
        }
    });
    
    
    $('#en').click(function(){
        $('body').translate('en',{toggle:true, not:'.notranslate'});
        $.getJSON('homes/idioma/2');
    });
    $('#pt').click(function(){
        $('body').translate('pt-br',{toggle:true, not:'.notranslate'});
        $.getJSON('homes/idioma/1');
    });
    $('#esp').click(function(){
        $('body').translate('es',{toggle:true, not:'.notranslate'});
        $.getJSON('homes/idioma/3');
    });
    $.getJSON('homes/idioma',function(data){ 
        if(data==1){
            $('#pt').click();
        }
        if(data==2){
            $('#en').click();
        }
        if(data==3){
            $('#esp').click();
        }
    }); 
    var path = window.location.pathname;
    if(path.search('/reservas') != -1){
        $('.SolicitarReserva').hide();
    }
    
    hs.graphicsDir = '/simpatia/site/js/highslide/graphics/';
    hs.align = 'center';
    hs.transitions = ['expand', 'crossfade'];
    hs.outlineType = 'rounded-white';
    hs.fadeInOut = true;
    hs.dimmingOpacity = 0.75;
    //hs.dimmingOpacity = 0.75;

    // Add the controlbar
    hs.addSlideshow({
        //slideshowGroup: 'group1',
        interval: 5000,
        repeat: false,
        useControls: false,
        fixedControls: 'fit',
        overlayOptions: {
            opacity: 0.75,
            position: 'bottom center',
            hideOnMouseOut: true
        }
    });
    $('.jcarousel-skin-tango').jcarousel();
    $('.GaleriaPousada li img').click(function(){
        $('.Palco img').attr('src', $(this).attr('src'));
    })
    //  fancybox   //
		$('.mini').click(function(){
		$('.change').attr('src',$(this).attr('rel'));
	});
	$('.sel').wrap('<div class="selec"></div>');
	$('.che').wrap('<div class="checks"></div>');
	$("#TestimonialImage").wrap('<div id="file"></div>');
	$('.selec').jNice()
	$('.checks').jNice()
    
});
