jQuery(document).ready(function(){
  
  jQuery(".yz_menu .yz_logiciel").bind("mouseenter",function(){
    jQuery(".yz_menu .yz_logiciel .yz_sousmenu").show();
  }).bind("mouseleave",function(){
    jQuery(".yz_menu .yz_logiciel .yz_sousmenu").hide();
  });
  jQuery(".yz_menu .yz_yzalis").bind("mouseenter",function(){
    jQuery(".yz_menu .yz_yzalis .yz_sousmenu").show();
  }).bind("mouseleave",function(){
    jQuery(".yz_menu .yz_yzalis .yz_sousmenu").hide();
  });

  


  jQuery(function() {
      jQuery("#yz_licences").accordion({
        header: "h3",
        event: "mouseover",
        selectedClass: "yz_current"
      });
    });
  
  jQuery('a.yz_ancretop').click(function(){
     jQuery.scrollTo('body', 800);
     return false; 
  });  
   
  jQuery('.yz_inputtext').focus(function(){
    jQuery(this).css({'border-top':'1px solid rgb(170,216,170)'});
    jQuery(this).css({'border-right':'1px solid rgb(208,240,208)'});
    jQuery(this).css({'border-bottom':'1px solid rgb(208,240,208)'});
    jQuery(this).css({'border-left':'1px solid rgb(208,240,208)'});
    jQuery(this).effect('highlight', {'color':'rgb(208,240,208)'}, 800);
  });
    
  jQuery('.yz_inputtext').blur(function(){
    jQuery(this).css({'border-top':'1px solid rgb(180,180,180)'});
    jQuery(this).css({'border-right':'1px solid rgb(220,220,220)'});
    jQuery(this).css({'border-bottom':'1px solid rgb(220,220,220)'});
    jQuery(this).css({'border-left':'1px solid rgb(220,220,220)'});
  });
    
  jQuery('#yz_search').focus(function(){
    jQuery(this).css({'border-top':'1px solid rgb(170,216,170)'});
    jQuery(this).css({'border-right':'1px solid rgb(208,240,208)'});
    jQuery(this).css({'border-bottom':'1px solid rgb(208,240,208)'});
    jQuery(this).css({'border-left':'1px solid rgb(208,240,208)'});
    jQuery(this).effect('highlight', {'color':'rgb(208,240,208)'}, 800);
  
    if(jQuery(this).attr('name')=='search'){
      if(jQuery(this).attr('value')=='Recherchez une vidéo'){
        jQuery(this).attr('value','');
        jQuery(this).css({'color':'rgb(0,0,0)'});
      }
    }
  });
  
  
  jQuery('#yz_search').blur(function(){
    jQuery(this).css({'border-top':'1px solid rgb(180,180,180)'});
    jQuery(this).css({'border-right':'1px solid rgb(220,220,220)'});
    jQuery(this).css({'border-bottom':'1px solid rgb(220,220,220)'});
    jQuery(this).css({'border-left':'1px solid rgb(220,220,220)'});
    
    if(jQuery(this).attr('name')=='search'){
      if(jQuery(this).attr('value')==''){
        jQuery(this).attr('value','Recherchez une vidéo');
        jQuery(this).css({'color':'rgb(130,130,130)'});
      }
    }
  });

  // on lance l'affichage des slogan'
  yz.sloganinit();
  
  jQuery('a[rel*=facebox]').facebox({opacity:'0.4'});
  
});



if(typeof yz=="undefined"){var yz={};}

// definition des variables des slogans
yz.current_slogan = 0;
yz.next_slogan = 1;
yz.slogans = [];

// initialisation de l'affichage des slogans
yz.sloganinit = function() {
  this.slogans = jQuery('.yz_slogan span');
  for(i=1; i < this.slogans.length; i++) {
    jQuery(this.slogans[i]).hide();
  }
  if(this.slogans.length > 1) yz.slogangalerie();
};

// alternance des slogans
yz.slogangalerie = function() {
  if(this.current_slogan==0)
    self.setTimeout("yz.nextslogan()",5000);
  else
    self.setTimeout("yz.nextslogan()",2000);
};

// passage au slogan suivant et boucle
yz.nextslogan = function() {
  jQuery(this.slogans[this.current_slogan]).fadeOut('slow');
  jQuery(this.slogans[this.next_slogan]).fadeIn('slow');
  if(this.next_slogan == (this.slogans.length-1)) {
    this.current_slogan = this.next_slogan;
    this.next_slogan = 0;
  } else {
    this.current_slogan = this.next_slogan;
    this.next_slogan++;
  }
  yz.slogangalerie();
};


yz.defaultVideoWidth = 1280;
yz.defaultVideoHeight = 768;

yz.getWindowHeight = function()
{
  if (typeof(window.innerHeight) == 'number')
    return window.innerHeight;
  if (document.documentElement && document.documentElement.clientHeight)
    return document.documentElement.clientHeight;
  if(document.body && document.body.clientHeight)
    return document.body.clientHeight;
  return 0;
};

yz.affPopupCGV = function(url)
{
  var w = 800;
  var h = 500;
  
  w = w*1.0208;
  h = h*1.0205;
  
  var winL = (screen.width-w)/2;
  var winT = (screen.height-h)/3.5;
  var settings = 'height='+h+',';
  settings += 'width='+w+',';
  settings += 'top='+winT+',';
  settings += 'left='+winL+',';
  settings += 'resizable=yes,';
  settings += 'scrollbars=yes';
  var win = window.open(url, null, settings);
  if (win)
    win.focus();
};


yz.affPopupVideo = function(url, sVideoWidth, sVideoHeight)
{
  var w = sVideoWidth == '' ? 0 : parseInt(sVideoWidth);
  if (w <= 0)
    w = yz.defaultVideoWidth;
  var h = sVideoHeight == '' ? 0 : parseInt(sVideoHeight);
  if (h <= 0)
    h = yz.defaultVideoHeight;
  h += 20;
  
  w = w*1.0208;
  h = h*1.045;
  
  var winL = (screen.width-w)/2;
  var winT = (screen.height-h)/3.5;
  var settings = 'height='+h+',';
  settings += 'width='+w+',';
  settings += 'top='+winT+',';
  settings += 'left='+winL+',';
  settings += 'resizable=yes';
  var win = window.open(url, null, settings);
  if (win)
    win.focus();
};
