var t
var j = 0
var jj = 0
var jjj = 0
var p = Pic.length

var preLoad = new Array()

for (i = 0; i < p; i++){
   preLoad[i] = new Image();
   preLoad[i].src = Pic[i];
}


function runSlideShow(){
   if (document.all){
//      document.getElementById('SlideShow').style.filter="blendTrans(duration=2)"
//      document.getElementById('SlideShow').style.filter="blendTrans(duration=crossFadeDuration)"
//objholder.filters[0].apply()
//objholder.style.visibility="visible"
//objholder.filters[0].play()
      document.getElementById('SlideShow').filters.blendTrans.Apply()      
   }

   document.getElementById('SlideShow').src = preLoad[j].src

   if (document.all){
      document.getElementById('SlideShow').filters.blendTrans.Play()
   }
	document.getElementById('SlidshowTxt').innerHTML = txtArr[j];
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}

// ISF1.11 :: Image swap-fade 
// *****************************************************
// DOM scripting by brothercake -- http://www.brothercake.com/
//******************************************************
//global object
var isf = { 'clock' : null, 'fade' : true, 'count' : 1 }
/*******************************************************



/*****************************************************************************
 List the images that need to be cached
*****************************************************************************/
// for (i=0; i < 4l i++)
//Pic[zArrPos] = 

isf.imgs = [];
for (i=0; i < zArrPos; i++)	isf.imgs[i] = Pic[i];

/*****************************************************************************
*****************************************************************************/



//cache the images
isf.imgsLen = isf.imgs.length;
isf.cache = [];
for(var i=0; i<isf.imgsLen; i++)
{
	isf.cache[i] = new Image;
	isf.cache[i].src = isf.imgs[i];
}
p = 0;
//swapfade setup function
function swapfade()
{

	//if the timer is not already going
	if(isf.clock == null)
	{

		//copy the image object 
		isf.obj = document.getElementById('SlideShow');
		
		//copy the image src argument 
		isf.src = Pic[p];
		
		//store the supported form of opacity
		if(typeof isf.obj.style.opacity != 'undefined') isf.type = 'w3c';
		else if(typeof isf.obj.style.MozOpacity != 'undefined') isf.type = 'moz';
		else if(typeof isf.obj.style.KhtmlOpacity != 'undefined') isf.type = 'khtml';
		else if(typeof isf.obj.filters == 'object') isf.type = (isf.obj.filters.length > 0 && typeof isf.obj.filters.alpha == 'object' && typeof isf.obj.filters.alpha.opacity == 'number') ? 'ie' : 'none';
		else isf.type = 'none';

		//if any kind of opacity is supported
		if(isf.type != 'none')
		{
			//copy and convert fade duration argument 
			//the duration specifies the whole transition
			//but the swapfade is two distinct transitions
			isf.length = parseInt(1, 10) * 500;
			
			//create fade resolution argument as 20 steps per transition
			//again, split for the two distrinct transitions
			isf.resolution = parseInt(1, 10) * 10;
			
			//start the timer
			isf.clock = setInterval('isf.swapfade()', isf.length/isf.resolution);
		} else {
			//just do the image swap
			isf.obj.src = isf.src;
		}
		document.getElementById('SlidshowTxt').innerHTML= txtArr[p];
	}
	p++;
	if (p == zArrPos) p = 0;
	t = setTimeout('swapfade()', slideShowSpeed);
};


//swapfade timer function
isf.swapfade = function()
{
	//increase or reduce the counter on an exponential scale
	isf.count = (isf.fade) ? isf.count * 0.9 : (isf.count * (1/0.9)); 
	
	//if the counter has reached the bottom
	if(isf.count < (1 / isf.resolution))
	{
		//clear the timer
		clearInterval(isf.clock);
		isf.clock = null;

		//do the image swap
		isf.obj.src = isf.src;

		//reverse the fade direction flag
		isf.fade = false;
		
		//restart the timer
		isf.clock = setInterval('isf.swapfade()', isf.length/isf.resolution);

	}
	
	//if the counter has reached the top
	if(isf.count > (1 - (1 / isf.resolution)))
	{
		//clear the timer
		clearInterval(isf.clock);
		isf.clock = null;

		//reset the fade direction flag
		isf.fade = true;
		
		//reset the counter
		isf.count = 1;
	}

	//set new opacity value on element
	//using whatever method is supported

	switch(isf.type)
	{
		case 'ie' :
			isf.obj.filters.alpha.opacity = isf.count * 100;

			break;
			
		case 'khtml' :
			isf.obj.style.KhtmlOpacity = isf.count;
			break;
			
		case 'moz' : 
			//restrict max opacity to prevent a visual popping effect in firefox
			isf.obj.style.MozOpacity = (isf.count == 1 ? 0.9999999 : isf.count);
			break;
			
		default : 
			//restrict max opacity to prevent a visual popping effect in firefox
			isf.obj.style.opacity = (isf.count == 1 ? 0.9999999 : isf.count);
	}
};