jQuery(function($) {


	$('#main-nav ul li').hover(function () {

		$(this).find('.drop-down').show();

	}, function () {

		$(this).find('.drop-down').hide();

	});

	

	$("#slider").scrollcarousel({

		auto:8,

		buttonPrev: false,

		navigation: "dots"

	});

	

	$('.blink')

		.focus(function(){

			if ( $(this).attr('value') == $(this).attr('title') ) {

				$(this).attr({ 'value': '' })

			}

		})

		.blur(function(){

			if ( $(this).attr('value') == '' ) {

				$(this).attr({ 'value': $(this).attr('title') })

			}

		});

	

	$('.subscribe-box form').submit(function() {

		var valid = true;

		var errors = '';

		

		$(this).find('.required').each(function() {

			if ($(this).val() == '') {

				$(this).addClass('field-error');

				errors += 'The "' + $(this).attr('title') + '" field is required\n';

				if (valid) {

					$(this).focus();

				}

				valid = false;

			} else {

				$(this).removeClass('field-error');

			}

		});

		

		$(this).find('.email').each(function() {

			var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;

			

			if (!pattern.test($(this).val())) {

				$(this).addClass('field-error');

				errors += 'The email address you entered is not valid\n';

				if (valid) {

					$(this).focus();

				}

				valid = false;

			} else {

				$(this).removeClass('field-error');

			}

		});

		

		if (!valid) {

			alert(errors);

		}

		

		return valid;

	});



      $(".transition").fadeTransition({
		pauseTime: 5000,
         transitionTime: 1000,
         delayStart: 0,
         manualNavigation: false,
         pauseOnMouseOver: true,
         createNavButtons: false}
       );	
	       
});


