$().ready(function() {
  //CKEDITOR.replace( 'text' );
  /*
  if( $(location).attr("hash") != '' ) {
    scrollSmooth($(location).attr("hash"));
  }
  //ie doesn't know 'a:link'...
  if($.browser.msie == true) {
    $link = 'a';
  }
  else {
    $link = 'a:link';
  }
  $($link).stop().animate({opacity: 0.5}, 1000);
  $($link).mousedown(function() {
    $('body').stop().animate({opacity: 0}, 100, function() {
      $('body').animate({opacity: 1}, 3000);
    });
  });
  $($link).hover(
    function() {
      $(this).stop().animate({opacity: 1}, 500);
    },
    function() {
      $(this).stop().animate({opacity: 0.5}, 5000);
    }
  );
  $($link).focus(
    function() {
      $(this).stop().animate({opacity: 1}, 500);
    },
    function() {
      $(this).stop().animate({opacity: 0.5}, 5000);
    }
  );
  */
  $('img.flip').hover(
    function () {
      $(this).stop().animate({opacity: 0}, 300, function() {
        $(this).attr("src", $(this).attr("src").replace('front', 'back'));
        $(this).animate({opacity: 1}, 300);
      });
    },
    function () {
      $(this).stop().animate({opacity: 0}, 300, function() {
        $(this).attr("src", $(this).attr("src").replace('back', 'front'));
        $(this).animate({opacity: 1}, 300);
      });
    }
  );
});

function scrollSmooth(anchor) {
  if ( $(anchor) ) {
    if ( $(anchor).attr("id") == undefined) {
      anchor = $("a[name=" + anchor.substring(1) + "]");
    }
    if ( $(anchor).offset() ) {
      target = $(anchor).offset().top;
      $('html').animate({scrollTop: target}, 3000);
      $('body').animate({scrollTop: target}, 3000);
    }
  }
}


