$(document).ready(function() {


// *** szukaj... *** 
   $("input#query").click(function(){
         $(this).val('');
      });

// *** accordion na stronie glownej
   var pi = 'h3_1';
   $('#accordion h3').click(function() {
      if ( $(this).attr("id") == pi ) { return true; }
      pi = $(this).attr("id");
      $("#accordion div:visible").slideToggle('fast');
      $(this).next().slideToggle('fast');
      return false;
   }).next().hide();

   $('#accordion div:first').slideToggle('fast'); // pokaz pierwszy onload

   var pi = 'h3_1';
   $('#accordion2 h3').click(function() {
      if ( $(this).attr("id") == pi ) { return true; }
      pi = $(this).attr("id");
      $("#accordion2 div:visible").slideToggle('fast');
      $(this).next().slideToggle('fast');
      return false;
   }).next().hide();

   $('#accordion2 div:first').slideToggle('fast'); // pokaz pierwszy onload


// *** lewe menu hover
   $("li.mm").mouseover(function(){
      $(this).removeClass("mm").addClass("nn");
    }).mouseout(function(){
      $(this).removeClass("nn").addClass("mm");
    });


// *** scroller z partnerami 

  //Get our elements for faster access and set overlay width
  var div = $('div#middle'),
               ul = $('ul#sc_menu'),
               // unordered list's left margin
               ulPadding = 15;


  var to = 5000; var fi = 700; var fo = 700;
  function sfu() {
     setTimeout(function() { return true; }, "50000");
  }
  function anima0() {
      $('ul#sc_menu1').fadeIn(fi, anima);
      //setTimeout(anima, to);
  }

  function anima() {
      setTimeout(function() { $('ul#sc_menu1').fadeOut(fo, function() { $('ul#sc_menu2').fadeIn(fi, anima2) }) }, to);
      //setTimeout(anima2, to);
  }
  function anima2() {
      setTimeout(function() { $('ul#sc_menu2').fadeOut(fo, function() {$('ul#sc_menu3').fadeIn(fi, anima3) }) }, to);
      //setTimeout(anima3, to)
  }
  function anima3() {
      setTimeout(function() { $('ul#sc_menu3').fadeOut(fo, anima0) }, to);
      //setTimeout(anima0, 1);
      //anima0()
  }

  $('ul#sc_menu1').fadeIn(fi, anima);
  //setTimeout(anima, to);

//  //Get menu width
//  var divWidth = div.width();
//
//  //Remove scrollbars
  div.css({overflow: 'hidden'});
//
//  //Find last image container
//  var lastLi = ul.find('li:last-child');
//
//  //When user move mouse over menu
//  div.mousemove(function(e){
//
//    //As images are loaded ul width increases,
//    //so we recalculate it each time
//    var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
//
//    var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
//    div.scrollLeft(left);
//  });


// *** galeria
//   // select the thumbnails and make them trigger our overlay 
//   $(".gallery-photo a").overlay({ 
// 
//      // each trigger uses the same overlay with the id "gallery" 
//      target: '#gallery', 
// 
//      // optional exposing effect 
//      expose: '#111111' 
// 
//      // let the gallery plugin do its magic! 
//   }).gallery({ 
// 
//      // the plugin accepts its own set of configuration options 
//      speed: 800 
//   });
//

}); // koniec


//$(document).ready(function() {
//  $("a.thumbnail").click(function(){
//     var image = $('#' + this.id + ' img').attr("src").replace(/thumbnail/, "product_page")
//      $("a#normal_image img").attr("src", image);
//      return false;
//  });
//});

