

 hdnImageText1 = document.getElementById(hiddenImageText1);
 hdnlinkURL1 = document.getElementById(hiddenLinkURL1);
 hdnTextname1 = document.getElementById(hdnTextName1);
 hdnTextcode1 = document.getElementById(hdnTextCode1);

var varProdcode1 = new Array(4);
   
//alert(hdnImageText1.value);
var s1 = hdnImageText1.value.split(",");
var linkURL1 = hdnlinkURL1.value.split(",");
var name1  = hdnTextname1.value.split(",");
var code1 = hdnTextcode1.value.split(",");
   
//end of setHiddenFieldClientId

var imgtext1 = new Array(s1.length);
var links1 = new Array(linkURL1.length);
var productname1 = new Array(name1.length);
var productcode1 = new Array(code1.length);

var i1;

for(i1=0;i1<=s1.length-1;i1++)
{
    imgtext1[i1] = s1[i1];
    links1[i1] = linkURL1[i1];
    productname1[i1] = name1[i1];
    productcode1[i1] = code1[i1];
}

var theimage1 = new Array(s1.length);
for(i1=0 ; i1< s1.length ; i1++ )
{
    theimage1[i1] = [imgtext1[i1], links1[i1], productcode1[i1], productname1[i1]];
}

var playspeed1=3500;// The playspeed1 determines the delay for the "Play" button in ms
linksperline1=2; // For the text links1
playdiffernce1=500; // 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();

     //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
	try{	
	if(document.all&&!window.opera&&dotrans1==1)eval('document.images.imgslide1.filters.'+transtype1+'.Apply()')
	{
	document.images.imgslide1.src=theimage1[i1][0];
	document.getElementById("spancode1").innerText = document.getElementById("spancode1").textContent  = theimage1[i1][2];
	document.getElementById("spanname1").innerText = document.getElementById("spanname1").textContent  = theimage1[i1][3];
	}
	if(document.all&&!window.opera&&dotrans1==1)eval('document.images.imgslide1.filters.'+transtype1+'.Play()')
    }catch(e){}
	//if drop down box
	
    
	//if they want name1 of current slide
    //document.getElementById('slidebox').innerHTML=theimage1[i][2];

	//if they want current slide num1ber and total
    //document.getElementById('slidecount').innerHTML= "Image "+(i+1)+" of "+theimage1.length;

	//if they have the speed timer
	if(document.forms[0].slidespeed1)
		SetSpeed1(0);

}


//###########################################
function PlaySlide1() 
{
	if (!window.playing1) 
	{
		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="'+imgStop1+'"',1);
		imgStop1= 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 && dotrans1==0))
//		{
//			dotrans1=0;
//		}
//		else if ((document.forms[0].trans && document.forms[0].trans.selectedIndex == 1) || (!document.forms[0].trans && transtype1 == 'blendTrans'))
//		{
//			dotrans1=1;
//			transtype1='blendTrans';
//			document.imgslide.style.filter = "blendTrans(duration=1,transition=1)";
//		}
//		else
//		{
			dotrans1=1;
			transtype1='revealtrans';
			//if(document.forms[0].trans) transattributes1 = document.forms[0].trans[document.forms[0].trans.selectedIndex].value;
			//document.imgslide.style.filter = "revealTrans(duration=1,transition=" +transattributes1+ ")";
			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];
	
}

