$(function(){
	$('#rotate').jshowoff({
		links: false,
		controls: false,
		speed: 8000,
		hoverPause: true
	});
});
/*
$(function(){
					 
	 $('#vid1-btn').click(function() {
			$('#vid1').show();	
			$('#vid2,#vid3,#vid4,#vid5,#vid6').hide();	
	 });
	 
	 $('#vid2-btn').click(function() {
			$('#vid2').show();	
			$('#vid1,#vid3,#vid4,#vid5,#vid6').hide();	
	 });

	 $('#vid3-btn').click(function() {
			$('#vid3').show();	
			$('#vid1,#vid2,#vid4,#vid5,#vid6').hide();	
	 });

	 $('#vid4-btn').click(function() {
			$('#vid4').show();	
			$('#vid1,#vid2,#vid3,#vid5,#vid6').hide();	
	 });

	 $('#vid5-btn').click(function() {
			$('#vid5').show();	
			$('#vid1,#vid2,#vid3,#vid4,#vid6').hide();	
	 });
	 
	 $('#vid6-btn').click(function() {
			$('#vid6').show();	
			$('#vid1,#vid2,#vid3,#vid4,#vid5').hide();	
	 });
	 
	 $('#vid2').hide();
	 $('#vid3').hide();
	 $('#vid4').hide();
	 $('#vid5').hide();
	 $('#vid6').hide();
	 
});*/

$(function(){
					 
	$("#contact-form").submit(function(){
	
	 var str = $(this).serialize();
		
	 $.ajax({
		 type: "POST",
		 url: "/mailer.php",
		 data: str,
		 success: function(msg){
	
				$("#contact-form").ajaxComplete(function(event, request, settings){
				
					if(msg == 'ok') // Message Sent? Show the 'Thank You' message and hide the form
					{
							result = '<h3>Thank you! We will be in touch</h3>';
							$("#contact-form").fadeOut();
					} else {
							result = msg;
					}
					
					$('.error').html(result);
						
				});
			}
		});
		return false;
		
	});
		
});

/*
**  Ajax Experiment 
**/

$(function(){

$("body").delegate("#vid1-btn", "click", function(){

    // serialize a variable not needed for this particular event
    var str = "1";
    
   $.ajax({
       type: "POST",
       url: "/how-it-works-vids.php",
			 dataType : "text",
       data: { str : "1" },
       success: function(obj){

            var result = obj;

            $("#vid1-btn").ajaxComplete(function(event, request, settings){

                $('.videos').replaceWith(result);

            });
        }
    });
    return false;
});

/* Video 2 */

$("body").delegate("#vid2-btn", "click", function(){

   $.ajax({
       type: "POST",
       url: "/how-it-works-vids.php",
			 dataType : "text",
       data: { str : "2" },
       success: function(obj){

            var result = obj;

            $("#vid2-btn").ajaxComplete(function(event, request, settings){

                $('.videos').replaceWith(result);
                
            });
        }
    });
    return false;
});

/* Video 3 */

$("#vid3-btn").click(function(){

   $.ajax({
       type: "POST",
       url: "/how-it-works-vids.php",
			 dataType : "text",
       data: { str : "3" },
       success: function(obj){

            var result = obj;

            $("#vid3-btn").ajaxComplete(function(event, request, settings){

                $('.videos').replaceWith(result);
                
            });
        }
    });
    return false;
});

/* Video 4 */

$("#vid4-btn").click(function(){
    
   $.ajax({
       type: "POST",
       url: "/how-it-works-vids.php",
			 dataType : "text",
       data: { str : "4" },
       success: function(obj){

            var result = obj;

            $("#vid4-btn").ajaxComplete(function(event, request, settings){

                $('.videos').replaceWith(result);
                
            });
        }
    });
    return false;
});

/* Video 5 */

$("#vid5-btn").click(function(){

   $.ajax({
       type: "POST",
       url: "/how-it-works-vids.php",
			 dataType : "text",
       data: { str : "5" },
       success: function(obj){

            var result = obj;

            $("#vid5-btn").ajaxComplete(function(event, request, settings){

                $('.videos').replaceWith(result);

            });
        }
    });
    return false;
});

/* Video 6 */

$("#vid6-btn").click(function(){

    // serialize a variable not needed for this particular event
    var str = "vid6";
    
   $.ajax({
       type: "POST",
       url: "/how-it-works-vids.php",
			 dataType : "text",
       data: { str : "6" },
       success: function(obj){

            var result = obj;

            $("#vid6-btn").ajaxComplete(function(event, request, settings){

                $('.videos').replaceWith(result);

            });
        }
    });
    return false;
});


});


$(function(){

	/* Validation for RFQ */
	$("#chair-request").validate({
			rules: {
				name: "required",
				email: {
					required: true,
					email: true
					}
				},
			messages: {
				name: "We need a name.",
				email: {
						required: "Without your email we will never be able to talk to you.",
						email: "Your email address must be in the format of name@domain.com"
					}
				}
	});	

});



