// Please leave these notices intact. Removal is a breach of copyright law

function piccy(url, details, thumb)
{ this.url=url; this.details=details; this.thumb=thumb; }

function gallery(across)
{
	pic[pic.length] = "cpy";
    if(!across) across = 3;
	var rows = Math.ceil(pic.length/across);
	var count = 0;
	var output = "";
	for(i=0; i<rows; i++)
	{
		var toprow = botrow = "";
		for(j=0; j<across; j++)
		{
		  if(pic[j+count]) {
		    if(pic[j+count] == "cpy"){
				toprow += '<td width=145 height="150" class="ci_img"><div align="center"><b>CR-ECO Gallery</b><br><br><a href="http://www.cr-eco.com" target="_blank">http://www.cr-eco.com</a></div></td><td width=10>&nbsp;</td>';
		  		botrow += '<td width=145 class="ci_title"></td><td>&nbsp;</td>';
			}else{
		    	var piccyurl = pic[j+count].url;
				if(pic[j+count].thumb) piccyurl = pic[j+count].thumb;
				toprow += '<td width=145 height="150" class="ci_img"><div align="center"><img onClick="showImage(\''+pic[j+count].url+'\')" src="' + piccyurl + '" border=0 heigth=120 width=120></div></td><td width=10>&nbsp;</td>';
		  		botrow += '<td width=145 class="ci_title">&nbsp;<b>' + pic[j+count].url + '</b><br>&nbsp;' + pic[j+count].details + '</td><td>&nbsp;</td>';
		    }
		  }
		}
		output += '<table border="0" cellspacing="0" cellpadding="0"><tr>' + toprow +'</tr><tr>' + botrow +'</tr></table><br>';
		count = count + across;
	}
	totalwidth = 155 * across;
	output += '<img id="sizer" style="visibility: hidden">';
	return output;
}

function showImage(url)
{
  sizer.src = url;
  var width=sizer.width+20; var height=sizer.height+20;
  window.open(url, "", "resizable=1,HEIGHT=" + height + ",WIDTH=" + width); 
  sizer.src = '';
}