<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="ja">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <meta http-equiv="Content-Script-Type" content="text/javascript">

  <title>画像追加</title>

  <link href="./css/admin_import.css" rel="stylesheet" type="text/css" media="screen,tv,print"/>

{literal}
  <script type="text/javascript">
  <!--
  function insert_img(txt)
  {
    var ie = (!!(window.attachEvent && !window.opera));
    var opera = (!!window.opera);
    var webkit = (navigator.userAgent.indexOf('AppleWebKit/') > -1);
    var gecko = (navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1)

    var str = window.opener.document.form1.itemexp;
    var img = '<img src="'+ txt +'">';

    str.focus();
    if (gecko) {
      var s_str1 = str.value.substring(0, str.selectionStart);
      var s_str2 = str.value.substring(str.selectionEnd, str.value.length);
      str.value = s_str1 + img + s_str2;
    }
    else if (ie) {
      window.opener.document.selection.createRange().text = img;
    }
    else {
      str.value += img;
    }

    window.close();
  }
  //-->
  </script>
{/literal}
</head>

<body>

<div style="margin:0 auto;">

  <h3 style="color:#FF6600; font-size:18px; margin-bottom:1em;">商品説明用画像ファイル一覧</h3>
  <p>画像をクリックすると商品説明のテキストエリアに、画像へのリンクが追加されます。</p>

  <div style="margin:0 auto; width:580px;">

  <table border="0" cellspacing="0" cellpadding="0" style="margin-bottom:15px; background-color:#FFFFFF;">
    <tr>
{foreach from=$action.imglist key=imgk item=img name=imgc}
{if $smarty.foreach.imgc.index != 0 && $smarty.foreach.imgc.index % 8 == 0}
    </tr>
    <tr>
{/if}
      <td style="border:1px solid #CCCCCC;padding:10px; vertical-align:top; text-align:center;">
        <a href="javascript:void(0)" onclick="insert_img('{$img}');"><img src="{$img}" width="50" height="50" border="0"></a>
      </td>
{/foreach}
    </tr>
  </table>

  </div>

  <a href="javascript.void(0)" onclick="window.close();">閉じる</a>

</div>

</body>
</html>
