$(function() {
	
	/* SLIDER */ 
	
    $(".sliderImages").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
		visible: 1,
		easing: "easein",
		auto: 7000,
		speed: 1000
    });
	
	$(".sliderTextHolder").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
		vertical: true,
		visible: 1,
		easing: "easein",
	 	auto: 7000,
		speed: 1000
    });
	
	
	/* TABS */
	$("#tabs").tabs("#tabPanes > div", { effect: 'fade' });
	
	
	/* LAVALAMP MENU */
	$("#lavalamp").lavaLamp({
		fx: "linear",
		speed: 500,
		click: function(event, menuItem) {
			return true;
     	}
  	});
	
});

/* Email script */

$(function() {
    // These first three lines of code compensate for Javascript being turned on and off. 
    // It simply changes the submit input field from a type of "submit" to a type of "button".

    var paraTag = $('input#submit').parent('span');
    $(paraTag).children('input').remove();
    $(paraTag).append('<input class="button" type="button" name="submit" id="submit" value="Submit" />');

    $('#form_fields input#submit').click(function() {
        $('#form_fields').append('<img src="images/ajax-loader.gif" class="loaderIcon" alt="Loading..." />');

        var name 			= $('input#name').val();
        var email 			= $('input#email').val();
		var subject 		= $('input#subject').val();
        var message 		= $('textarea#message').val();
		var verification 	= $('input#verification').val();
		var string 			= $('input#string').val();

        $.ajax({
            type: 'post',
            url: 'php/sendEmail.php',
            data: 'name=' + name + '&email=' + email + '&subject=' + subject + '&message=' + message + '&verification=' + verification  + '&string=' + string,

            success: function(results) {
                $('#form_fields img.loaderIcon').fadeOut(1000);
                $('ul#response').html(results);

				if ( $("li.email_succes").length > 0 ) {
					$('input#name').attr({ value: '' });
					$('input#email').attr({ value: '' }); 
					$('input#subject').attr({ value: '' }); 
					$('textarea#message').attr({ value: '' }); 
					$('input#verification').attr({ value: '' }); 
					$('#form_fields').fadeOut(1000);
				}
		
            }
        }); // end ajax
    });
});
		
