function cta_fadein(num)
{
  var photo = $('photo'+num);
  photo.setOpacity(0.75);
  //new Effect.Appear(photo, { duration: 0.3, queue: 'end' });
}

function cta_fadeout(num)
{
  var photo = $('photo'+num);
  photo.setOpacity(1.0);
  //new Effect.Fade(photo, { duration: 0.3, queue: 'end' });  
}

function lightbox_isIE()
{
  var detect = navigator.userAgent.toLowerCase();
  var place = detect.indexOf('msie') + 1;
  return place;
}

function lightbox_getViewPortHeight()
{
  if (typeof window.innerWidth != 'undefined') // Mozilla
  {
    return window.innerHeight;
  }
  else if (typeof document.documentElement != 'undefined'
      && typeof document.documentElement.clientWidth !=
      'undefined' && document.documentElement.clientWidth != 0) // IE Standards compliant
  {
    return document.documentElement.clientHeight;
  }
  else // Old IE
  {
    return document.getElementsByTagName('body')[0].clientHeight;
  }  
}

function lightbox_prepareIE(height, overflow)
{
  bod = document.getElementsByTagName('body')[0];
  bod.style.height = height;
  bod.style.overflow = overflow;
  
  htm = document.getElementsByTagName('html')[0];
  htm.style.height = height;
  htm.style.overflow = overflow; 
}
	
function lightbox_toggleSelects(visibility)
{
  selects = document.getElementsByTagName('select');
  for(i = 0; i < selects.length; i++) 
  {
  	selects[i].style.visibility = visibility;
  }
}

function lightbox_shade()
{
	if(lightbox_isIE())
	{
    lightbox_prepareIE('100%', 'hidden');
	  lightbox_toggleSelects("hidden");
	  $('shader').style.top = document.body.scrollTop + "px";
	}
	
  $('shader').style.display = "block";
  $('lightbox').style.display = "block";
}

function lightbox_unshade()
{
	if(lightbox_isIE())
	{
		lightbox_prepareIE("auto","auto");
		lightbox_toggleSelects("visible");
    $('shader').hide();
    $('lightbox').hide();
	}
	else
	{
		$('lightbox').hide();
		Effect.Fade($('shader'), { duration: 0.4 });  
	}
}

function lightbox_centerWindow()
{
  var wnd = $('lightbox');
  var viewheight = lightbox_getViewPortHeight();
  var winheight = wnd.offsetHeight;
  var newtop = (viewheight - winheight)/2;
  if(lightbox_isIE())
  {
  	newtop += document.body.scrollTop;
  }
  wnd.style.top = newtop.toString() + "px";
}

function lightbox_openWindow()
{
  lightbox_shade();
  lightbox_centerWindow();
}

function lightbox_closeWindow()
{
  $('lightbox').hide();
  lightbox_unshade();
}


