    function OpenWindow(strURL, strTitle, intWidth, intHeight)
    {
        var intWindowLeft
        var intWindowTop
        var msgWindow

        // find out the numbers to center the screen.
        intWindowLeft = (screen.width - intWidth) / 2;
        intWindowTop = (screen.height - intHeight) / 2;

        window.open(strURL+"&t="+strTitle,'Test','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=' + intWidth + ',height=' + intHeight + ',left=' + intWindowLeft + ',top=' + intWindowTop);
    }
    //-->

    function clickimg()
    {
      if (window.event.srcElement.parentNode.className=='imcapimage' && window.event.srcElement.nodeName=='IMG')
      {
        a=window.event.srcElement.src;
        as=a.split('/');
        a=as[as.length-1];
        cap=window.event.srcElement.alt;
        OpenWindow("/image.php?i="+a,cap,600,440);
      }
    }

    document.onclick=clickimg;

/************************************************************************
Based on script by Martial Boissonneault © 2001 http://getElementById.com/
This script may be used and changed freely as long as this msg is intact
Visit http://getElementById.com/ for more free scripts and tutorials.
Modified to fade smoothly between multiple images by J.Patchett 2005.
*************************************************************************/
var ie5=(document.getElementById && document.all);
var ns6=(document.getElementById && !document.all);

nPlus = 5;  //the % of fading for each step
speed = 50;  //the speed
delay=3000;

// You don't have to edit below this line
nOpac = 100;

inum=1;

function FadeImg(){
    if(document.getElementById)
    {
        inum2=inum+1;
        if (!document.getElementById('img'+inum2)) inum2=1;
        imgs = document.getElementById('img'+inum);
        imgf = document.getElementById('img'+inum2);


	opacity = nOpac-nPlus;
	nOpac = opacity;

    if(opacity>100 || opacity<0){
        //nPlus=-nPlus;
    }
    if(ie5){
        imgs.style.filter="alpha(opacity=0)";
      	imgs.filters.alpha.opacity = opacity;
        imgf.style.filter="alpha(opacity=100)";
      	imgf.filters.alpha.opacity = 100-opacity;
    }
    if(ns6){
        imgs.style.MozOpacity = 0 + '%';
	imgs.style.MozOpacity = opacity + '%';
    }

     document.getElementById('img'+inum).style.visibility="visible";
     document.getElementById('img'+inum2).style.visibility="visible";

    if (opacity<0 || opacity>100)
    {
	   nOpac = 100;
         document.getElementById('img'+inum).style.visibility="hidden";
          inum++;
       if (!document.getElementById('img'+inum)) inum=1;
       setTimeout('FadeImg()',delay);
    }
    else
    {
        setTimeout('FadeImg()',speed);
    }
  }
}



