$(document).ready(function() {
  $(".textentry input, .textentry select, .textentry textarea").focus(function() {
    $(this).parents("li").addClass("focus");
  });
  $(".textentry input, .textentry select, .textentry textarea").blur(function() {
    $(this).parents("li").removeClass("focus");
  });
  $("ul.productlist ul").css({'display':'none'});
  $("a.productlistdropdownheader").toggle(function() {
    $("ul.productlist ul").fadeIn(300);
    $("ul.productlist").addClass("toggle");
    $("li.productlistdropdown").attr({title: "Hide the product list"});
  }, function() {
    $("ul.productlist ul").fadeOut("fast");
    $("ul.productlist").removeClass("toggle");
    $("li.productlistdropdown").attr({title: "Show the product list"});
  });
  $("#navigation li ul").css({'display':'none'});
  $("#navigation ul>li").hover(function() {
    $(this).children("ul").fadeIn(300);
    $(this).addClass("hover");
  }, function() {
    $(this).children("ul").hide();
    $(this).removeClass("hover");
  });
  
  $('.slideshow')
        .cycle({
        fx:      'fade',
        speed:   'fast',
        timeout: 9000,
        pager:   '#slide-nav',
        pause:   1,
        pauseOnPagerHover: 1
      });
  
  $('.product-page-slideshow')
        .after('<div id="slide-nav" class="slide-nav">')
        .cycle({
        fx:      'fade',
        speed:   'fast',
        timeout: 7000,
        pager:   '#slide-nav',
        pause:   1,
        cleartype:  true,
        pauseOnPagerHover: 1
      });
  
  $('.home-page-slideshow')
        .after('<div id="slide-nav" class="slide-nav-home">')
        .cycle({
        fx:      'fade',
        speed:   'fast',
        timeout: 12000,
        pager:   '#slide-nav',
        pause:   1,
        cleartype:  true,
        pauseOnPagerHover: 1
      });
 
  
  //$(".homeboxes").addClass("jhomeboxes").removeClass("homeboxes");
  
  //fading boxes
 $(".homeboxes p a").hover(function() {
    $(".homeboxes p a em").hide();
    $(this).children("em").fadeIn(100);
    $(this).children("em").css('display', 'block');
    $(this).css('background-position', '0 -180px');
  }, function() {
    $(this).children("em").hide();
    $(this).css('background-position', '0px 0px');
  });
  
   $("#customers-slideshow").hover(function() {
    $('a.customers').children("em").show();
    $('a.customers').children("em").css('display', 'block');
    $('a.customers').css('background-position', '0 -180px');
  }, function() {
    $('a.customers').children("em").hide();
    $('a.customers').css('background-position', '0px 0px');
  });
  
  $("#products-slideshow").hover(function() {
    $('a.products').children("em").show();
    $('a.products').children("em").css('display', 'block');
    $('a.products').css('background-position', '0 -180px');
  }, function() {
    $('a.products').children("em").hide();
    $('a.products').css('background-position', '0px 0px');
  });
  
   $("#navigation ul li a").hover(function() {
     $('.homeboxes p a').children("em").hide();
     $('.homeboxes p a').css('background-position', '0px 0px');
  }, function() {

  });
  
  $('#customers-slideshow div img').click(function() {
    window.location.href = "/customers.aspx";
  });
  
  $('#products-slideshow div img').click(function() {
    window.location.href = "/really-managing.aspx";
  });
   
   
  $('a[rel*=lightbox],a.screenshot,a.lightbox').lightBox();
});
