 jQuery(document).ready(function($) {
	
	var link1 = $(".breadcrumb li a:first").attr('href');
	
	$('.breadcrumb.single_calendar li').replaceWith( "<li><a href='" + link1 + "'>Portada &raquo;</a> <a title='Ver todas las entradas en Eventos' href='" + link1 + "/category/events/'>Eventos</a>  &raquo; Fonda Oficial Cardumen</li>" );
	
	//if( ($(".resultado").attr('class')=='resultado') || ($("#no-resultados").attr('id')=='no-resultados') ){
		//$(document).attr('title', 'xD');
	//};
	//$(document).attr('title', 'xD');
	
	
	 // Modal mapa	
	$("#encontrarnos").fancybox({ 
        'type': 'iframe',
        'width': 680, 
        'height': 490,  
        'overlayOpacity': 0.85,
        'scrolling': 'no'
    });
	//Modal Intranet
	$("#intranet").fancybox({
        'type': 'iframe',
        'width': 260,
		'height': 210, 
        'overlayOpacity': 0.85,
        'scrolling': 'auto'
    });
	//modales
//	$("a[rel]").overlay({mask: '#000', effect: 'apple'});
	$("ul.tabs").tabs("div.panes > div");
	 
	
	
	 //Dropdown menu principal
	$(".lavaLamp .page_item.page-item-7").hover(function(){ 					
			$(this).find('.children').show();			
		},function(){ 
			$(this).find('.children').hide();
		});
		

	$('#nav_prensa .noshow').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();

	
	//Modal de contenido seccion ayuda
	/*$('.box_big ul li').click(function(){ 
		$('.modal').hide(); 
		$('.box_big ul li').css("z-index","1");
		$(this).addClass('now');
		$(this).css("z-index","999");
		$(this).find('.modal').show(); 
		return false;
	}); 
	
	$('.box_big ul li .btn_cerrar').click(function(){ 
		$('.modal').hide(); 
		$(this).removeClass('now');
		return false;
	}); */
	
	// Bloquear click de botones que tienen dropdown
	$('.page-item-7 a, language a').not('.page-item-7 .children a').click(function(){ 		
		return false;
	}); 
	
	
	//Estilos
	$('#informacion_producto .page_item:last').addClass('last');
	$('.panes .box_panes:last').addClass('descargas');
	$('#nav_prensa li:last').addClass('last');
	$('.item_noticia:odd').addClass('par');
	
	//Funcion que oculta las flechas en el slider si hay 1 item
	var n = $('#principal .item').length;
	if (n > 0){		
		if(n < 2){
			$('#principal .browse').hide(); 	
			$("#sli_pri").scrollable({circular: true, mousewheel: false});	
		}else{
			$("#sli_pri").scrollable({circular: true, mousewheel: false}).navigator().autoscroll({interval: 9000});	
		};
	};
		

	$("#searchform").validate();   
	
	//Habilitar placeholder para Internet Explorer
		jQuery.support.placeholder = false;
		test = document.createElement('input');
		if('placeholder' in test) jQuery.support.placeholder = true;

		if(!$.support.placeholder){ 
			var active = document.activeElement;
			$(':text, textarea').focus(function () {
				if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
					$(this).val('').removeClass('hasPlaceholder');
					$(this).removeClass('hasPlaceholder');
				}
			}).blur(function(){
				if (($(this).attr('placeholder') != '')
					&& ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
					$(this).val($(this).attr('placeholder'));
					$(this).addClass('hasPlaceholder');
				}
			});
			$(':text, textarea').blur();
			$(active).focus();
			$('form').submit(function () {
				$(this).find('.hasPlaceholder').each(function() { $(this).val(''); });
			});
		}
 });

