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";  						
		}
}

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(); 
} 

function submitOrderPrint()
{
var shutterflyWindow;

var bjb = "http://www.babyjellybeans.com";
var base = "http://www.shutterfly.com/c4p/UpdateCart.jsp";
var p1 = "?" + "addim" + "=" + "1";
var p2 = "&" + "protocol" + "=" + "SFP,100";
var p3 = "&" + "pid" + "=" + "C4PP";
var p4 = "&" + "psid" + "=" + "BABY1";
var p5 = "&" + "imnum" + "=" + "1";
var p6 = "&" + "imraw-1" + "=" + bjb + imgDepot[n];
var p7 = "&" + "imrawheight-1" + "=" + imgHeight[n];
var p8 = "&" + "imrawwidth-1" + "=" + imgWidth[n];
var p9 = "&" + "imthumb-1" + "=" + imgObjects[n].src;
var p10 = "&" + "imbkprnta-1" + "=" + imgCaption[n];
var p11 = "&" + "returl" + "=" + bjb + "/close.html";
var URL = base + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + p9 + p10 + p11;

window.open(URL, shutterflyWindow,'toolbar=no,location=no,directories=no,menubar=yes,scrollbars=yes,resizable=yes,width=750,height=800,screenx=10,screeny=10,top=10,left=10');
    doCountPrint();

}

