
// Browser Slide-Show script. 
// Script copyright (C) 2004-2008 www.cryer.co.uk.

var FadeDurationMS=1000;

function SetOpacity(object,opacityPct) {
	// IE.
	object.style.filter = 'alpha(opacity=' + opacityPct + ')';
	// Old mozilla and firefox
	object.style.MozOpacity = opacityPct/100;
	// Everything else.
	object.style.opacity = opacityPct/100;
}

function ChangeOpacity(id,msDuration,msStart,fromO,toO) {
	var element=document.getElementById(id);
	var msNow = (new Date()).getTime();
	var opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
	if (opacity>=100)
	{
		SetOpacity(element,100);
		element.timer = undefined;
	}
	else if (opacity<=0)
	{
		SetOpacity(element,0);
		element.timer = undefined;
	}
	else 
	{
		SetOpacity(element,opacity);
		element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",10);
	}
}

function FadeInImage(foregroundID,newImage,backgroundID) {
	var foreground=document.getElementById(foregroundID);
	if (foreground.timer) window.clearTimeout(foreground.timer);

	if (backgroundID)
	{
		var background=document.getElementById(backgroundID);
		if (background)
		{
			if (background.src)
			{
				foreground.src = background.src;	
				SetOpacity(foreground,100);
			}
			background.src = newImage;
			background.style.backgroundImage = 'url(' + newImage + ')';
			background.style.backgroundRepeat = 'no-repeat';
			var startMS = (new Date()).getTime();
			foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "'," + FadeDurationMS + "," + startMS + ",100,0)",10);
		}
	} else {
		foreground.src = newImage;
	}
}

var slideCache = new Array();
function RunSlideShow(pictureID,backgroundID,imageFiles,displaySecs) {
	var imageSeparator = imageFiles.indexOf(";");
	var nextImage = imageFiles.substring(0,imageSeparator);
	FadeInImage(pictureID,nextImage,backgroundID);
	var futureImages = imageFiles.substring(imageSeparator+1,imageFiles.length)
		+ ';' + nextImage;
	setTimeout("RunSlideShow('"+pictureID+"','"+backgroundID+"','"+futureImages+"',"+displaySecs+")",
		displaySecs*1000);
	// Cache the next image to improve performance.
	imageSeparator = futureImages.indexOf(";");
	nextImage = futureImages.substring(0,imageSeparator);
	if (slideCache[nextImage] == null)
	{
		slideCache[nextImage] = new Image;
		slideCache[nextImage].src = nextImage;
	}
}


// ===============================================================================================================


function openWindow(url,x,y) 
{popupWin = window.open(url, 'remote',
'menubar=no, toolbar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no, dependent, width=' + x + ', height=' + y + ', left=50, top=50')
}

// ===============================================================================================================

// JAVASCRIPT IMAGE CHANGE


function LoadGallery(pictureName,imageFile) {
if (document.all)  {
    document.getElementById(pictureName).style.filter="blendTrans(duration=1)";
    document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = imageFile;
  if (document.all)  {
    document.getElementById(pictureName).filters.blendTrans.Play();
  }
}


function setSelected()
{
  aObj = document.getElementById('leftSide').getElementsByTagName('a');
  for(i=1;i<aObj.length;i++) { 
    if(document.location.href.indexOf(aObj[i].href)>=0) {
      aObj[i].className='active';
    }
  }
  if (document.getElementById('quicklinks') !== null) {
   aObj = document.getElementById('quicklinks').getElementsByTagName('a');
   for(i=1;i<aObj.length;i++) { 
     if(document.location.href.indexOf(aObj[i].href)>=0) {
       aObj[i].className='selected';
     }
   }
 }
}
window.onload = setSelected;

// ===============================================================================================================


function InsertTheatre() {

gfx0="http://www.selectsightseeing.co.uk/site-images/TH-LesMis.GIF";
lnk0="http://evanevanstickets.eolts.co.uk/theatre/les_miserables/pg:72/showid:1002";
alt0="London Theatre Tickets - Les Miserables";
txt0="http://evanevanstickets.eolts.co.uk/";

gfx1="http://www.selectsightseeing.co.uk/site-images/TH-LionKing.GIF";
lnk1="http://evanevanstickets.eolts.co.uk/tickets/the_lion_king/pg:72/showid:1001";
alt1="London Theatre Tickets - The Lion King";
txt1="http://evanevanstickets.eolts.co.uk/";

gfx2="http://www.selectsightseeing.co.uk/site-images/TH-Wicked.GIF";
lnk2="http://evanevanstickets.eolts.co.uk/tickets/wicked/pg:72/showid:1587";
alt2="London Theatre Tickets - Wicked";
txt2="http://evanevanstickets.eolts.co.uk/";

len=3;  
today=new Date();
today=today.getTime();
rnd=today%len; 
document.write('<h2 align="center"><a href="'+eval("lnk"+rnd)+'" target="_blank" onmouseover="window.status=\'+eval("txt"+rnd)+\';return true;" onmouseout="window.status=\' \';return true;">')
document.write('<img src="'+eval("gfx"+rnd)+'" border="0" width="468" height="60" title="'+eval("alt"+rnd)+'" alt="'+eval("alt"+rnd)+'">')
document.write("<\/a><\/h2>");

}



var ids=new Array('calendar');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(ids,q){
	//loop through the array and hide each element by id
	for (var i=0;i<q;i++){
		hidediv(ids+i);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

