var slideStart=null;
var slidePhotos=null;
var slideSrcs=null;
var slideInterval=null;

function Slides_init (imgId, IMG_BASE_URL, photoRefs)
{
  if(!slidePhotos)
  {
    slidePhotos=new Object();
    slideSrcs=new Object();
  }

  if(!slidePhotos[imgId])
    slidePhotos[imgId]=new Object();

  var photo=slidePhotos[imgId];
  photo.seq=0;

  for(var i=0; i<photoRefs.length; i++)
  {
    var pId=photoRefs[i].id;
    var image=slideSrcs[pId];

    if(!image)
    {
      image=new Image();
      image.src=pId;
      slideSrcs[pId]=image;
    }

    if(!photo.src)
      photo.src=new Array();

    photo.src[photo.src.length]=image;
  }
}

function Slides_next()
{
  for(var imgId in slidePhotos)
  {
    var photo=slidePhotos[imgId];
    var nextSeq=(photo.seq+1)%photo.src.length;
    photo.seq=nextSeq;
    var image=document.getElementById(imgId);
	var swf = document.getElementById('swf_'+imgId);
    if (!image)
        continue;

    if(image.filters)
        image.filters["DXImageTransform.Microsoft.Fade"].apply();
    
	temp_photo=new Image();
	temp_photo.src=photo.src[nextSeq].src;
    image.src=temp_photo.src;
	image.width=temp_photo.width>128?128:temp_photo.width;
	image.height=temp_photo.height>128?128:temp_photo.height;
	if (swf) { 
	swf.height=image.height;
	swf.width=image.width;
	}
    if(image.filters)
        image.filters["DXImageTransform.Microsoft.Fade"].play();
  }
}

function Slides_start()
{
  if(slideStart || !slidePhotos)
    return;
  slideInterval=setInterval("Slides_next()", 4000);
  slideStart=1;
}


function Swf_print(swfId,effect, width, height){
var swf = document.getElementById('div_'+swfId);
if (!swf || !effect) return;
swf.innerHTML = "<object id=\""+swfId+"\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\""+width+"\" height=\""+height+"\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"inc/effects/"+effect+"\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"inc/effects/"+effect+"\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\""+width+"\" height=\""+height+"\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object>";
}