{if $bindAttributeForm eq '1'}
    
{form->start name="formCustomAttributeAdd" action="" method="post" enctype="multipart/form-data" rel="attribute-save"}
{form->hidden name="selAttrSetID" value="{$selAttrSetID}"}
{form->validate name="validationApply" validate="required" value="1"}
    <h3><span>{$language.lblCustomAttributes}</span></h3>
    {if $resAttributes|@count>0}
    {foreach from=$resAttributes item="resAttributesAdminGroup"}
	{if $resAttributesAdminGroup.attributes|@count>0}
    <h4>{$resAttributesAdminGroup.attributeGroupName}</h4> 
    <div class="grid_table01 attr-grid">
    <table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tbody> 
    <tr>
    <th align="left" valign="middle" width="30%">{$language.lblAttributes}</th>
    <th align="left" valign="middle" width="60%">{$language.lblValues}</th>
    </tr>      
    {foreach from=$resAttributesAdminGroup.attributes key=k item="resAttributesAdmin"}    
    {assign var="customAttributeID" value=$k}
    {assign var="attrDetValue" value=$resAttributesAdmin.attrDetValue}   
    <tr>
    <td align="left" valign="top">{$resAttributesAdmin.attrName}
    </td>
    <td  align="left" valign="top">
    {if $resAttributesAdmin.attrInputType eq 'textbox' || $resAttributesAdmin.attrInputType eq 'textarea' || $resAttributesAdmin.attrInputType eq 'date' || $resAttributesAdmin.attrInputType eq 'datetime' || $resAttributesAdmin.attrInputType eq 'time'}    
    {if $resAttributesAdmin.attrInputType eq 'textbox'}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID maxlength="255" class="textbox form-width" value=$attrDetValue}
    {else if $resAttributesAdmin.attrInputType eq 'textarea'}
    {form->textarea name="adminAttributeValues_"|cat:$customAttributeID rows="6" value=$attrDetValue}
    {else if $resAttributesAdmin.attrInputType eq 'date'}
    {assign var="attrDateFormatted" value=$attrDetValue|date_format:$settingsDateFormat}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID autocomplete="off" maxlength="255" class="textbox form-width enableDatePicker date-field" value=$attrDateFormatted readonly=readonly}
     <a class="attributeReset" rel="{$customAttributeID}" href="Javascript:void(0);">Reset</a>
    {else if $resAttributesAdmin.attrInputType eq 'datetime'}
    {assign var="attrDateFormatted" value="{$attrDetValue|customDate}"}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID autocomplete="off" maxlength="255" class="textbox form-width  enableDateTimePicker date-field" value=$attrDateFormatted readonly=readonly}
   <a class="attributeReset" rel="{$customAttributeID}" href="Javascript:void(0);">Reset</a>
    {else if $resAttributesAdmin.attrInputType eq 'time'}
    {assign var="attrDateFormatted" value="{$attrDetValue}"}
    {form->textbox name="adminAttributeValues_"|cat:$customAttributeID autocomplete="off" maxlength="255" class="textbox form-width enableTimePicker date-field" value=$attrDateFormatted  readonly=readonly}
    <a class="attributeReset" rel="{$customAttributeID}" href="Javascript:void(0);">Reset</a>
    {/if} 
    {else if $resAttributesAdmin.attrInputType eq 'file'}   
	{if $resAttributesAdmin.attrDetValue neq ''}
	<span id="trashDisplay_{$resAttributesAdmin.attrValueID}">{html->anchor href="product/download/id/{$resAttributesAdmin.attrValueID}/" class="file-display" image="{$view_images}/download.png"  title=$language.lblDownloadFile}&nbsp;
	{html->anchor class="customAttributeFile file-display" image="{$view_images}/trash.png" title=$language.lblRemoveFile attrValueID="{$resAttributesAdmin.attrValueID}"}</span>	
	<br/><br/><span id="FileEdit_{$resAttributesAdmin.attrValueID}" style="display:none">{form->upload_custom class="upload_custom" name="adminAttributeValues_"|cat:$customAttributeID validate="isValidFileExtension" error="Invalid File"}	
	</span>
	{else}
	{form->upload_custom class="upload_custom" name="adminAttributeValues_"|cat:$customAttributeID validate="isValidFileExtension" error="Invalid File"}	
	{/if}	
    {else if $resAttributesAdmin.attrInputType eq 'select' || $resAttributesAdmin.attrInputType eq 'multiselect'}    
	
	{assign var="optionArray" value=''}
	{assign var="optionValueArray" value=''}	
	{assign var="count" value=0}
    {foreach from=$resAttributesAdmin['attrOptionID'] key="OptionID" item="optionTitle"}    
    {$optionArray[$count][0]=$OptionID}
    {$optionArray[$count][1]=$optionTitle|html_entity_decode}
    {assign var="count" value=$count+1}
    {/foreach}
    {if $resAttributesAdmin.attrInputType eq 'multiselect'}       
        {assign var="optionValueArray" value=$resAttributesAdmin.assignedOptionID}        
	{if $attributePostBackFlag eq '1'}
	{assign var="checkBoxVals" value="adminAttributeValues_"|cat:$customAttributeID}
	{assign var="optionValueArray" value=","|explode:$attributePostBackArray[$checkBoxVals]}
	{/if}
	<span class="customattr-checkbox">
    {form->checkbox class="adminAttributeCheckBoxes" name="adminAttributeValues_"|cat:$customAttributeID 
	options=$optionArray 
	seperator="</span><span class='customattr-checkbox'>" value=$optionValueArray}    
	</span>
	{form->hidden name="adminAttributeValues_"|cat:$customAttributeID}	
    {/if}	
    {if $resAttributesAdmin.attrInputType eq 'select'}   
    {form->select class="form-select" name="adminAttributeValues_"|cat:$customAttributeID caption="->{$language.lblSelect}" options=$optionArray  value=$resAttributesAdmin.assignedOptionID['0']} 
    {/if}   
    {/if}
    </td> 
    </tr>
    {/foreach}	
    </tbody>    
    </table>
    </div>
	{/if}
    {/foreach}
{else}
<div class="message_info"> {$language.msgNoRecords}</div>
{/if}
{if $resAttributesAdminGroup.attributes|@count>0} 
<div id="attribute-save-section" class="save-floating-section">
<div class="cm-buttons-floating">
  <div class="submit-position"> 
  {form->submit name="submitAttributeDetails" id="submitAttributeDetails" class="button03 curve-3" value="{$language.lblSaveAttributes}"}                
  {$language.lblOr}{html->anchor href="product/index/" content=$language.lblCancel} </div>
</div>
<div class="cm-buttons"></div>
</div>
{/if}
{form->close}
   {/if} 