
<script language="javascript">
function Check{$form_name}Form()
{literal}{
{/literal}
	
	{foreach from=$fields item=value key=key}
		{if $value[3] neq ""}
				
				var reg = new RegExp("{$value[3]}");
				
				if(!reg.test(document.all.data_form.{$key}.value))
				{literal}
				{
				{/literal}
					alert("{$value[2]}");
					document.all.data_form.{$key}.focus();
					return false;
				{literal}
				}
				{/literal}
				
		{elseif $value[2] neq ""}
				
			  if (document.all.data_form.{$key}!=null) 	
				if(document.all.data_form.{$key}.value=="")
				{literal}
				{
				{/literal}
					alert("{$value[2]}");
					document.all.data_form.{$key}.focus();
					return false;
				{literal}
				}
				{/literal}
				
		{/if}
	{/foreach}
	return true;

{literal}
}
</script>
{/literal}