function animate(timeInterval)
{
   i = imgCurrent;
   intervalID = setInterval("nextPix(i)", timeInterval) ;
   
}


function stopAnimate()
{
   clearInterval(intervalID);
}

function control_animation(field)
{
	if(field.checked)
		animate(3000);
	else
		stopAnimate();
}



function prevPix(pix)
{
   var A;

   imgCurrent = imgCurrent - 1; 
      if (imgCurrent == 0)
      {
         imgCurrent = imgCount;
      }
      
      A = eval("image" + imgCurrent);
        imgLOAD = A.complete;
        if(imgLOAD)
        {      
         if (document.all)
         {
          document.imgProperty.style.filter="blendTrans(duration=2)";
          document.imgProperty.style.filter="blendTrans(duration=CrossFadeDuration)";
          document.imgProperty.filters.blendTrans.Apply();
         }
         document.imgProperty.src = A.src;
         if (document.all) document.imgProperty.filters.blendTrans.Play();       
        }
        else
        {
         prevPix(1); 
        }
}

function nextPix(pix)
{
   var A;

   imgCurrent = imgCurrent + 1; 
  
      if (imgCurrent == (imgCount + 1))
      {
         imgCurrent = 1;
      }
      
      A = eval("image" + imgCurrent);
        imgLOAD = A.complete;
        if(imgLOAD)
        {      
         if (document.all)
         {
          document.imgProperty.style.filter="blendTrans(duration=2)";
          document.imgProperty.style.filter="blendTrans(duration=CrossFadeDuration)";
          document.imgProperty.filters.blendTrans.Apply();
         }
         document.imgProperty.src = A.src;
         if (document.all) document.imgProperty.filters.blendTrans.Play();       
        }
        else
        {
         nextPix(1); 
        }
}

    function openSlime( pageToLoad, winName, width, height, center) 
    {
       if ((parseInt(navigator.appVersion) >= 4 ) && (center))
       {
          //  xposition = (screen.width - width) / 2;
          //   yposition = (screen.height - height) / 2;    }

     	  xposition = 0;
      	  yposition = 0;    
       }

      	  args = "width=" + width + ","      	 + "height="         + height + "," 
 //   	  args = "width=" + width + "," 	 + "height="         + height + "," 
          + "location=0,"     + "menubar=0,"     + "resizable=1,"    + "scrollbars=1,"
          + "status=0,"       + "titlebar=1,"    + "toolbar=0,"      + "hotkeys=0,"
          + "screenx=" + xposition + ","  //NN Only
          + "screeny=" + yposition + ","  //NN Only
          + "left="    + xposition + ","  //IE Only
          + "top="     + yposition;       //IE Only
          window.open( pageToLoad,winName,args );
    } 


function getCount(pix)
{
   var A;
     
      A = eval("image" + pix);
        imgLOAD = A.complete;
        if(imgLOAD)
        {      
	 cntImage = cntImage + 1             
        }
}


function getImgCount()
{
   var Aimg;
   var cntImages=0;
   var testImg;
   
   while(cntImages>=0)
   {
	  	testImg = cntImages +1;
		alert(image1.complete)
		Aimg = eval("image" + testImg);
	    imageLOAD = Aimg.complete;
		
	    if(imageLOAD)
	    	cntImages = cntImage + 1;
		else
			break;
		
  }
	 
	 return cntImages;
}


