
// SLIDE SHOW

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 InsertMap()
{
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="550" height="295">\n');
document.write('<param name="movie" value="europe.swf?data_file=data.xml" />\n');
document.write('<p><a href="#" title="Interactive Map of Europe"><\/a><\/p>\n');
document.write('<!--[if !IE]> <-->\n');
document.write('<object type="application/x-shockwave-flash" data="europe.swf?data_file=data.xml" width="550" height="295">\n');
document.write('<param name="movie" value="europe.swf?data_file=data.xml" />\n');
document.write('</object>\n');
document.write('<p><a href="#" title="Interactive Map of Europe"><\/a><\/p>\n');
document.write('<!--> <![endif]-->\n');
document.write('<\/object>\n');
}

function LoadMap(pictureName,imageFile)
{
  document.getElementById(pictureName).src = imageFile;
}

function InsertSampleMovie1()
{
document.write('<object width="425" height="350">\n');
document.write('<param name="movie" value="http://www.youtube.com/v/0LWJs3FEQRM"></param>\n');
document.write('<param name="wmode" value="transparent"></param>\n');
document.write('<embed src="http://www.youtube.com/v/0LWJs3FEQRM" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed>\n');
document.write('</object>\n');
}

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')
}

function expand(param) {		
param.style.display=(param.style.display=="none")?"":"none";	
}

function myclick(i) {
        GEvent.trigger(gmarkers[i], "click");
}

function createMarker(point, name, detail) {
  var marker = new GMarker(point);
  GEvent.addListener(marker, "click", function() {
    marker.openInfoWindowHtml("<b>" + detail + "<\/b>");
  });
  gmarkers[i] = marker;
  side_bar_html += '<LI><a href="javascript:myclick(' + i + ')">' + name + '</a><br>';
  i++;
  return marker;
}

// ===============================================================================================================

// 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;



// ===============================================================================================================

// ADVERT BANNERS

function InsertHotel() {

gfx0="http://banners.affiliatefuture.com/3053/69380.gif";
lnk0="http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=54197&merchantID=3053&programmeID=8579&mediaID=69380&tracking=&url=";
alt0="Millenium Hotels";
txt0="http://www.milleniumhotels.com";

len=1;  
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>");

}

function InsertTheatre() {

gfx0="http://banners.affiliatefuture.com/2130/63216.gif";
lnk0="http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=54197&amp;merchantID=2130&amp;programmeID=5988&amp;mediaID=63216&amp;tracking=&amp;url=";
alt0="Busabout Europe";
txt0="http://www.busabout.com";

gfx1="http://www.eurotraveller.net/images/BBBanner.jpg";
lnk1="http://www.bigbrotherbackpacking.com";
alt1="Big Brother Backpacking";
txt1="http://www.bigbrotherbackpacking.com";

gfx2="http://banners.affiliatefuture.com/2319/39955.gif";
lnk2="http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=54197&amp;merchantID=2319&amp;programmeID=6368&amp;mediaID=39955&amp;tracking=&url=";
alt2="Wegolo - Book Budget Airlines";
txt2="http://www.wegolo.com";

gfx3="http://www.eurotraveller.net/images/worldnomads468.GIF";
lnk3="http://www.worldnomads.com/af.aspx?affiliate=eurtrv&amp;path=/";
alt3="World Nomads Travel Insurance";
txt3="http://www.worldnomads.com/";

len=4;  
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>");

}


// ===============================================================================================================

// CALENDAR

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';
		}
	}
}
