rotator=true; 		// needed for initialising the rotator
n=0;				// initialising the first image 
direction=1;		// init direction to forward
speed=6500;			// slideshow speed in miliseconds
srcimage='myImage'; // init image name
run=0;				// init run value
counter=0			// init counter for arrays	
var crossFadeDuration = 3 //init fade duration
imgObjects=new Array(); 
imgCaption=new Array(); 
imgDepot=new Array(); 
imgWidth=new Array(); 
imgHeight=new Array(); 
imgPhoto=new Array();

function playshow(theme)
{
	// delete old settings
	clearInterval(rotator)
	run = !run;

		if (run != 0)
		{
			rotator=setInterval("rotate("+direction+")",speed)
			document.images['play'].src = "../../../sites/templates/"+theme+"/images/btn_slide_pause.gif";
		}
		else
		{
			clearInterval(rotator)
			document.images['play'].src = "../../../sites/templates/"+theme+"/images/btn_slide_play.gif";
		}
}

function play(flavor)
{

	//This function is used for Original Jellybeans Template
	// delete old settings
	clearInterval(rotator)
	run = !run;

		if (run != 0)
		{
			rotator=setInterval("rotate("+direction+")",speed)
			document.images['play'].src = "../../../sites/templates/jellybeans/images/buttons/btn_slide_stop_"+flavor+".gif";
		}
		else
		{
			clearInterval(rotator)
			document.images['play'].src = "../../../sites/templates/jellybeans/images/buttons/btn_slide_play_"+flavor+".gif";
		}
}

function playing(flavor,font)
{
//This function is used for Designer Jellybeans Template
	// delete old settings
	clearInterval(rotator)
	run = !run;

		if (run != 0)
		{
			rotator=setInterval("rotate("+direction+")",speed)
			document.images['play'].src = "../../../sites/templates/designer/images/buttons/pause_"+flavor+"_"+font+".gif";
		}
		else
		{
			clearInterval(rotator)
			document.images['play'].src = "../../../sites/templates/designer/images/buttons/play_"+flavor+"_"+font+".gif";
		}
}

function playslide(flavor)
{
//This function is used for Cool Beans Template
	// delete old settings
	clearInterval(rotator)
	run = !run;

		if (run != 0)
		{
			rotator=setInterval("rotate("+direction+")",speed)
			document.images['play'].src = "../../../sites/templates/cool/images/buttons/btn_slide_pause_"+flavor+".gif";
		}
		else
		{
			clearInterval(rotator)
			document.images['play'].src = "../../../sites/templates/cool/images/buttons/btn_slide_play_"+flavor+".gif";  						
		}
}

//common slideshow
function slideshow( theme, flavor, font )
{
    clearInterval(rotator);
    run = !run;

    if ( run != 0 )
    {
        rotator = setInterval("rotate(" + direction + ")", speed);
        document.images['play'].src = "../../../sites/templates/"+theme+"/images/buttons/btn_pause_"+flavor+".png";
    }
    else
    {
        clearInterval(rotator);
        document.images['play'].src = "../../../sites/templates/"+theme+"/images/buttons/btn_play_"+flavor+".png";
    }
}

function playslide_tinyprints( flavor )
{
    //This function is used for Tiny Prints Template
    // delete old settings
    clearInterval(rotator);
    run = !run;

    if ( run != 0 )
    {
        rotator = setInterval("rotate(" + direction + ")", speed);
        document.images['play'].src = "../../../sites/templates/tinyprints/images/buttons/btn_pause_" + flavor + ".gif";
    }
    else
    {
        clearInterval(rotator);
        document.images['play'].src = "../../../sites/templates/tinyprints/images/buttons/btn_play_" + flavor + ".gif";
    }
}

function playslide_wrybaby( flavor )
{
    //This function is used for Wry Baby Template
    // delete old settings
    clearInterval(rotator);
    run = !run;

    if ( run != 0 )
    {
        rotator = setInterval("rotate(" + direction + ")", speed);
        document.images['play'].src = "../../../sites/templates/wrybaby/images/buttons/btn_pause_" + flavor + ".png";
    }
    else
    {
        clearInterval(rotator);
        document.images['play'].src = "../../../sites/templates/wrybaby/images/buttons/btn_play_" + flavor + ".png";
    }
}

function playslide_ericcarle()
{
    //This function is used for WEC Template
    // delete old settings
    clearInterval(rotator);
    run = !run;

    if ( run != 0 )
    {
        rotator = setInterval("rotate(" + direction + ")", speed);
        document.images['play'].src = "../../../sites/templates/ericcarle/images/buttons/btn_pause.png";
    }
    else
    {
        clearInterval(rotator);
        document.images['play'].src = "../../../sites/templates/ericcarle/images/buttons/btn_play.png";
    }
}

//used for threadless
function playslideshow( theme, font )
{
    clearInterval(rotator);
    run = !run;

    if ( run != 0 )
    {
        rotator = setInterval("rotate(" + direction + ")", speed);
        document.images['play'].src = "../../../sites/templates/" + theme + "/images/buttons/btn_pause_" + font + ".png";
    }
    else
    {
        clearInterval(rotator);
        document.images['play'].src = "../../../sites/templates/" + theme + "/images/buttons/btn_play_" + font + ".png";
    }
}

function rotate(direction)
{
n=n+direction;
if (n==counter) n=0;
if (n==-1) n=counter-1;

   if (document.all){
      document.images[srcimage].style.filter="blendTrans(duration=2)"
      document.images[srcimage].style.filter="blendTrans(duration=crossFadeDuration)"
      document.images[srcimage].filters.blendTrans.Apply()      
   }
	document.images[srcimage].src=imgObjects[n].src;
   if (document.all){
      document.images[srcimage].filters.blendTrans.Play()
   }

update('caption',imgCaption[n]); 
update('count', n+1 +' of '+counter+' photos');
}

function update(id,val)
{
if (document.getElementById)
	{
		x = document.getElementById(id);
		x.innerHTML = val;
	}
	else if (document.all)
	{
		x = document.all[id];
		x.innerHTML = val;
	}
	else if (document.layers)
	{
		x = document.layers[id];
		text2 = val;
		x.document.open();
		x.document.write(text2);
		x.document.close();
	}
}

function showFullSize()
{ 
  var URL = imgDepot[n];
  newWindow = window.open(URL,"newWindow",'toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,resizable=yes,width=600,height=400,screenx=10,screeny=10,top=10,left=10'); 
  newWindow.focus(); 
} 


