//Menu
$(document).ready(function() {

	$("#menu-main-menu li").prepend("<span></span>"); //Throws an empty span tag right before the a tag

	$("#menu-main-menu li").each(function() { //For each list item...
		var linkText = $(this).find("a").html(); //Find the text inside of the <a> tag
		$(this).find("span").show().html(linkText); //Add the text in the <span> tag
	}); 

	$("#menu-main-menu li").hover(function() {	//On hover...
		$(this).find("span").stop().animate({
			marginTop: "-50" //Find the <span> tag and move it up 40 pixels
		}, 250);
	} , function() { //On hover out...
		$(this).find("span").stop().animate({
			marginTop: "0"  //Move the <span> back to its original state (0px)
		}, 250);
	});

});

//Slideshow
$(document).ready(function() {
    $('.slideshow').cycle({
		fx: 'scrollLeft',
		speed: 1000,
		timeout:  5000
	});
});

//Testimonials
$(document).ready(function() {
	$('#slice-wrapper').cycle({
		fx: 'fade',
		timeout: 10000,
		speed: 1000
	});
}); 

//EaseOut Effect for the Page Scroll
jQuery(
	function($) {
		$.easing.myEaseOut = function (x, t, b, c, d) {
			return c*((t=t/d-1)*t*t*t*t + 1) + b;
		}
	}
);


//Page Scroll
$(document).ready(
    function() {
        $('a.scrollTarget').click(
            function(e) {
                var target = this.href.match(/\#[^\#]+$/)[0];
                $.scrollTo(
                    target,
                    3000,
                    {
                    	easing: 'myEaseOut'
                    }
                );
                e.preventDefault();
            }
        );
    }
);

$(document).ready(function(){
	//Vertical Sliding
	$('.boxgrid').hover(function(){
		$(".cover", this).stop().animate({top:'220px'},{queue:false,duration:300});
	}, function() {
		$(".cover", this).stop().animate({top:'320px'},{queue:false,duration:300});
	});
});;

$(function() {
		// OPACITY OF BUTTON SET TO 50%
		$(".thumb-image").css("opacity","1.0");
		 
		// ON MOUSE OVER
		$(".thumb-image").hover(function () {
		 
		// SET OPACITY TO 100%
		$(this).stop().animate({
		opacity: 0.1
		}, "fast");
	},
		 
		// ON MOUSE OUT
		function () {
		 
		// SET OPACITY BACK TO 50%
		$(this).stop().animate({
		opacity: 1.0
		}, "slow");
	});
});

$(function() {
		// OPACITY OF BUTTON SET TO 50%
		$("li.thumb a img").css("opacity","0.5");
		 
		// ON MOUSE OVER
		$("li.thumb a img").hover(function () {
		 
		// SET OPACITY TO 100%
		$(this).stop().animate({
		opacity: 1.0
		}, "fast");
	},
		 
		// ON MOUSE OUT
		function () {
		 
		// SET OPACITY BACK TO 50%
		$(this).stop().animate({
		opacity: 0.7
		}, "slow");
	});
});
