$(function(){
/* start js */

    Cufon.replace('div#top ul, div#footer ul, h1, h2, h3, .title, .cat', { hover: true });
   // $('body').raptorize({ "enterOn" : "konami-code" });

    $.each($('body#Clients div#content li'), function() { 
    $(this).data('original_img', $(this).html());
    });
        
    $('body#Clients div#content li').live('hover', function(event) {
     $('body#Clients div#content li img').pixastic('desaturate');
     $(this).html( $(this).data('original_img') );
    });
    
    $("div#top, div#footer").hover(function(){
      $('body#Clients div#content li img').pixastic('desaturate');
    });

    $("div.case").each(function(){
      $(this).find("ul").first().addClass("scroller").wrap('<div class="clip" />');
    });


    var checkactive = $('div#top ul li:first-child').attr('class');
    $('div#footer ul li:first-child').addClass(checkactive);
    $('ul.case_thumbs li:nth-child(3n)').addClass('last');
    $('ul#more_cases li:first-child').addClass('first');

    $('#more_cases').billy({
      scrollAmount: '960',
      autoAnimate: false,
      nextLink: $('#next_more'),
      prevLink: $('#prev_more')
    });
    
    var scrollerWidth = $('.scroller li').length * 940;
    console.log(scrollerWidth);
    $('.scroller').css("width", scrollerWidth + "px");
    
    $('.scroller').billy({
      nextLink: $('#next'),
      prevLink: $('#prev'),
      autoAnimate: false,
      indicators: $('#fade_indicators')
    });
    
    $(document).bind('keydown', 'left', function(){ $('#prev').trigger('click'); });
    $(document).bind('keydown', 'right', function(){ $('#next').trigger('click'); });

    $("form input, form textarea").focus(function(){
      if  (!$(this).data("placeholder"))
    $(this).data("placeholder", $(this).val());
      if  ($(this).val() === $(this).data("placeholder"))
      $(this).val("");
    }).blur(function(){
      if  ($(this).val() === "")
      $(this).val($(this).data("placeholder"))
    });
    
    if ($(".page-item-597").hasClass("current_page_item")) {
        $(".post_column_1").each(function() {
            if ($(this).index() == 13 || $(this).index() == 14) {
                $(this).css({marginTop: '-17px'});
            }
        });
    }

/* end js */
});

