﻿// JScript File

hdnImageText2  = document.getElementById(hiddenImageText2);
hdnLinkURL2  = document.getElementById(hiddenLinkURL2);
   
var varProdCode2 = new Array(4);
   
//alert(hdnImageText.value);
var s2 = hdnImageText2.value.split(",");
var linkURL2 = hdnLinkURL2.value.split(",");
   
//end of setHiddenFieldClientId
		
var imgtext2 = new Array(s2.length);
var links2 = new Array(linkURL2.length);
var i2;

for(i2=0;i2<=s2.length-1;i2++)
{
    imgtext2[i2] = s2[i2];
    links2[i2] = linkURL2[i2];
}

theimage2 = new Array(s2.length);

for(i2=0 ; i2< s2.length ; i2++ )
{
    theimage2[i2] = [imgtext2[i2], links2[i2], varProdCode2[i2]];			
}

playspeed2=2000;// The playspeed determines the delay for the "Play" button in ms
linksperline2=2; // For the text links
playdiffernce2=300; // The speed that the autoplay speed is changed by. 1000=1sec

dotrans2=0; // if value = 1 then there are transitions played in IE
transtype2='revealtrans';// 'blendTrans' or 'revealtrans'
transattributes2='1';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i2=0;


//###########################################
window.onload=function()
{
    //preload images into browser
    preloadSlide2();

    //"jump to" box
    //for (y=0;y<theimage.length;y++) 
    //{
    //  document.forms[0].imgComboBox[y]=new Option(theimage[y][2]);
    //}

    //set transitions
    GetTrans2();

    //set the first slide
    SetSlide2(0);

}

//###########################################
function SetSlide2(num2) 
{
	//too big
	i2=num2%theimage2.length;
	//too small
	if(i2<0)i2=theimage2.length-1;

	//switch the image
	if(document.all&&!window.opera&&dotrans2==1)eval('document.images.imgslide2.filters.'+transtype2+'.Apply()')
	document.images.imgslide2.src=theimage2[i2][0];
	if(document.all&&!window.opera&&dotrans2==1)eval('document.images.imgslide2.filters.'+transtype2+'.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].slidespeed2)
		SetSpeed2(0);

}


//###########################################
function PlaySlide2() 
{
	if (!window.playing) 
	{
		PlayingSlide2(i2+1);
		if(document.forms[0].play)
			document.forms[0].play.value="   Stop   ";
	}
	else 
	{
		playing2=clearTimeout(playing2);
		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 PlayingSlide2(num2) 
{
	playing2=setTimeout('PlayingSlide2(i2+1);SetSlide2(i2+1);', playspeed2);
}


//###########################################
function SetSpeed2(num2)
{
	if(playspeed2+num2>0)
	{
		playspeed2+=num2;
		document.forms[0].slidespeed2.value=playspeed2;
	}
}


//###########################################
//desc: picks the transition to apply to the images
function GetTrans2()
{
//		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
//		{
			dotrans2=0;
			transtype2='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.imgslide2.style.filter = "revealTrans(duration=1)";

//	}

}
//###########################################
function preloadSlide2() 
{
	for(k2=0;k2<theimage2.length;k2++) 
		theimage2[k2][0]=new Image().src=theimage2[k2][0];
}

