Cufon.replace('#sidebar h3, #main_menu li a, .titulo a, table.meta td.texto p, div.content_wrapper h2, ul.filters li a, div.work_excerpt h3 a, div.content_wrapper p, .desc div.txt, .efont');

/* Lightbox para fotos */
Shadowbox.init();

$(window).load(function() {


    /* Slider para cabecera */
    $('.slider').nivoSlider({
        effect: efectonivo? efectonivo:'slideInLeft' /*fade' */, //Specify sets like: 'fold,fade,sliceDown'
        slices:1,
        animSpeed:500, //Slide transition speed
        pauseTime: nivosegundos? (nivosegundos*1000):4000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:false, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
        keyboardNav:true, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:1, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });

    /* Slider para la sidebar */
	$("#production").easySlider({
		auto: false,
		continuous: false,
		nextId: "nextBtn",
		prevId: "prevBtn"
	});
	$("#advanced").easySlider({
		auto: false,
		continuous: false,
		nextId: "nextBtn2",
		prevId: "prevBtn2"
	});

    /* Eliminar valor por defecto en los input */
    $("form#search input, div#newsletter li input, .form li input").click(function () {
        $(this).val('').focus();
    });
   
    /* Suavizado de scroll para Formacion */
    $('div.options a').smoothScroll();

    /* Aparición lateral de textos descriptivos */
    $("div.unit div a").hover(
        function () {
            $(this).find('span').animate({
                width: "140px"
            }, 500)},
        function () {
            $(this).find('span').animate({
                width: "0px"
            }, 500)
    });
    
  	var originales = {};
    
    $('#booking input[type=text]').each( function(i) {
    	originales[$(this).attr('name')] = $(this).val();
    	$(this).focus(function() {
    		if ($(this).val() == originales[$(this).attr('name')]) {
    			$(this).val('');
    		}
    	});
    	
    	$(this).blur(function() {
    		if ($(this).val() == '') {
    			$(this).val(originales[$(this).attr('name')]);
    		}
    	});
    	
    });
    
    
    // Imágenes del blog
    $(".content_wrapper img").each(function () { 
    			if(this.width > 540) {
    				this.height = 540 * this.height/this.width;
    				this.width = 540;
    				$(this).attr('width', 540);
//    				var html = '<a class="imagenpop" href="' + this.src + '"></a>';
//    				$(this).wrap(html);
    			} 
    		} 
    );
    $(".content_wrapper img").load(function () { 
    			if(this.width > 540) {
    				this.height = 540 * this.height/this.width;
    				this.width = 540;
    				$(this).attr('width', 540);
  //  				var html = '<a class="imagenpop" href="' + this.src + '"></a>';
  //  				$(this).wrap(html);
    			} 
    		} 
    );
    
    
    // Inicializar addThis, ya que lo he cargado con el parámetro async=1
    if (addthis != undefined) {
	    addthis.init()
	}
	
	$('a[href^="http://"]').not('a[href*=emedialab]').attr('target','_blank');

});
