/*
Projekti:   finglove.fi
Tiedosto:   global.js
Tekijä:     Miikka Mäkinen
Pvm:       	04.03.2010
-----------------------------------------------------------------------------*/

$(document).ready(function(){

/* ETUSIVUN SLIDER */
	if($("#slider li").size() > 1) { /* If <li> items are more than 1, starts everything! */

		$("#slider").easySlider({
			/* 
				http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding 
			*/
			speed: 600, /* Sliding speed */
			/*auto: true, */
			pause: 6000,
			vertical: true,
			prevId: 'prev-slide', /* Previous control button ID */
			nextId: 'next-slide' /* Next control button ID */
		});
					
		/* Sets controls opacity to 0.2 by default */
		$("#prev-slide, #next-slide").css("opacity", 0.2);
		
		/* Controls - On hover */
		$("#prev-slide, #next-slide ").hover(
		  function () { 
			$(this).animate({ opacity: 1 }, { duration: 200 }); /* On hover, Show it completely */
		  }, 
		  function () {
			$(this).animate({ opacity: 0.2 }, { duration: 200 }); /* When mouse leave, resets the opacity to 0.2 */
		  }
		).click(
		  function () { 
			$(this).fadeOut(200).fadeIn(400); /* On click blinks the button */
		});

	}
	
});
