﻿// JScript File

hdnImageText1  = document.getElementById(hiddenImageText1);
hdnLinkURL1  = document.getElementById(hiddenLinkURL1);
   
var varProdCode1 = new Array(4);
   
//alert(hdnImageText.value);
var s1 = hdnImageText1.value.split(",");
var linkURL1 = hdnLinkURL1.value.split(",");
   
//end of setHiddenFieldClientId
		
var imgtext1 = new Array(s1.length);
var links1 = new Array(linkURL1.length);
var i1;

for(i1=0;i1<=s1.length-1;i1++)
{
    imgtext1[i1] = s1[i1];
    links1[i1] = linkURL1[i1];
}

theimage1 = new Array(s1.length);

for(i1=0 ; i1< s1.length ; i1++ )
{
    theimage1[i1] = [imgtext1[i1], links1[i1], varProdCode1[i1]];			
}

playspeed1=2000;// The playspeed determines the delay for the "Play" button in ms
linksperline1=2; // For the text links
playdiffernce1=200; // The speed that the autoplay speed is changed by. 1000=1sec

dotrans1=0; // if value = 1 then there are transitions played in IE
transtype1='revealtrans';// 'blendTrans' or 'revealtrans'
transattributes1='1';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i1=0;


//###########################################
window.onload=function()
{
    //preload images into browser
    preloadSlide1();

    //"jump to" box
    //for (y=0;y<theimage.length;y++) 
    //{
    //  document.forms[0].imgComboBox[y]=new Option(theimage[y][2]);
    //}

    //set transitions
    GetTrans1();

    //set the first slide
    SetSlide1(0);

}

//###########################################
function SetSlide1(num1) 
{
	//too big
	i1=num1%theimage1.length;
	//too small
	if(i1<0)i1=theimage1.length-1;

	//switch the image
	if(document.all&&!window.opera&&dotrans1==1)eval('document.images.imgslide1.filters.'+transtype1+'.Apply()')
	document.images.imgslide1.src=theimage1[i1][0];
	if(document.all&&!window.opera&&dotrans1==1)eval('document.images.imgslide1.filters.'+transtype1+'.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].slidespeed1)
		SetSpeed1(0);

}


//###########################################
function PlaySlide1() 
{
	if (!window.playing) 
	{
		PlayingSlide1(i1+1);
		if(document.forms[0].play)
			document.forms[0].play.value="   Stop   ";
	}
	else 
	{
		playing1=clearTimeout(playing1);
		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 PlayingSlide1(num1) 
{
	playing1=setTimeout('PlayingSlide1(i1+1);SetSlide1(i1+1);', playspeed1);
}


//###########################################
function SetSpeed1(num1)
{
	if(playspeed1+num1>0)
	{
		playspeed1+=num1;
		document.forms[0].slidespeed1.value=playspeed1;
	}
}


//###########################################
//desc: picks the transition to apply to the images
function GetTrans1()
{
//		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
//		{
			dotrans1=0;
			transtype1='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.imgslide1.style.filter = "revealTrans(duration=1)";

//	}

}
//###########################################
function preloadSlide1() 
{
	for(k1=0;k1<theimage1.length;k1++) 
		theimage1[k1][0]=new Image().src=theimage1[k1][0];
}
