var email_regex = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);

function valideteForm()
{
	$('.Error.Name').css('display', 'none');
	$('.Error.Surname').css('display', 'none');
	$('.Error.Email').css('display', 'none');
	$('.Error.Phone').css('display', 'none');
	$('.Error.Question').css('display', 'none');
	
	if ($('#Name').val().length <= 0) 					{$('.Error.Name').css('display', 'block'); return;}
	if ($('#Last_Name').val().length <= 0)				{$('.Error.Surname').css('display', 'block'); return;}
	if ($('#Email_Address').val().length <= 0)			{$('.Error.Email').css('display', 'block'); return;}
	if (!email_regex.test($("#Email_Address").val()))	{$('.Error.Email').css('display', 'block'); return;}
	if ($('#Telephone_Number').val().length <= 0)		{$('.Error.Phone').css('display', 'block'); return;}
	if ($('#Your_Message').val().length <= 0)			{$('.Error.Question').css('display', 'block'); return;}
	
	$('#Form').submit();
}

$(window).load(function() {
	$("div#makeMeScrollable").smoothDivScroll({ 
		autoScroll: "onstart" , 
		autoScrollDirection: "backandforth", 
		autoScrollStep: 1, 
		autoScrollInterval: 20,
		scrollStep: 8,
		scrollInterval: 15,
		startAtElementId: "startAtMe", 
		visibleHotSpots: "always"
	});

	$("div#makeMeScrollable").hover(stopScroll, continueScroll);
	
	$("div#makeMeScrollable a").fancybox({
		'padding'			: 9,
		'autoScale'			: false,
		'titlePosition'		: 'over',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'onClosed'			: continueScroll,
		'onComplete'		: stopScroll
	});
	
	$("div.Gallery a").fancybox({
		'padding'			: 9,
		'autoScale'			: false,
		'titlePosition'		: 'over',
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic'
	});
});

function stopScroll()
{
	$("div#makeMeScrollable").smoothDivScroll("stopAutoScroll");
}

function continueScroll()
{
	$("div#makeMeScrollable").smoothDivScroll("startAutoScroll");
}
