var showTopper = true;
/************************************************************************************************************************************************************************************************************
 * ONLOAD FUNCTION CALLS
 ***********************************************************************************************************************************************************************************************************/
$(function() {
  // MANAGE BACK TO TOP in read-along context showTopper=false (partFODocumentDrawer.jsp)
  if(showTopper) {
    var top = $('
').attr('id', 'topper').css({ bottom: '50px', display: 'none', position: 'fixed', right: 0});
    var href = $('
');
    href.append('
');
    top.append(href);
    $('body').append(top);
    var firstBodyEl = document.body.firstChild;
    var gtm = document.createElement('a');
    gtm.name = "ww4_top";
    firstBodyEl.parentNode.insertBefore(gtm, firstBodyEl);
    document.addEventListener("scroll", function() {
      var topper = $('#topper');
      var isVisible = topper.is(':visible');
      //console.debug($(window).scrollTop() + ' / ' + screen.height + ' / ' + $(window).height() );
      if(!isVisible && $(window).scrollTop()> $(window).height())
        topper.fadeIn('slow');
      else if (isVisible && $(window).scrollTop()< $(window).height())
        topper.fadeOut('slow');
    }, true);
  }
});
/**********************	gestione responsive menu horiz **********************/
(function ($, window, document, undefined) {
  'use strict';
  $(function () {
    $("#mobileMenu").hide();
    $(".toggleMobile").click(function() {
      $(this).toggleClass("active");
      $("#mobileMenu").slideToggle(500);
    });
  });
  $(window).on("resize", function() {
    if($(this).width() > 500) {
      $("#logo").show();
      $("#mobileMenu").hide();
      $("#mobileLogo").hide();
      $(".toggleMobile").removeClass("active");
    } else {
      $("#logo").hide();
      $("#mobileLogo").show();
    }
  });
})(jQuery, window, document);
function highlight($theElement, isRight) {
  var color = isRight ? '#53c21a' : '#c20000';
  if($theElement.attr('type')=='checkbox') {
    //$theElement.css('background-color', 'red');
    //setTimeout( function(){ $theElement.css('background-color', ''); }, 1500);
    $theElement.wrap("");
    setTimeout( function(){ $theElement.unwrap(); }, 1500);
  } else {
    //$theElement.css('border', '1px solid ' + color);
    //setTimeout( function(){ $theElement.css('border', ''); }, 2000);
    $theElement.css('backgroundColor', color).css('color', '#FFF');
    setTimeout( function(){ $theElement.css('backgroundColor', '').css('color', ''); }, 2000);
  }
}