﻿// JScript File

hdnImageText3  = document.getElementById(hiddenImageText3);
hdnLinkURL3  = document.getElementById(hiddenLinkURL3);
   
var varProdCode3 = new Array(4);
   
//alert(hdnImageText.value);
var s3 = hdnImageText3.value.split(",");
var linkURL3 = hdnLinkURL3.value.split(",");
   
//end of setHiddenFieldClientId
		
var imgtext3 = new Array(s3.length);
var links3 = new Array(linkURL3.length);
var i3;

for(i3=0;i3<=s3.length-1;i3++)
{
    imgtext3[i3] = s3[i3];
    links3[i3] = linkURL3[i3];
}

theimage3 = new Array(s3.length);

for(i3=0 ; i3< s3.length ; i3++ )
{
    theimage3[i3] = [imgtext3[i3], links3[i3], varProdCode3[i3]];			
}

playspeed3=2000;// The playspeed determines the delay for the "Play" button in ms
linksperline3=2; // For the text links
playdiffernce3=200; // The speed that the autoplay speed is changed by. 1000=1sec

dotrans3=0; // if value = 1 then there are transitions played in IE
transtype3='revealtrans';// 'blendTrans' or 'revealtrans'
transattributes3='1';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i3=0;


//###########################################
window.onload=function()
{
    //preload images into browser
    preloadSlide3();

    //"jump to" box
    //for (y=0;y<theimage.length;y++) 
    //{
    //  document.forms[0].imgComboBox[y]=new Option(theimage[y][2]);
    //}

    //set transitions
    GetTrans3();

    //set the first slide
    SetSlide3(0);

}

//###########################################
function SetSlide3(num3) 
{
	//too big
	i3=num3%theimage3.length;
	//too small
	if(i3<0)i3=theimage3.length-1;

	//switch the image
	if(document.all&&!window.opera&&dotrans3==1)eval('document.images.imgslide3.filters.'+transtype3+'.Apply()')
	document.images.imgslide3.src=theimage3[i3][0];
	if(document.all&&!window.opera&&dotrans3==1)eval('document.images.imgslide3.filters.'+transtype3+'.Play()')

	//if drop down box
	

	//if they want name of current slide
    //document.getElementById('slidebox').innerHTML=theimage[i][2];

	//if they want current slide number and total
    //document.getElementById('slidecount').innerHTML= "Image "+(i+1)+" of "+theimage.length;

	//if they have the speed timer
	if(document.forms[0].slidespeed3)
		SetSpeed3(0);

}


//###########################################
function PlaySlide3() 
{
	if (!window.playing) 
	{
		PlayingSlide3(i3+1);
		if(document.forms[0].play)
			document.forms[0].play.value="   Stop   ";
	}
	else 
	{
		playing3=clearTimeout(playing3);
		if(document.forms[0].play)
			document.forms[0].play.value="   Play   ";
	}
	// if you have to change the image for the "playing" slide
	if(document.images.imgPlay)
	{
		setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
		imgStop=document.images.imgPlay.src
		//alert("called");
	}

}


//###########################################
function PlayingSlide3(num3) 
{
	playing3=setTimeout('PlayingSlide3(i3+1);SetSlide3(i3+1);', playspeed3);
}


//###########################################
function SetSpeed3(num3)
{
	if(playspeed3+num3>0)
	{
		playspeed3+=num3;
		document.forms[0].slidespeed3.value=playspeed3;
	}
}


//###########################################
//desc: picks the transition to apply to the images
function GetTrans3()
{
//		if((document.forms[0].trans && document.forms[0].trans.selectedIndex == 0) || (!document.forms[0].trans && dotrans==0))
//		{
//			dotrans=0;
//		}
//		else if ((document.forms[0].trans && document.forms[0].trans.selectedIndex == 1) || (!document.forms[0].trans && transtype == 'blendTrans'))
//		{
//			dotrans=1;
//			transtype='blendTrans';
//			document.imgslide.style.filter = "blendTrans(duration=1,transition=1)";
//		}
//		else
//		{
			dotrans3=0;
			transtype3='revealtrans';
			//if(document.forms[0].trans) transattributes = document.forms[0].trans[document.forms[0].trans.selectedIndex].value;
			//document.imgslide.style.filter = "revealTrans(duration=1,transition=" +transattributes+ ")";
			document.imgslide3.style.filter = "revealTrans(duration=1)";

//	}

}
//###########################################
function preloadSlide3() 
{
	for(k3=0;k3<theimage3.length;k3++) 
		theimage3[k3][0]=new Image().src=theimage3[k3][0];
}

