var bIsOpen = false;
var bShowID = null;
var bHeightMini = 450;
var bHeightFull = 550;
var bHeightNow = bHeightMini;

function BookerPosition()
{
  //e("booker_wrap").style.top = getScroll().toString() + "px";
  defBookerPad = bHeightNow/2;
  e("booker").style.marginTop = ((-1 * defBookerPad) + getScroll()).toString() + "px";
  e("booker_shadows").style.marginTop = ((-1 * defBookerPad) + getScroll()).toString() + "px";
  
  
//  defBookerPad = e("booker").style.height/2;
}
window.onscroll = function() { if (bIsOpen) BookerPosition(); }
function Booker(showID,showADCRef)
{


  bShowID = showID;
  bIsOpen = true;



  if(showADCRef != null && showADCRef != "")
  {
     window.open("http://www.adcticketing.com/");
     return;

  }
  else
  {
  BookerPosition();
  show("booker_wrap");
  show("booker");
  for(q=1;q<=4;q++)show("booker_shadow"+q.toString());
     e("booker_frame").src = WEBROOT + "booker/?show=" + showID.toString();
  }
}
function BookerExpand()
{
  bHeightNow = bHeightFull;
  e("booker").className = "bookerlarge";
  BookerPosition();
}
function BookerContract()
{
  bHeightNow = bHeightMini;
  e("booker").className = "";
  BookerPosition();
}
function BookerClose()
{
  bIsOpen = false;
  e("booker_frame").src = WEBROOT + "blank.html";
  hide("booker_wrap");
  hide("booker");
  for(q=1;q<=4;q++)hide("booker_shadow"+q.toString());
}
function BookerThanks()
{
  BookerClose();
  alert("Thank you for your booking. An email has been sent to you confirming your booking.");
}


function e(i){return document.getElementById(i);}
function show(i){document.getElementById(i).style.display="";}
function hide(i){document.getElementById(i).style.display="none";}
function getScroll()
{
  var r = document.body.scrollTop;
  if (r == 0)
  {
    if (window.pageYOffset) r = window.pageYOffset;
    else r = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
  }
  return r;
}

var statusTimer = null;
function ShowStatus(sType,sMsg)
{
  window.clearTimeout(statusTimer);
  e("statusmsg").className="statusmsg statusmsg_" + sType;
  e("statusmsg").innerHTML = sMsg;
  show("statusmsg");
  window.setTimeout("HideStatus()",5000);
}
function HideStatus() 
{
  hide("statusmsg");
}

function MailingSignup(email,list)
{
  e("mailinglist_submit").value = "Sign up";
  e("mailinglist_submit").disabled = true;
  $.get(WEBROOT + "mailing-signup.php?address=" + email + "&list=" + list, MailingResponse );

}
function MailingResponse()
{
  alert("Your subscription has been sent to our Communications Officer who will sign you up to the mailing list shortly.\n\nThank you!");
  e("mailinglist_submit").value = "Sign up";
  e("mailinglist_submit").disabled = false;
}
