jQuery(document).ready(function()
{
	
	$("#comment_text").markItUp(mySettings);

	function follow_link(link)
	{
		document.location = link;
	}
	$("#button_articles").click(function (){
		document.location = '/catalog/105/Stati.htm';
		});
	$("#button_video").click(function (){
		document.location = '/catalog/106/Videogalereya.htm';
		});
	$("#button_audio").click(function (){
		document.location = '/catalog/107/Audiogalereya.htm';
		});
	$("#button_forum").click(function (){
		document.location = 'http://www.architector.dp.ua/forum/viewforum.php?f=19';
		});
//comments functions

jQuery("#article_comment_submit").click(function (){
		
		jQuery("#comments_error").hide();
		
		
		
		jQuery("#comments_error").html("");
		var comment_name = jQuery("#comment_name").val();
		var comment_email = jQuery("#comment_email").val();
		var comment_text = jQuery("#comment_text").val();
		var comment_code = jQuery("#comment_code").val();
		
			if ( comment_name != '' && comment_email != '' && comment_text != '' && comment_code != '' )
			{
				function isValidEmail (email)
				{
					 return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
				}
				
				if (!isValidEmail(comment_email))
				{
					jQuery("#comments_error").html("");
					jQuery("#comments_error").html("Имя почтового ящика введено неверно! Спама не будет, обещаем :)");
					jQuery("#comments_error").fadeIn('fast');
					return false;
				}
				else
				{
					//alert ('все в порядке');
					document.com_add_form.submit();
					return true;
				}
			}
			else
			{
				jQuery("#comments_error").html("");
				jQuery("#comments_error").html("Заполните все поля формы!");
				jQuery("#comments_error").fadeIn('fast');
				return false;
			}

	});


}); 
