var the_layer = '';

function toggleVisibility(div_id, the_visibility)
{

   if (document.getElementById || document.all)
   {
   the_visibility == 0 ? the_visibility = 'hidden': the_visibility = 'visible';
   }
   else if (document.layers)
   {
   the_visibility == 0 ? the_visibility = 'hide': the_visibility = 'show';
   }
   else return;

the_layer = determineDOM(the_layer, div_id);
the_layer.visibility = the_visibility;

}





function determineDOM(the_layer, div_id)
{

   if (document.getElementById)
   {
   the_layer = document.getElementById(div_id).style;
   }
   else if (document.all)
   {
   the_layer = document.all(div_id).style;
   }
   else if (document.layers)
   {
   the_layer = document.layers[div_id];
   }   

return the_layer;

}





function showImage(title, filepath, width, height)
{

var xpos = 0;

   if (self.screen.width)
   {
   xpos = (self.screen.width / 2) - (width / 2);
   }

var query  = '?';
query += 'title=' + escape(title);
query += '&';
query += 'filepath=' + escape(filepath);
query += '&';
query += 'filewidth=' + escape(width);
query += '&';
query += 'fileheight=' + escape(height);

width += 2;
height += 22;

var the_window = window.open('image_preview.php' + query,'','toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,scrollbars=no,left=' + xpos + ',top=100,screenX=' + xpos + ',screenY=100,width=' + width + ',height=' + height);

}
