$(function () {

  $('#nav-services').hide().show(600);

  $('#gallery-inner img.img-1').hide().fadeIn(750);	
  $('.thumbnails a').click(function () {
    var thisImage = $(this).parent().attr('id');
    $('.thumbnails a').fadeTo(300,0.5);
    $('#gallery-inner img').hide();
    $('#gallery-inner img').each(function () {
      if ( $(this).hasClass(thisImage) ) {
        $(this).fadeIn(500);
      };
    });
    $('.thumbnails li').removeClass('active');			
    $(this).fadeTo(200,1).parent().addClass('active');
    return false;
  });
  
  $('#help .callback a').click(function () {
    $(this).toggleClass("active");
    $('#help .brochure a').removeClass("active");
    $('#help .brochure a').stop().animate( { top: "0px" }, 200 );
    $('#form-for-brochure').hide();
    $('#form-for-callback').slideToggle(500);
    $('#callback-flash').hide();
  });
  
  $('#help .brochure a').click(function () {
    $(this).toggleClass("active");
    $('#help .callback a').removeClass("active");
    $('#help .callback a').stop().animate( { top: "0px" }, 200 );
    $('#form-for-callback').hide();
    $('#form-for-brochure').slideToggle(500);
    $('#brochure-flash').hide();
  });
  
  $('#help .callback a').mouseover(function () {
    $(this).stop().animate( { top: "8px" }, 200 );
  });
  
  $('#help .callback a').mouseout(function () {
    if ( !$(this).hasClass('active') ) {
       $(this).stop().animate( { top: "0px" }, 200 );
    };
  });
  
  $('#help .brochure a').mouseover(function () {
    $(this).stop().animate( { top: "8px" }, 200 );
  });
  
  $('#help .brochure a').mouseout(function () {
    if ( !$(this).hasClass('active') ) {
       $(this).stop().animate( { top: "0px" }, 200 );
    };
  });
  
  $('#callback-flash').click(function () {
    $('#form-for-callback').slideToggle(500);
    $('#callback-flash').hide();
  });
  
  $('#brochure-flash').click(function () {
    $('#form-for-brochure').slideToggle(500);
    $('#brochure-flash').hide();
  });
  

  
  image = 0;
  setInterval(function () {
    image = image == 25 ? 1 : image += 1; 
    $('#slideshow').fadeOut(1).attr("style", "background-image: url(images/slideshow/" + image + ".jpg)").fadeIn(600);
    }, 3000);

});
