{*
/*---------------------------------------------------------------------------
NOT VIEW MODE - JAVASCRIPT CHECKS
---------------------------------------------------------------------------*/
*}

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js" type="text/javascript"></script>
<script language="JavaScript" src="includes/dbf.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
<!--

  var DEF_REQUIRED_FIELDS = '{$JS_REQUIRED_FIELDS}';
  var checkfields = new Array();
  var dbf_display_handler = new Array();

{assign var="datecounter" value="1"}
{assign var="reqcounter" value="0"}
{foreach from=$fields item=field}
	{if $field.type == 'datetime'}

  var dbformDate{$field.name} = new ctlSpiffyCalendarBox("dbformDate{$field.name}", "{$FORM_NAME}", "{$field.name}","btnDate{$datecounter}","{$field.value|truncate:10:""}",scBTNMODE_CALBTN);

		{assign var="datecounter" value="`$datecounter+1`"}
	{/if}
	{if $field.required}

   checkfields[{$reqcounter}] = new Array();
   {if $field.array}
   checkfields[{$reqcounter}]['field'] = '{$field.name}[]';
   {else}
   checkfields[{$reqcounter}]['field'] = '{$field.name}';
   {/if}
   checkfields[{$reqcounter}]['min'] = {$field.minlength};
   checkfields[{$reqcounter}]['title'] = '{if $field.title != ''}{$field.title}{else}{$field.name}{/if}';

   {if $field.validate_func != ''}

   checkfields[{$reqcounter}]['validate_func'] = '{$field.validate_func}';

   {/if}

		{assign var="reqcounter" value="`$reqcounter+1`"}
	{/if}
	
	{if $field.show_field_relations}
	var target_fields_array = new Array();

	{foreach from=$field.show_field_relations item=rf}
	
	var _target_field = new Array( '{$rf.target_field}','{$rf.source_value}','{$rf.action}' );
	target_fields_array.push(_target_field);
	
	{/foreach}
		dbf_display_handler.push( new DBF_DISPLAY('{$FORM_NAME}','{if $field.array}{$field.name}[]{else}{$field.name}{/if}',target_fields_array) );
	{/if}
{/foreach}



//-->
</script>
<div id="spiffycalendar" class="text"></div>

{*
/*---------------------------------------------------------------------------
END IF NOT VIEW MODE
---------------------------------------------------------------------------*/
*}