// JavaScript Document
var slideShowSpeed = 10000;
var crossFadeDuration = 20;

var t;
var t2;
var p;
var p2;

var j = Math.floor(Math.random()*1);
var j2 = Math.floor(Math.random()*1);
var preLoad = new Array();
var preLoad2 = new Array();
var whichlink=0;
var whichimage=0;
var slidelinks=new Array();
var newwindow=1; //open links in new window? 1=yes, 0=no

function transfer(Pic)
{
	p = Pic.length;
	for (i = 0; i < Pic.length; i++)
	{
	   preLoad[i] = new Image();
	   preLoad[i].src = Pic[i];
	}
	
}
function transfer2(Pic2)
{
	p = Pic2.length;
	for (i = 0; i < Pic2.length; i++)
	{
	   preLoad2[i] = new Image();
	   preLoad2[i].src = Pic2[i];
	}
	
}

function transferLink(lnk)
{
	for(y=0;y<lnk.length;y++)
	{
		slidelinks[y] = lnk[y];
	}
}

function runSlideShow(){
   if (document.all){
      //document.images.SlideShow.style.filter="blendTrans(duration=20)";
      document.images.SlideShow.style.filter="blendTrans(duration=7)";
      document.images.SlideShow.filters.blendTrans.Apply();
   }
   document.images.SlideShow.src = preLoad[j].src;
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play();
   }
   j = j + 1;
   if (j > (p-1)) j=0;
   t = setTimeout('runSlideShow()', slideShowSpeed);
}

function runSlideShow2(){
   if (document.all){
      document.images.SlideShowFlag.style.filter="blendTrans(duration=5)";
      //document.images.SlideShowFlag.style.filter="blendTrans(duration=crossFadeDuration)";
      document.images.SlideShowFlag.filters.blendTrans.Apply();
   }
   document.images.SlideShowFlag.src = preLoad2[j].src;
   if (document.all){
      document.images.SlideShowFlag.filters.blendTrans.Play();
   }
   j2 = j2 + 1;
   if (j2 > (p2-1)) j2=0;
   t2 = setTimeout('runSlideShow2()', slideShowSpeed);
}

function gotoshow()
{
	if (newwindow)
	window.open(slidelinks[whichlink]);
	else
	window.location=slidelinks[whichlink];
}


function pictile()
{
	var col=2;
	var counter2= 0;
	var wscrn = screen.width;
	if(wscrn<1300){
		col=2;
	} else{
		col=3;
	}
	document.write("<table cellpadding=5 cellspacing=5>");
	for(x=0;x<picnum;x++)
	{
		if(counter2==0)
		{
			document.write("<tr>");
		}
		document.write("<td>");
		y=x+1;
		document.write("<img src="+fileloc+"/img"+y+".jpg width="+width+" height="+height+" border=0></td>");
		counter2++;
		if(counter2==col)
		{
			document.write("</tr>\n");
			counter2=0;
		}
	}
	var rem = picnum % col;
		if(rem>0)
		{
			for(z=0;z<rem;z++)
			{
			document.write("<td></td>");
			}
		document.write("</tr>");
		}
document.write("</table>");	
	}

