/* 
 * 商品画像をポップアップで開く
 */
function showCommodityImage(src, commodityName) {
  // 画像をプリロード
  var i = new Image();
  var pop_win = window.open("", "_blank", "width=100,height=100,scrollbars=no,resizable=yes");
  i.onload = function(){
  // 空ウィンドウに画像を出力するためのHTML
    pop_win.window.document.open();
    pop_win.window.document.write(
     '<html>'
    +'<head><title>'+commodityName+'</title></head>'
    +'<body style="margin:0;padding:0;border:0;">'
    +'<center>'
    +'<img src="'+i.src+'" alt="'+commodityName+'" />'
    +'<br/>'
    +'<a href="javascript:window.close()">关闭</a>'
    +'</center>'
    +'</body>'
    +'</html>'
    );
    pop_win.window.document.close();
    pop_win.window.resizeTo(i.width + 20, i.height+80);
  }
  i.src = src;
}

/*
 * 引数isPreviewがtrueの場合に、リンク、クリック可能な画像をすべて無効化する 
 */
function disablementLink(isPreview) {
  if (!isPreview) {
    return;
  }
  var ls1 = document.getElementsByTagName('a');
  for (var i = 0; i < ls1.length; i++) {
    ls1[i].removeAttribute('href');
    ls1[i].setAttribute('href','#');
    ls1[i].removeAttribute('target');
    ls1[i].onmouseover = null;
    ls1[i].onmouseout = null;
  }
  var ls2 = document.getElementsByTagName('img');
  for (var i = 0; i < ls2.length; i++) {
    ls2[i].onclick = null;
    //ls2[i].onkeypress = null;
    ls2[i].onmouseover = null;
    ls2[i].onmouseout = null;
    ls2[i].removeAttribute('style');
  }
}

