// JavaScript Document
function ChangePic(picId)
{
	bigPic.src = images[picId].src;
	bigPic.alt = titles[picId];
	bigPic.border = 1;
	title.innerHTML = titles[picId];
	desc.innerHTML = descs[picId];
	//alert(document.getElementById(picId));
	if (document.getElementById(picId) != null)
	{
		var thumb = document.getElementById(picId);
		//thumb.scrollIntoView();
		for (i=0; i < ids.length; i++)
		{
			document.getElementById(ids[i]).className = "deselected";	
		}
		thumb.className = "selected";
	}
	if (u != null)
	{
		clearTimeout(u);
	}
	if (v != null)
	{
		clearTimeout(v);
	}
}
function BeginShow()
{
	startss.className = "buttondown";
	pausess.className = "button";
	t = setTimeout("SlideShow()", interval);
}
function SlideShow()
{
	var index = GetPic();
	index++;
	if (index >= ids.length)
	{
		index = 0;
	}
	var picId = ids[index];
	//alert(picId);
	FadeOut(picId, 100);
	t = setTimeout("SlideShow()", interval);
}
function PauseShow()
{
	if (t != null)
	{
		clearTimeout(t);
	}
	startss.className = "button";
	pausess.className = "buttondown";
}
function FadeOut(newpic, opacity)
{
	//var obj = images[pic];
	//alert("called");
	//alert(opacity);
    if (opacity >= 60) {
      SetOpacity(opacity);
      opacity -= 5;
      u = window.setTimeout("FadeOut(" + newpic + ", " + opacity + ")", fadespeed);
	  }
	 else
	 {
		ChangePic(newpic);
		//SetOpacity("slideshowPic", 0);
		FadeIn(50);
	}
}
function FadeIn(opacity)
{
	//var obj = images[pic];
	if (opacity <= 100) {
      SetOpacity(opacity);
      opacity += 5;
      v = window.setTimeout("FadeIn(" + opacity + ")", fadespeed);
    }
}
function SetOpacity(opacity)
{
	//alert(opacity);
	opacity = (opacity == 100)?99.999:opacity;
	//if (isNaN(pic) == false)
	//{
		//var obj = images[pic];
	//}
  	//else
	//{
	//var obj = document.getElementById("slideshowPic");
	//}
  // IE/Win
  if (opacity >=0 && opacity <= 100)
  {
  bigPic.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
 // obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  //obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  bigPic.style.opacity = opacity/100;
  }
}
function GetPic()
{
	for (i=0; i < ids.length; i++)
	{
		if (bigPic.src == images[ids[i]].src)
		{
			return i;
			break;
		}
	}
}
function Zoom(area)
{
	if (tozoom == 1)
	{ 
		tozoom = 0;
		floorplan.src = main_pic.src;
		floorplan.removeAttribute("useMap");
		floorplan.setAttribute("useMap", "#small_map");
	}
	else if (tozoom == 0)
	{
		tozoom = 1;
		floorplan.src = parts[area].src;
		floorplan.removeAttribute("useMap");
		floorplan.setAttribute("useMap", "#" + maps[area]);
		alert(floorplan.getAttribute("useMap"));
	}
}
/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
 
