jQuery(function() {

$('a[name=takaisin]').click(function() {						 
	$.scrollTo(0, 500);									 
});

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$.preloadImages("images/haelainaa_over.gif", "images/haeennakko_over.gif", "images/haekorttia_over.gif", "images/hakemukseen_over.gif");

$('img[name=haelainaa]').hover(
	  function () {
        $(this).attr("src","images/haelainaa_over.gif");
      }, 
      function () {
        $(this).attr("src","images/haelainaa.gif");
      }
);

$('img[name=haeennakko]').hover(
	  function () {
        $(this).attr("src","images/haeennakko_over.gif");
      }, 
      function () {
        $(this).attr("src","images/haeennakko.gif");
      }
);

$('img[name=haekorttia]').hover(
	  function () {
        $(this).attr("src","images/haekorttia_over.gif");
      }, 
      function () {
        $(this).attr("src","images/haekorttia.gif");
      }
);

$('img[name=hakemukseen]').hover(
	  function () {
        $(this).attr("src","images/hakemukseen_over.gif");
      }, 
      function () {
        $(this).attr("src","images/hakemukseen.gif");
      }
);

$('.newsitem').hover(
	  function () {
      	$('.newsitem').not(this).stop().animate({ 
        	opacity: 0.4
     	}, 500 );
      }, 
      function () {
		$('.newsitem').not(this).stop().animate({ 
        	opacity: 1
     	}, 500 );
      }
);


});

