$(document).ready(function() {
	// home page carusel
	
	var img_w = 654;
	var speed = 500;
	var moving = false;
	var el; 
	
	$('a.bannerinavi').click(function() {
		if (moving == false)
		{
	 		moving = true;
			img_index = $('a.bannerinavi').index(this);
			//alert($('a.bannerinavi').index(this));
			new_x = img_index * img_w;
			$("div.home-banner-content").animate({"left": "-"+new_x+"px"}, speed, 'easeOutQuart', function() {																	
				moving = false;
			});		
		}
	});
	
	// tuotesivun otsikon luonti
	var prodname = $('div#prodname').text();
	$('td#topheading').text(prodname);
	Cufon.replace('td#topheading');
	
	// hae nappi hover
	$('input#search-hae').hover(
	  function () {
		$(this).attr('src', 'img/ui/btn_hae2.jpg');
	  }, 
	  function () {
		$(this).attr('src', 'img/ui/btn_hae.jpg');
	  });

	
});

jQuery.easing.easeOutQuart = function (x, t, b, c, d) { 
    return -c * ((t=t/d-1)*t*t*t - 1) + b; 
}; 
