﻿// JScript File

hdnImageText2  = document.getElementById(hiddenImageText2);
hdnLinkURL2  = document.getElementById(hiddenLinkURL2);
hdnTextName2 = document.getElementById(hdnTextName2);
hdnTextCode2 = document.getElementById(hdnTextCode2);

var varProdCode2 = new Array(4);   

var s2 = hdnImageText2.value.split(",");
var linkURL2 = hdnLinkURL2.value.split(",");
var name2 = hdnTextName2.value.split(",");
var code2 = hdnTextCode2.value.split(",");
//end of setHiddenFieldClientId
		
var imgtext2 = new Array(s2.length);
var links2 = new Array(linkURL2.length);
var productname2 = new Array(name2.length);
var productcode2 = new Array(code2.length);
var i2;
for(i2=0;i2<=s2.length-1;i2++)
{
    imgtext2[i2] = s2[i2];
    links2[i2] = linkURL2[i2];
    productname2[i2] = name2[i2];
    productcode2[i2] = code2[i2];
}
theimage2 = new Array(s2.length);
for(i2=0 ; i2< s2.length ; i2++ )
{
    theimage2[i2] = [imgtext2[i2], links2[i2],productcode2[i2],productname2[i2]];			
}
playspeed2 = 3000;  // The playspeed1 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    =   '3';    // duration=seconds,transition=#<24
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]);
    //}
    //alert('onload - 2');
    //set transitions
    GetTrans2();
    //set the first slide
    SetSlide2(0);
}

//###########################################
function SetSlide2(num22) 
{
    //alert('SetSlide');
	//too big
	i2=num22%theimage2.length;
	//too small
	if(i2<0)i2=theimage2.length-1;

	//switch the image
	//alert(transtype1);
	if(document.all&&!window.opera&&dotrans2==1)eval('document.images.imgslide2.filters.'+transtype2+'.Apply()')
	{
	document.images.imgslide2.src=theimage2[i2][0];
	document.getElementById("spancode").innerText = document.getElementById("spancode").textContent  = theimage2[i2][2];
	document.getElementById("spanname").innerText = document.getElementById("spanname").textContent  = theimage2[i2][3];	
	}
	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 num22ber 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
	}
}


//###########################################
function PlayingSlide2(num22) 
{
//    if(document.getElementById(hiddenTest2).value == "1")
//    {
//        playspeed2 = 200;  // The playspeed1 determines the delay for the "Play" button in ms
//        document.getElementById(hiddenTest2).value = "2";
//    }
//    else
//    {
        playspeed2 = 2000;  // The playspeed1 determines the delay for the "Play" button in ms
//    }
    playing2=setTimeout('PlayingSlide2(i2+1);SetSlide2(i2+1);', playspeed2);
}


//###########################################
function SetSpeed2(num22)
{
	if(playspeed2+num22>0)
	{
		playspeed2+=num22;
		document.forms[0].slidespeed2.value=playspeed2;
	}
}


//###########################################
//desc: picks the transition to apply to the images
function GetTrans2()
{
			dotrans2=0;
			transtype2='revealTrans';
			document.imgslide2.style.filter = "revealTrans(duration=2)";
}
//###########################################
function preloadSlide2() 
{
	for(k2=0;k2<theimage2.length;k2++) 
	{
		theimage2[k2][0]=new Image().src=theimage2[k2][0];
    }
}
