
hdnImageText6  = document.getElementById(hiddenImageText6);

hdnLinkURL6  = document.getElementById(hiddenLinkURL6);

hdnTextName6 = document.getElementById(hdnTextName6);

hdnTextCode6 = document.getElementById(hdnTextCode6);

var varProdCode2 = new Array(4);
   
//alert(hdnImageText.value);
var s = hdnImageText6.value.split(",");
var linkURL = hdnLinkURL6.value.split(",");
var name  = hdnTextName6.value.split(",");
var code = hdnTextCode6.value.split(",");
//end of setHiddenFieldClientId

var imgtext = new Array(s.length);
var links = new Array(linkURL.length);
var productname = new Array(name.length);
var productcode = new Array(code.length);
var i;

for(i=0;i<= s.length-1;i++)
{
    imgtext[i] = s[i];
    links[i] = linkURL[i];
    productname[i] = name[i];
    productcode[i] = code[i];
    
}

theimage = new Array(s.length);
for(i=0 ; i< s.length ; i++ )
{
    theimage[i] = [imgtext[i], links[i], productcode[i], productname[i]];
}

playspeed=3000;// The playspeed determines the delay for the "Play" button in ms
linksperline=2; // For the text links
playdiffernce=500; // The speed that the autoplay speed is changed by. 1000=1sec

dotrans=0; // if value = 1 then there are transitions played in IE
transtype='revealtrans';// 'blendTrans' or 'revealtrans'
transattributes='0';// duration=seconds,transition=#<24
//#####
//key that holds where in the array currently are
i=0;


//###########################################
window.onload=function()
{
    //preload images into browser
    preloadSlide();

     //set transitions
    GetTrans();

    //set the first slide
    SetSlide(0);

}

//###########################################
function SetSlide(num) 
{
	//too big
	i=num%theimage.length;
	//too small
	if(i<0)i=theimage.length-1;   
	//switch the image
	try{	
	if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Apply()')
	{
	document.images.imgslide.height="123";
	document.images.imgslide.width="123";
	document.images.imgslide.src=theimage[i][0];
	document.getElementById("spancode").innerText = document.getElementById("spancode").textContent  = theimage[i][2];
	document.getElementById("spanname").innerText = document.getElementById("spanname").textContent  = theimage[i][3];
	document.getElementById("hplnkProducts").href = theimage[i][1];
	document.getElementById("imglink").href = theimage[i][1];
	}
	if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Play()')
    }catch(e){}
	//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].slidespeed)
		SetSpeed(0);

}


//###########################################
function PlaySlide() 
{
	if (!window.playing) 
	{
		PlayingSlide(i+1);
		if(document.forms[0].play)
			document.forms[0].play.value="   Stop   ";
	}
	else 
	{
		playing=clearTimeout(playing);
		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 PlayingSlide(num) 
{
	playing=setTimeout('PlayingSlide(i+1);SetSlide(i+1);', playspeed);
}


//###########################################
function SetSpeed(num)
{
	if(playspeed+num>0)
	{
		playspeed+=num;
		document.forms[0].slidespeed.value=playspeed;
	}
}


//###########################################
//desc: picks the transition to apply to the images
function GetTrans()
{
//		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
//		{
			dotrans=0;
			transtype='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.imgslide.style.filter = "revealTrans(duration=1)";

//	}

}
//###########################################
function preloadSlide() 
{ 
	for(k=0;k<theimage.length;k++)	
		theimage[k][0]=new Image().src=theimage[k][0];
}

