    function slideshow_initCallback(carousel) {
        // Pause autoscrolling if the user moves with the cursor over the clip.
        carousel.clip.hover(function() {
            carousel.stopAuto();
        }, function() {
            carousel.startAuto();
        });
    };
    
    function show_menu_window() {
      jQuery(this).children().next('div').fadeIn();
      jQuery.scrollTo(this, 800, {offset:{top: -30, left: 0}});
    };
    
    function hide_menu_window() {
      jQuery(this).children().next('div').fadeOut("fast");
    };
    
    function show_numeroedicola_focus() {
      jQuery('#floating-focus').fadeIn();
    };
    
    function hide_numeroedicola_focus() {
      jQuery('#floating-focus').fadeOut("fast");
    }
    
    /*
    jQuery.getFeed({
        url: 'php/rss.php?url=http://www.trekportal.it/coelestis/external.php?type=RSS2',
        success: function(feed) {
            var html = '';            
            for(var i = 0; i < feed.items.length && i < 5; i++) {            
                var item = feed.items[i];                
                html += '<div class="B x-normal"><a href="' + item.link + '" target="_blank">' + item.title + '</a></div>';
                html += '<div class="B small">' + item.updated + '</div>';
                html += '<div class="x-small" style="margin-bottom: 8px;">' + item.description + '</div>';
            }
            jQuery('#coelestis_rss').append(html);
        }    
    });
    */
    
    jQuery(document).ready(function(){
      jQuery(function() {
          jQuery('#preview-articoli').cycle({
              fx:     'fade',
              speed:  '1800',
              timeout: 4000,
              fit: 1,
              pause: 1
          });
          jQuery('#contenuti-numero').cycle({
              fx:     'fade',
              speed:  '1800',
              timeout: 4000,
              fit: 1,
              pause: 1
          });
      });

      jQuery('#upd_astroshop').click(function() {
        jQuery.scrollTo('#box-astroshop', 800, {offset:{top: -50, left: 0}, onAfter:function(){jQuery("#box-astroshop").effect("pulsate", {times: 3}, 300);}});
      });
      jQuery('#upd_articoli').click(function() {
        jQuery.scrollTo('#box-articoli', 800, {offset:{top: -50, left: 0}, onAfter:function(){jQuery("#box-articoli").effect("pulsate", {times: 3}, 300);}});
      });
      jQuery('#upd_news').click(function() {
        jQuery.scrollTo('#box-news', 800, {offset:{top: -50, left: 0}, onAfter:function(){jQuery("#box-news").effect("pulsate", {times: 3}, 300);}});
      });
      jQuery('#upd_blog').click(function() {
        jQuery.scrollTo('#box-blog', 800, {offset:{top: -50, left: 0}, onAfter:function(){jQuery("#box-blog").effect("pulsate", {times: 3}, 300);}});
      });
      jQuery('#upd_comenuovo').click(function() {
        jQuery.scrollTo('#box-comenuovo', 800, {offset:{top: -50, left: 0}, onAfter:function(){jQuery("#box-comenuovo").effect("pulsate", {times: 3}, 300);}});
      });
      jQuery('#upd_cielo').click(function() {
        jQuery.scrollTo('#box-cielo', 800, {offset:{top: -50, left: 0}, onAfter:function(){jQuery("#box-cielo").effect("pulsate", {times: 3}, 300);}});
      });
      
      jQuery('#astroshop_slideshow').jcarousel({
        auto: 3,
        wrap: 'last',
        animation: 'slow',
        size: 6,
        scroll: 3,        
        initCallback: slideshow_initCallback
      });
      
      var hi_menu_config = {    
        sensitivity: 6, // number = sensitivity threshold (must be 1 or higher)    
        interval: 100, // number = milliseconds for onMouseOver polling interval    
        over: show_menu_window, // function = onMouseOver callback (REQUIRED)    
        timeout: 100, // number = milliseconds delay before onMouseOut    
        out: hide_menu_window // function = onMouseOut callback (REQUIRED)    
      };

      
      jQuery('#rivista').hoverIntent(hi_menu_config);
      jQuery('#coelum').hoverIntent(hi_menu_config);
      jQuery('#astroshop').hoverIntent(hi_menu_config);
      jQuery('#forum').hoverIntent(hi_menu_config);
      jQuery('#blog').hoverIntent(hi_menu_config);
      jQuery('#comenuovo').hoverIntent(hi_menu_config);
      jQuery('#cerca').hoverIntent(hi_menu_config);
      
      jQuery('#copertina').hoverIntent(show_numeroedicola_focus, hide_numeroedicola_focus);
      
      jQuery('#menu_item-numeroedicola').mouseenter(function() {
        jQuery('#copertina').effect("shake");
        jQuery('#numero-in-edicola').effect("highlight");
      });
      jQuery('#menu_item-photocoelum').mouseenter(function() {
        jQuery('#pc-immagine').effect("shake");
        jQuery('#photo-coelum').effect("highlight");
      });
      
      jQuery('#login-username').focus(function (){
        var cval = jQuery('#login-username').val();
        if(cval == 'Username') {
          jQuery('#login-username').val('');
        }
      });
      jQuery('#login-username').blur(function (){
        var cval = jQuery('#login-username').val();
        if(cval == '') {
          jQuery('#login-username').val('Username');
        }
      });
      jQuery('#login-password').focus(function (){
        var cval = jQuery('#login-password').val();
        if(cval == 'Password') {
          jQuery('#login-password').val('');
        }
      });
      jQuery('#login-password').blur(function (){
        var cval = jQuery('#login-password').val();
        if(cval == '') {
          jQuery('#login-password').val('Password');
        }
      });

    });
