// JavaScript Document
 
// alternate image in container at specified interval period
function RotateImages(ContainerNum,nStartIndex)
{
	var a = eval("ImageArr"+ContainerNum);
	var b = eval("ImageHolder"+ContainerNum);
	if (nStartIndex >= a.length)
		nStartIndex = 0;
	b.src = a[nStartIndex];
	window.setTimeout("RotateImages("+ContainerNum+","+ (nStartIndex+1)+")",5000);
}

// only worls for i.e.
function ImageSlideShow()
{
	var slideShowSpeed = 4000;
	var crossFadeDuration = 3;	
	
	if (document.all)
	{
		document.images.Photo.style.filter="blendTrans(duration=2)";
		document.images.Photo.style.filter="blendTrans(duration=crossFadeDuration)";
		document.images.Photo.filters.blendTrans.Apply();
	}
	
	document.images.Photo.src = preLoad[nIndex].src;
	
	if (document.all)
	{
		document.images.Photo.filters.blendTrans.Play();
	}
	
	nIndex++;
	if (nIndex > (p - 1))
		nIndex = 0;
	
	t = setTimeout('ImageSlideShow()', slideShowSpeed);
}

// open a new window & center it in screen
var newwindow;
function PopUp2(url)
{
	var leftpos = (screen.width  - 400) / 2;
	var toppos = (screen.height - 420) / 2;

	newwindow = window.open(url,'name','width=400,height=420,left='+leftpos+',top='+toppos);
/*	if (newwindow && window.focus)
	{ 
		newwindow.focus()
	}*/
}

// open a new window
function PopUp()
{
    url = document.getElementById("WebAddress").value;
	if (url.length != 0)
		newwindow = window.open(url,'name');
}

// replace image with specified image index from array (works for firefox, opera & IE)
// need to pass in string in quotes even if ID names
function UpdateImage2(ImageArray, IDNum, nIndex)
{
	var a = eval( ImageArray ); 
	var b = document.getElementById( IDNum ); 	
	if (nIndex >= a.length)
		nIndex = 0;
	b.src = a[nIndex];
}

// load a web page inside a container such as a div (page must be in same domain)
function LoadNewPage(address,id)
{ 
	var req = new XMLHttpRequest(); 
	req.open("GET", address, false);	
	req.send(null);  
	document.getElementById(id).innerHTML = req.responseText; 
} 

function LoadIframePage(iframeURL) 
{ 
    document.getElementById("WebAddress").value = iframeURL;
	parent.AttractionSites.location.href = iframeURL;
} 

