﻿
////////////////// 編集箇所 ////////////////////////////////////

var _thumbs_width = "240px"; // 横画像の横幅 (js_popup  js_expand  js_scale )
var _thumbs_widtht= "120px"; // 縦画像の横幅 (js_popupt js_expandt js_scalet)

///////////////////////////////////////////////////////////////

function initImgReduction() {
 var obj;
 for ( var i=0; ( obj=document.images[i] ); i++ ) {
  if ( /js_[eps]/.test( obj.className ) ) obj.style.cursor = "pointer";

  if ( /js_expandt?/.test( obj.className ) ) {
   obj.title = "mousedown to expand image";
   obj.onmousedown = function() { this.className += " js_auto"; }
   obj.onmouseup = function() { this.className = this.className.replace( /\bjs_auto\b/g, ""); }
  } else if ( /js_popupt?/.test( obj.className ) ) {
   obj.title = "click to popup window";
   obj.onclick = function() { popupwin(this.src); }
  } else if ( /js_scalet?/.test( obj.className ) ) {
   obj.title = "click to full scale image";
   obj.onclick = function() { document.location.href = this.src; }
  }
 }
}

function popupwin( f ) {
 var obj = new Image(); obj.src = f;
 var s = "<html><head><title>" + f +"<\/title><style type='text\/css'>";
 s += "body {padding:0;margin:0;overflow:hidden;} a img {border:none;}<\/style><\/head>";
 s += "<body><a href='javascript:window.close();'><img src='" +f +"' alt=" +f +"  title='click to close'><\/a><\/body><\/html>";
 var d = window.open( "","_blank","width=" +obj.width +",height=" +obj.height).document; d.write(s); d.close();
}

function window_onload( f ) { 
 if ( window.addEventListener ) { 
  window.addEventListener( "load", f, false ); 
 } else if ( window.attachEvent ) { 
  window.attachEvent( "onload", f ); 
 } 
}

if ( document.images ) {
 var s = "<style type='text\/css'>.js_popup, .js_scale, .js_expand { width:" +_thumbs_width +"} .js_popupt, .js_scalet, .js_expandt { width:" +_thumbs_widtht +"} .js_auto { width: auto !important; }<\/style>";
 document.write(s);
}

window_onload( initImgReduction );
