/* Author : My II Lab
 * Email  : Webmaster@myiilab.com
 * Date   :	March 2008
 *
 * All rights reserved. You may use this javascript as long as the credit is given to the author
 */
var interval;
var slideId;
var total;
var currInd;
var currOp;
var slidingInt;

function initShow(newint, newid, slidingms)
{
   slideId = newid;
   interval = newint;
   slidingInt = slidingms;
   var gotmore = true;
   var i=0;
   var tmpobj;
   while (gotmore)
   {
      tmpobj = document.getElementById(slideId + i);
      if (tmpobj != null)
      {
         if (i == 0)
            tmpobj.style.display = '';
         else
            tmpobj.style.display = 'none';
         i++;
      }
      else
      {
         gotmore = false;
      }
   }
   if (i <= 0) // no such element, then stop
      return;
   total = i;
   currInd = 0;
   currOp = 0.95;
   setTimeout('playNextSlide()', interval * 3000);
}


function playNextSlide() {
   currInd++;
   currInd %= total;
   var tmpobj;

   for (var i=0; i<total; i++)
   {
      tmpobj = document.getElementById(slideId + i);
      if (tmpobj != null)
      {
         if (i == currInd)  // to be shown
         {
            tmpobj.style.display = '';
            currOp = 0.05;
         }
         else
         {
            setOpacity(tmpobj, 0.1);
            tmpobj.style.display = 'none';
         }
      }
   }
   fadeMask();
}

function fadeMask()
{
   obj = document.getElementById(slideId + currInd);
   setOpacity(obj, currOp);
   if (currOp < 0.9)
   {
      currOp += 0.1;
      setTimeout('fadeMask()', slidingInt);
   }
   else
      setTimeout('playNextSlide()', interval * 3000);
}


function setOpacity(obj, op)
{
	obj.style.filter='alpha(opacity='+ (op*100) +')';	
	obj.style.opacity = '' + op;  
}