$(document).ready(function()
{ 
	$('ul.sf-menu').superfish({autoArrows: false, dropShadows: false});
	
	$('#images').cycle({ delay:  8000, speed:  4000 });
	
	// SMALL ENQUIRY FORM VALIDATION
	if ($('#contact-form-small'))
	{
		$('input[name="submit-small-form"]').click(function()
		{
			var verdict		= true;
			
			// VALIDATE NAME
			var name		= $.trim($("#name").val());
			$('#name').attr('value', name);
			
			// VALIDATE EMAIL
			var emailReg	= /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			var email		= $.trim($("#email").val());
			$('#email').attr('value', email);
			
			// VALIDATE PHONE
			var phoneReg	= /^(\(?\+?[0-9]*\)?)?[0-9_\- \(\)]*$/;
			var phone		= $.trim($("#phone").val());
			$('#phone').attr('value', phone);
			
			if (name == '' || name == 'Name') {
				$("#contact-form-small").fadeOut('slow', function() {
					$("#contact-form-small fieldset h3").replaceWith('<h3>Error! <span>Name is required.</span></h3>');
					$("#contact-form-small").fadeIn('slow');
				});
				verdict = false;
			} else if (email == '' || email == 'Email') {
				$("#contact-form-small").fadeOut('slow', function() {
					$("#contact-form-small fieldset h3").replaceWith('<h3>Error! <span>Email is required</span></h3>');
					$("#contact-form-small").fadeIn('slow');
				});
				verdict = false;
			} else if (!emailReg.test(email)) {
				$("#contact-form-small").fadeOut('slow', function() {
					$("#contact-form-small fieldset h3").replaceWith('<h3>Error! <span>Check your email</span></h3>');
					$("#contact-form-small").fadeIn('slow');
				});
				verdict = false;
			} else if (phone == '' || phone == 'Phone:') {
				$("#contact-form-small").fadeOut('slow', function() {
					$("#contact-form-small fieldset h3").replaceWith('<h3>Error! <span>Phone is required.</span></h3>');
					$("#contact-form-small").fadeIn('slow');
				});

				verdict = false;
			} else if (!phoneReg.test(phone)) {
				$("#contact-form-small").fadeOut('slow', function() {
					$("#contact-form-small fieldset h3").replaceWith('<h3>Error! <span>Check your phone number</span></h3>');
					$("#contact-form-small").fadeIn('slow');
				});
				verdict = false;
			}
		
			return verdict;
		});
	}
	
});