var startTime = new Date();


$.fn.hoverClass = function(c) {
  return this.each(function(){
    $(this).hover( 
      function() { $(this).addClass(c);  },
      function() { $(this).removeClass(c); }
    );
  });
};

$(function() {
  
  //The site shal not be viewed in a frame
  if (top.location != document.location)
     top.location.href = document.location.href;
  
  Shadowbox.setup('a.modal', {}); 
  
  //on active le rechargement de la page
  refresh();
  
  $("input,textarea").focus(function(){
    cancel_refresh();
  });
  
  if (document.all) {
    $("#nav li").hoverClass("sfhover");
  } else {
    $("#nav li").hover(
      function(){ $("ul", this).css("opacity","0").fadeTo("normal", 0.99); }, 
      function() { $("ul", this).fadeTo("normal", 0); } 
    );
  }
  
});




var refresh;

function refresh() {
  
  //en cas de vidéo le rechargement de page = x10
  if ($('#col1 div.wys object[data*=youtube]').length > 0) {
    /*
    $('#col1 div.wys object[data*=youtube]').addClass('youtube');
    $('#col1 div.wys object[data*=youtube]').attr('width', 500);
    $('#col1 div.wys object[data*=youtube]').attr('height', 400);
    */
    refresh = setTimeout("document.location.reload();",2000000);
  } else
    refresh = setTimeout("document.location.reload();",200000);
}

function cancel_refresh() {
  clearTimeout(refresh);
}

function auth_reload() {
  document.location.reload();
}
