{include file='CommonJavaScript.tpl'}
{include file='CommonStyles.tpl'}
<link rel="stylesheet" type="text/css" href="{$view_styles}/locationadd.css" media="screen" />
<link rel="stylesheet" type="text/css" href="{$view_styles}/product-details.css" />

<div class="popup-block {$languageDirection}">
<div class="clear"></div>
<div class="message_error" id="importGlobalAttributesError" style="display:none;"> {$language.lblSelectItem}</div>
{if $resListAttributes|@count>0}
{form->start name="formImportGlobalOptions" action="" method="post" enctype="multipart/form-data"}
<div>
  <div class="container-section clearfix">  
  <div class="grid_table00">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
	<th width="5" class="checkbox_column" align="left" valign="middle"> <div class="chekingdiv" >
	<ul>
	<li>{form->checkbox id="ListStatusLinkCheckbox"}<label class="pos-rel" for="ListStatusLinkCheckbox"> &nbsp;</label></li>
	</ul>
	</div>
	</th>
	<th align="left" valign="middle"  width="95%">{$language.lblOption}</th>	
	</tr>
	{foreach from=$resListAttributes item="resAttributes"}
	{assign var="customOptionID" value=$resAttributes.customOptionID}
	<tr>
	<td>
	{form->checkbox id="importGlobalOptionIDs_$customOptionID" name="importGlobalOptionIDs" value=$customOptionID class="importGlobalOptionIDs ListAll"}
        <label for="importGlobalOptionIDs_{$customOptionID}">&nbsp;</label>
	</td>
	<td>	
	{$resAttributes.customOptionName}
	</td>	
	</tr>
	{/foreach}   
  </table>		
  </div>  
    <div class="submit-block clearfix text-center"> 
      {form->submit name="submitImportGlobalOptions" class="btn btn-primary btn-sm" value=$language.lblImportGlobalOptions} <span class="or-block"> {$language.lblOr}</span>
      {html->anchor id="cancelImportGlobalOptions" class="btn btn-default btn-sm" caption="{$language.lblCancel}" onclick="parent.$.colorbox.close();"} </div>
   </div>
</div>
{form->hidden name="customOptionIDs" value=""}

{form->close}
{else}
<div class="message_info"> {$language.msgNoRecords}</div>
{/if}
</div>
<script type="text/javascript">
{literal}
$(document).ready(function () {
	var customOptionIDs = "";
	$(document).on('click', "#ListStatusLinkCheckbox", function () {
        if ($(this).prop("checked") == true) {
            $(".ListAll").prop("checked", true);
        } else {
            $(".ListAll").prop("checked", false);
        }
    });
	 $(document).on('click', ".ListAll", function () {
        var ListAllCount = $(".ListAll").size();
        var ListAllCheckedCount = $(".ListAll:checked").size();
        if (parseInt(ListAllCount) == parseInt(ListAllCheckedCount)) {
            $("#ListStatusLinkCheckbox").prop("checked", true);
        } else {
            $("#ListStatusLinkCheckbox").prop("checked", false);
        }
    });
	 
	
	 
	$("#formImportGlobalOptions").submit(function()
	{
	customOptionIDs = "";
	var AsLinkcustomOptionIDs = "";	
	$(".importGlobalOptionIDs").each(function(index, element) {
        if ($(this).prop("checked") == true) {
		customOptionIDs = customOptionIDs + $(this).val() +",";
		}
	});	
	customOptionIDs= customOptionIDs.substr(0,customOptionIDs.length-1);	
	$("#customOptionIDs").val(customOptionIDs);
	
	if(customOptionIDs=="")
	{
		$("#importGlobalAttributesError").show();
		$('body,html').animate({
        scrollTop: $("#importGlobalAttributesError").offset().top},
        'slow');
		$('#importGlobalAttributesError').fadeTo(3000.7).slideUp(4000);
		return false;	
	}
	});
});
{/literal}
</script>