//**********************************************************************************************************
// T_Thumbs v0.1 (c) 2002 by Damian Bistram
// 
// Feel free to use the T-Thumbs for non-commercial purposes.
// If you intend to use T-Thumbs for commercial purposes, please
// contact me with an e-mail [dbistram@wp.pl]

// asumptions
// all small pictures have the same size 
// all big pictures have the same size too
// small and big img have the same name
//

// paths to images small and big
// small images are placed in images/persons whilst big ones in images/persons/big
// you should change thhese path to your own 
var IMG_PATH = 'images/persons/';
var IMG_BIG_PATH = 'images/persons/big/';

// extensions of files
var IMG_EXTENSION = '.jpg';
var IMG_BIG_EXTENSION = '.jpg';

// width and height of small images 
var S_WIDTH = 141; //110;
var S_HEIGHT = 113; //81;

// width and height of big images 
var B_WIDTH = 640;
var B_HEIGHT = 469;

// width and height window 
var WB_WIDTH = 660;
var WB_HEIGHT = 499;

// img title - you could see it when mouse pointer is over img
var IMG_TITLE = "Zobacz większe ";

// events handler
var TThumbsHandler = {
// onClick event - it shows a big image in separate window
// fname - img file name to show
  _click: function(fname) {
           //obj = document.getElementById(id);
//           return window.open(IMG_BIG_PATH+fname+IMG_BIG_EXTENSION , fname , 'width='+B_WIDTH+',height='+B_HEIGHT+',');
           return window.open(IMG_BIG_PATH+fname+IMG_BIG_EXTENSION , fname , 'width='+WB_WIDTH+',height='+WB_HEIGHT+',');
  },  
// changing icon of cursor if it's over img
// id - img id
  _over: function(id) {
            document.getElementById(id).style.cursor = "pointer";
  }		 
};

function TThumbs() {
  this.ver = "T-Thumbs v0.1";
  this.items = []; // images array  
  this.item_prefix = "item-"; // prefix of id element
};

// functon return content of <img> tag
TThumbs.prototype.toString = function(index) {
  if (index==null) index=0;
  return "<img id='"+this.items[index].id+"' src='"+this.items[index].src+"' width='"+this.items[index].w+"px' height='"+
          this.items[index].h+"px' title='"+
          this.items[index].title+"' align='"+this.items[index].align+"' onClick='TThumbsHandler._click(\""+this.items[index].fname+"\");'"+
		  " onMouseOver='TThumbsHandler._over(\""+this.items[index].id+"\")';>";
};
 
// dodaje obrazki do tablicy - duzy nazywa sie tak samo jak maly i znajduje sie w katalogu big
// it adds pictures to list, name of big image is    
TThumbs.prototype.add = function(obj) {
  obj.id = this.item_prefix+this.items.length; // identyfikator obrazka
  this.items[this.items.length] = obj; // dodanie jednego elementu na koniec listy
};

// img definition
// fname - name of file (without extension)
// big_size - size of big img, 
function TThumbsItem(fname, big_size, align) {
  this.id = "";
  this.fname = fname;
  this.big_size = big_size;
  this.src = IMG_PATH+fname+IMG_EXTENSION; // where img is 
  this.w = S_WIDTH;
  this.h = S_HEIGHT;
  this.title = IMG_TITLE+"("+big_size+" kB)"; // title showed while mouse pointer over picture
  this.style = "";
  this.align = align;
};  
