
/* =ONLOAD
=------------------------------------*/

$(document).ready(function(){

  // Popup
  $("a[rel=popup]").click( function(event) {
    event.preventDefault();
    window.open($(this).attr('href'),'popup','width=540,height=550');
  });
  
  
  // Accordion control
  $('.accordionContent h1 a').attr('title','Clicca per leggere tutto').click( function(event) {
    event.preventDefault();
    $this = $(this);
    $($this.attr('href')).slideToggle('medium', function() {
      $('body').animate({scrollTop : $this.offset().top-15}, 'fast');
    });
  });
  
  
  // FAQ
  $('.faq li a').click( function(event) {
    event.preventDefault();
    $('body').animate({scrollTop : $(this).offset().top-15}, 'medium');
  });
  
});



/* =ISSUU – NOT USED AT THE MOMENT
=------------------------------------*/

(function($) {

$.fn.embedissuu = function(settings)
{
	settings = $.extend({}, $.fn.embedissuu.defaults, settings);
  

  return $(this).each( function() {
    var $this = $(this);    
    var $path = 'http://issuu.com/' + $this.attr('rel') + '?mode=embed&showFlipBtn=true&layout=http://skin.issuu.com/v/';
    
    if(null == settings.bgColor) {
      $path += 'light/layout.xml';
    } else {
      $path += 'color/layout.xml&backgroundColor='+settings.bgColor;
      $this.css('background', '#'+settings.bgColor);
    }
    
    $path += '&pageNumber='+settings.startPage;
    
    $this.append('<iframe src="'+$path+'" width="'+settings.width+'" height="'+settings.height+'" frameborder="0"></iframe>');  
  });  
};

$.fn.embedissuu.defaults = {
  bgColor : 'FFFFFF',
  width : '740',
  height : '560',
  startPage : 1
};

})(jQuery);

