$(document).ready(function(){

	// ARROW ANIMATIONS

	    $(".arrowleft").hover(function(){
	        $("img", this).stop().animate({left:"-45px"},{queue:false,duration:400});
	    }, function() {
	        $("img", this).stop().animate({left:"0px"},{queue:false,duration:400});
	    });


	    $(".arrowright").hover(function(){
	        $("img", this).stop().animate({right:"-45px"},{queue:false,duration:400});
	    }, function() {
	        $("img", this).stop().animate({right:"0px"},{queue:false,duration:400});
	    });


	// REFECAPTIONS

	$('.case.captionfull').hover(function(){
		$(".cover", this).stop().animate({top:'145px'},{queue:false,duration:160});
	}, function() {
		$(".cover", this).stop().animate({top:'195px'},{queue:false,duration:160});
	});

	// SHADOWBOX

	
	
	// SLIDESHOW - NIVO SLIDER

	$('#slider').nivoSlider({
		effect:'fold',
		slices:1,
		animSpeed:500,
		pauseTime:10000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next  Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left  right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	
		$('#slider2, #slider3, #slider4, #slider5, #slider6, #slider7, #slider8').nivoSlider({
		effect:'fold',
		slices:1,
		animSpeed:500,
		pauseTime:10000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next  Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:false, //Use thumbnails for Control Nav
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left  right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:true, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
	
	// SLIDING CAPTIONS
	
	Shadowbox.init();
	
	// EXTERNAL LINKS
	
	

	  jQuery("a[href^='http:']").not("[href*='pintodesign.fi']").attr('target','_blank');  

	
	$("#contactform_fi").validate({
			submitHandler: function(form) {
				$.post('yhteystiedot/index.php', $("#contactform_fi").serialize(), function(data) {
				$('#contactform_wrapper').html("<div id='message'><h2>Kiitos yhteydenotostasi!</h2> <p>Vastaamme viestiisi mahdollisimman pian.</p></div>");
				});	
			},
			messages: {
			name: "Kirjoita nimesi &uarr;",
			email: "Kirjoita toimiva sähköpostiosoite &uarr;",
			message: "Kirjoita viestisi &uarr;"
			}	
	});
	
	$("#contactform_en").validate({
			submitHandler: function(form) {
				$.post('yhteystiedot/index.php', $("#contactform_en").serialize(), function(data) {
				$('#contactform_wrapper').html("<div id='message'><h2>Thank you for contacting us!</h2> <p>We will reply your message as soon as possible.</p></div>");
				});	
			},
			messages: {
			name: "Please enter your name &uarr;",
			email: "Please enter valid email address &uarr;",
			message: "Please write your message &uarr;"
			}	
	});
	
	
	
	
	


});
