//var newStr = '"'+imgLst2+'"';
//var futureImages = '';
var timeid = '';
var whichpic = -1;
var idImg="";
var i=0;
var namexshort="";//substr(namex.length, "-1");

var oldImg = new Array(3);
var newImg = new Array(3);
var oldLnk = new Array(3);
var newLnk = new Array(3);
var oldAlt=new Array(3);
var newAlt=new Array(3);

function RunSlideShowLeft(namex, displaySecs)
{	
	
	//alert (whichpic);
	if(whichpic == -1){
		whichpic = 3;
		way = 'l';
	} else if (way == 'r' && whichpic<imgLst.length-1){
			whichpic ++;
		}
		
		else if (way == 'r' && whichpic==imgLst.length-1){
			whichpic = 2;
		}
		
		else {if(whichpic == imgLst.length-1) {
			whichpic = 2;
		} else if(whichpic > imgLst.length-1) {
			whichpic = whichpic - (imgLst.length-1);
		} else {
			whichpic++;
		}
	}
	
	
//alert(whichpic);
	way = 'l';

	//alert (document.getElementById("linkImageSlSh"+i).href);
	/*for (i=0; i<3; i++){
		oldImg[i]=document.getElementById("ImageSlSh"+i).src;
		oldLnk[i]=document.getElementById("linkImageSlSh"+i).href;
		oldAlt[i]=document.getElementById("linkImageSlSh"+i).getAttribute("alt");
	}*/
	
	//alert (oldImg[2]);
  /*var nextImage = imgLst[whichpic];
  var nextLink = lnkLst[whichpic];
  var nextAlt = fullDescLst[whichpic];*/
 // alert (nextAlt);
  newImg[0] = imgLst[whichpic-2];
	newImg[1] = imgLst[whichpic-1];
	newImg[2] = imgLst[whichpic];
	newLnk[0] = lnkLst[whichpic-2];
	newLnk[1] = lnkLst[whichpic-1];
	newLnk[2] = lnkLst[whichpic];
	newAlt[0] = fullDescLst[whichpic-2];
	newAlt[1] = fullDescLst[whichpic-1];
	newAlt[2] = fullDescLst[whichpic];
	
	for (i=0; i<3; i++){
		document.getElementById("ImageSlSh"+i).src=newImg[i];
		document.getElementById("linkImageSlSh"+i).href=newLnk[i];
		document.getElementById("linkImageSlSh"+i).setAttribute("alt",newAlt[i]);
	}
	
	//alert (newImg[1]);
	//alert (document.getElementById("linkImageSlSh1").getAttribute("alt"));
/*if (document.all) {
    document.getElementById(namex+'0').style.filter="blendTrans(duration=2)";
    document.getElementById(namex+'0').filters.blendTrans.Apply();
   document.getElementById(namex+'1').style.filter="blendTrans(duration=2)";
    document.getElementById(namex+'1').filters.blendTrans.Apply();
    document.getElementById(namex+'2').style.filter="blendTrans(duration=2)";
    document.getElementById(namex+'2').filters.blendTrans.Apply();

  }
 
  if (document.all) {
    document.getElementById(namex+'0').filters.blendTrans.Play();
    document.getElementById(namex+'1').filters.blendTrans.Play();
    document.getElementById(namex+'2').filters.blendTrans.Play();
  }
  
  //alert (document.getElementById("linkImageSlSh1").getAttribute("alt"));
  
	
	//alert (document.getElementById("linkImageSlSh1").getAttribute("alt"));
 
  var topl = (220 - document.getElementById(namex+'0').height) / 2;
  document.getElementById(namex+'0').style.top = topl+'px';
  var leftl = (250 - document.getElementById(namex+'0').width) / 2;
  document.getElementById(namex+'0').style.left = leftl+'px';
  var topl = (220 - document.getElementById(namex+'1').height) / 2;
  document.getElementById(namex+'1').style.top = topl+'px';
  var leftl = (250 - document.getElementById(namex+'1').width) / 2;
  document.getElementById(namex+'1').style.left = leftl+'px';
  var topl = (220 - document.getElementById(namex+'2').height) / 2;
  document.getElementById(namex+'2').style.top = topl+'px';
  var leftl = (250 - document.getElementById(namex+'2').width) / 2;
  document.getElementById(namex+'2').style.left = leftl+'px';
  */
 
  
  
  timeid = setTimeout("RunSlideShowLeft('"+namex+"',"+displaySecs+")", displaySecs*1000);
}


function RunSlideShowRight(namex, displaySecs)
{
	
	//alert (whichpic);
	if(whichpic == -1){
		whichpic = imgLst.length-1;
		way = 'r';
	} 
	else if 
		(way == 'l' && whichpic>3){
			whichpic--;
		}
	
	else	if (way == 'l' && whichpic==2){
			(whichpic=imgLst.length-1) ;
		}
	

	else {
		if(whichpic == 2) {
			whichpic = (imgLst.length-1);
		} else if(whichpic < 3) {
			whichpic = (imgLst.length-1) + whichpic ;
		} else {
			whichpic--;
		}
	}
	way = 'r';

//alert (whichpic);
	/*oldImg[0] = document.getElementById("ImageSlSh").src;
	oldImg[1] = document.getElementById("ImageSlSh2").src;
	oldImg[2] = document.getElementById("ImageSlSh3").src;*/
	
	/*for (i=0; i<3; i++){
		oldImg[i]=document.getElementById("ImageSlSh"+i).src;
		oldLnk[i]=document.getElementById("linkImageSlSh"+i).href;
		oldAlt[i]=document.getElementById("linkImageSlSh"+i).getAttribute("alt");
	}*/
  
  /*alert (whichpic);
  
  var nextImage = imgLst[whichpic];
  var nextLink = lnkLst[whichpic];
  var nextAlt = fullDescLst[whichpic];*/
  
  newImg[2] = imgLst[whichpic];
	newImg[1] = imgLst[whichpic-1];
	newImg[0] = imgLst[whichpic-2];
	newLnk[2] = lnkLst[whichpic];
	newLnk[1] = lnkLst[whichpic-1];
	newLnk[0] = lnkLst[whichpic-2];
	newAlt[2] = fullDescLst[whichpic];
	newAlt[1] = fullDescLst[whichpic-1];
	newAlt[0] = fullDescLst[whichpic-2];
  
   for (i=0; i<3; i++){
		document.getElementById("ImageSlSh"+i).src=newImg[i];
		document.getElementById("linkImageSlSh"+i).href=newLnk[i];
		document.getElementById("linkImageSlSh"+i).setAttribute("alt",newAlt[i]);
	}
	
	
	
 /*if (document.all) {
    document.getElementById(namex+'0').style.filter="blendTrans(duration=2)";
    document.getElementById(namex+'0').filters.blendTrans.Apply();
   document.getElementById(namex+'1').style.filter="blendTrans(duration=2)";
    document.getElementById(namex+'1').filters.blendTrans.Apply();
    document.getElementById(namex+'2').style.filter="blendTrans(duration=2)";
    document.getElementById(namex+'2').filters.blendTrans.Apply();

  }
 
  if (document.all) {
    document.getElementById(namex+'0').filters.blendTrans.Play();
    document.getElementById(namex+'1').filters.blendTrans.Play();
    document.getElementById(namex+'2').filters.blendTrans.Play();
  }
  
  //alert (document.getElementById("linkImageSlSh1").getAttribute("alt"));
  
	
	//alert (document.getElementById("linkImageSlSh1").getAttribute("alt"));
 
  var topl = (220 - document.getElementById(namex+'0').height) / 2;
  document.getElementById(namex+'0').style.top = topl+'px';
  var leftl = (250 - document.getElementById(namex+'0').width) / 2;
  document.getElementById(namex+'0').style.left = leftl+'px';
  var topl = (220 - document.getElementById(namex+'1').height) / 2;
  document.getElementById(namex+'1').style.top = topl+'px';
  var leftl = (250 - document.getElementById(namex+'1').width) / 2;
  document.getElementById(namex+'1').style.left = leftl+'px';
  var topl = (220 - document.getElementById(namex+'2').height) / 2;
  document.getElementById(namex+'2').style.top = topl+'px';
  var leftl = (250 - document.getElementById(namex+'2').width) / 2;
  document.getElementById(namex+'2').style.left = leftl+'px';*/
  
  
    
  
  timeid = setTimeout("RunSlideShowRight('"+namex+"',"+displaySecs+")", displaySecs*1000);
}



function stopSlideShow(){
	if(timeid!=''){
		clearTimeout(timeid);
	}
}


