function preparePOPUP() {	// リンクにonclickイベントを定義
 if (!document.getElementsByTagName) return false;
 if (!document.getElementById) return false;

 var TargetZone = document.getElementById("contentszone");	// contentszone内のリンクに限定する
 var links      = TargetZone.getElementsByTagName("a");

 for (var i=0; i < links.length; i++) {
      if (links[i].getAttribute("title") && links[i].getAttribute("rel")){	// title属性とrel属性があるときのみ
          var RelAttr = links[i].getAttribute("rel");
          if (RelAttr.indexOf('largeimage,',0) != -1) {links[i].onclick = function() {return showPic(this);}}
      }
 }	// for end

}	// function preparePOPUP() end


function showPic(whichpic) {	// リンクをクリックしたときに実行するファンクション
 // クリックされたリンクのhref属性・title属性を取得
 var SRC  = whichpic.getAttribute("href");
 var text = whichpic.getAttribute("title");

 // リンクのrel属性の値を,で分割して配列化
 var RelParam      = whichpic.getAttribute("rel");
 var RelParamArray = RelParam.split(',');

 //imagepopup('カレンダー用紙デザイン','/calendar/images/paperdesign/tate-n-l.jpg','名刺サイズ縦型',247,400);
 imagepopup('カード立て',SRC,text,RelParamArray[1],RelParamArray[2]);

 return false;	// リンク先へ飛ばないようにする
}	// function showPic() end


// ページロード時のイベント定義
/*
if (window.addEventListener) {	// NG:IE
    window.addEventListener("load", preparePOPUP, false);
   }
else if (window.attachEvent) {	// NG:Fx
    window.attachEvent("onload", preparePOPUP);
   }
*/
document.observe("dom:loaded", function() { preparePOPUP(); });	// prototype.js(1.6.0 RC1)

