ImgFun.win = null;
ImgFun.sticky = true;
ImgFun.clickclose = true;

function ImgFun(url, title) {
  if (ImgFun.win && !ImgFun.win.closed)
    ImgFun.win.close();
    var plObj = new Image;
        plObj.onload = function() {
    
    var w = this.width;
    var h = this.height;
    var config = ['width=' + w , 'height=' + h ,
		 'left=' + (screen.availWidth - w - 10) * .5 ,
		 'top=' + (screen.availHeight - h - 10) * .5 ,
		 'status=0'
		].join(',');
				    
    ImgFun.HTML = [
          '<html><head><title>' + title + '</title></head>' ,
         '<body style="margin:0;background:black;overflow:hidden;"' ,
         ((ImgFun.sticky) ? 'onblur="setTimeout(\'top.focus()\',200)"' : ''),
         ((ImgFun.clickclose) ? 'onclick="top.close()"' : '') ,
        '><img style="border-width:0;cursor:pointer;"' ,
          ((ImgFun.clickclose) ? 'title="click to close"' : '') ,
         ' src="' + this.src + '"></body></html>'
    ].join('');

    ImgFun.win = window.open('javascript:opener.ImgFun.HTML', 'picwin', config);
    if (ImgFun.win && !ImgFun.win && ImgFun.win.focus)
      ImgFun.win.focus();
    }

  plObj.onerror = function() {
     alert('Larger size not available, sorry...');
  }

 plObj.alt = title;
 plObj.src = url;
 return false;
}


function openimage(src, w, h)
{
strimage='<a href="#" onclick="window.close()"><img src="'+src+'" width='+w+' height='+h;
strimage=strimage+'  border=0></a><div></div><div></div><div></div>';
if (document.all)
{
win=window.open('','popupa','width='+w+',height='+h);
win.document.write('<html><title></title></header>');
win.document.write('<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0">');
win.document.write(strimage);
win.document.write('</body></html>');
}
else
{
    window.open(src,'popupa','width='+(w+20)+',height='+(h+20));
}
}


function resizewin(width,height){
//	alert(width+' '+height);	
	self.resizeTo(width, height);
//	window.innerWidth = width;
//	window.innerHeight = height;
}

function openwin(url){
    window.open(url,'img','width=10,height=10,toolbar=no,resizable,scrollbars=no,status=0');
}

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
      var pair = vars[i].split("=");
      if (pair[0] == variable) {
	  return pair[1];
      }
  }
  return "";
} 
