

// Innitiate Main Menu
$(document).ready(function() { 
	$('#menu-wrapper .menu').superfish(); 
});

//News Scroller (Widget)
$(document).ready(function() {
 
 	$('.news-scroller').cycle({ 
	    fx: 'scrollVert',
		speed: 1500,
		rev: true,
		timeout: 4000,
		next: '.news-next', 
	    prev: '.news-previous',
	    easing: 'easeInOutQuint',
	    cleartypeNoBg: true
	 });      
 
});

//Contact Form
$(document).ready(function() {

	//Define URL to PHP mail file
	url = "sendmail.php";
	
	//Activate $ form validation
	$("#jaybich-contact").validate({
	
		submitHandler: function() {
		
			//Define data string
			var datastring = $("#jaybich-contact").serialize();
			
			//Submit form
			$.ajax({
				type: "POST",
				url: url,
				data: datastring,
				success: function(){
					$('#jaybich-contact').slideUp();
					$('#sent').fadeIn();
				}
			});
		}
	
	});
			
});

//Comments Form
$(document).ready(function() {
	
	//Activate $ form validation
	$(".comments-form").validate();
			
});

//Portfolio thumbnail
$(document).ready(function(){
	
	$('.portfolio-box a.thumb').each(function(){
	    if(this.href.match(/\.(jpe?g|png|bmp|gif|tiff?)$/i)){
	        $(this).addClass('image');
	    } else {
	    	$(this).addClass('video');
	    }
	});

	$('.portfolio-box a').hover(function() {
		
		//Show darkenned hover over thumbnail image
		$(this).find('img').stop(true, true).animate({opacity:0.5},400);

	}, function() {
		
		//Hide darkenned hover over thumbnail image
		$(this).find('img').stop(true, true).animate({opacity:1},400);
			
	});

});

//Wordpress Gallery Lightbox Integration
$(document).ready(function(){
	
	$('.gallery-item a').each(function(){
	    if(this.href.match(/\.(jpe?g|png|bmp|gif|tiff?)$/i)){
	        $(this).attr('rel','lightbox');
		}
	});

});

//Image Buttons
$(document).ready(function(){

	$('.image-button').css({opacity:.75});

	$('.image-button').hover(function() {
		
		$(this).stop(true, true).animate({opacity:1},100);

	}, function() {

		$(this).stop(true, true).animate({opacity:.75},100);
			
	});

});

