/* Author: Digital Wax Works - Brett DeWoody

*/

$(document).ready(function() {
    
    // Homepage slideshow
    $('#slideshow').nivoSlider({
    	effect: 'fade',
    	directionNav: false,
    	pauseTime: 6300,
    	animSpeed: 700
    });
    
    // Navbar Search Form
    $('#navbarSearch, #signupEmail').defaultValue();
    
	// Open all links with a class of 'colorbox' in a new window
    $('a.colorbox').colorbox();
    
    // Open video links in a colorbox
    $('a.colorbox.video').colorbox({iframe: true, innerWidth: 600,innerHeight: 338, scrolling: false});
    
    // Signup form validation
    //$("#signup form").validate();
    $("#signup form").validate({
 		submitHandler: function(form) {
   			$.post("/signup/subscribe/",        
        $("#signup form").serialize(),     
        function(data){                
          $.fn.colorbox({
            open:   true,
            href:	'/thanks-for-subscribing',
            innerWidth:	600,
            innerHeight: 450,
            iframe: true,
          	scrolling: false
          });
        },
        "html");
        
        $("#signup").html('Thanks for subscribing!');
 		}
	});
    
    // Contact form validation
    $("#contactForm form").validate();
    
    
    // Individual page slideshow
    $("a[rel='pageslideshow']").colorbox({
    	slideshow:false,
    	innerWidth: '80%',
    	maxWidth:900,
    	maxHeight:675
    });

});

























