$(document).ready(function()
{
		
		
		// set opacity to nill on page load
		$("nav ul#menu .animenu").css("opacity","0");
		$("#jquery-test").html("jQuery is loaded");		// on mouse over
		$("nav ul#menu .animenu").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				opacity: 1
			}, 'fast');
		},
		// on mouse out
		function () {
			// animate opacity to nill
			$(this).stop().animate({
				opacity: 0
			}, 'fast');
		});
		
		$('#slider').nivoSlider({
        effect: 'random',
		effectPrevious: 'slideInRight',
		effectNext: 'slideInLeft',
		effectControl: 'sliceUpDown',
        slices:8, // For slice animations
        boxCols: 8, // For box animations
        boxRows: 4, // For box animations
        animSpeed:500, // Slide transition speed
        pauseTime:10000, // How long each slide will show
        startSlide:0, // Set starting Slide (0 index)
        directionNav:true, // Next & Prev navigation
        directionNavHide:false, // Only show on hover
        controlNav:false, // 1,2,3... navigation
        keyboardNav:true, // Use left & right arrows
        pauseOnHover:true, // Stop animation while hovering
        manualAdvance:false, // Force manual transitions
        captionOpacity:0.8, // Universal caption opacity
        prevText: 'Prev', // Prev directionNav text
        nextText: 'Next', // Next directionNav text
        beforeChange: function(){}, // Triggers before a slide transition
        afterChange: function(){}, // Triggers after a slide transition
        slideshowEnd: function(){}, // Triggers after all slides have been shown
        lastSlide: function(){}, // Triggers when last slide is shown
        afterLoad: function(){} // Triggers when slider has loaded
    	});
    	
    	
    	$('nav ul#menu li').hover(
        	function () {
            	//show its submenu
            	$('ul', this).slideDown(100);
        	}, 
        	function () {
           	 	//hide its submenu
           	 	$('ul', this).slideUp(100);         
        	}
    	);
    	
    	
    	/* form submit */
    	$('.error').hide(); 
    	$(".button").click(function() {
      		$('.error').hide();
      		var email = $("input#email").val();
  				if (email == "") {
        				$("label#email_error").show();
       					$("input#email").focus();
        				return false;
      			}
      		  var email = $("input#email").val();
      		  var dataString = 'email=' + email;
  				/* alert (dataString);return false; */
  				$.ajax({
    				type: "POST",
    				url: "formSubmit.php",
    				data: dataString,
    				success: function() {
     				$('#subField').html("<div id='message'></div>");
      				$('#message').html("<h5>Thank you - Email received!</h5>")
      				.hide()
      				.fadeIn(1500, function() {
        			
      			});
    			}
  			});
  			return false;	
      			
      		
    	});
    	
    	
    	

    	
});




