<!--

var g_sessionTimeout = 30;
setTimeout("updateSessionTimer()", 5000);


function openBrWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}


// ** [browseTab] ** //
var noBrowseTabs = 4;

function activateTab(tNo) {
  for (i=1;i<=noBrowseTabs;i++) {
	tObj = document.getElementById("t" + i);
	cObj = document.getElementById("c" + i);

	if (i == tNo) {
	  tObj.className = "tab selected";

	  cObj.style.display = "block";
	  cObj.style.visibility = "visible";

	} else {
	  tObj.className = "tab";

	  cObj.style.display = "none";
	  cObj.style.visibility = "hidden";
	}
  }
}


function dasMeDaSelector(obj, url) {
  document.location.href = url + obj[obj.selectedIndex].value;
}


var prevCalItem = 0;

function selDate(i) {
  if (prevCalItem > 0 && prevCalItem != i) {
    // color prev item grey
    x = document.getElementById("c" + prevCalItem);
    x.style.backgroundColor = '#d9d9d9';
  }

  x = document.getElementById("c" + i);
  fld = document.searchForm.sd;
  if (i == prevCalItem) {
    // clicked same item - turn to grey
    x.style.backgroundColor = '#d9d9d9';
    fld.value = '';
    prevCalItem = 0;
  } else {
    x.style.backgroundColor = '#FFDADA';
    fld.value = i;
    prevCalItem = i;
  }
}


// ** [browseTab] ** //


// ** [searchTab] ** //

function clearSearch(d) {
  // clear for items
  frm = document.searchForm;
  frm.k.value = '';
  frm.v.selectedIndex = 0;

  if (prevCalItem > 0) { selDate(prevCalItem); }
  var x = d.split(',');
  for (i=0;i<x.length;i++) {
    eval('frm.a' + x[i] + '.selectedIndex = 0;');
  }
}

// ** [searchTab] ** //

var alertsShown = new Array()
function showAlert(msg, status) {

  for (i = 0;i <= alertsShown.length;i++) {
    if (alertsShown[i] == status) {
      return;
    }
  }
  alertsShown[alertsShown.length+1] = status;
  alert(msg);
}

var submitCount = 0;
function checkoutSubmit() {
  if (submitCount == 0) {
    submitCount ++;
    return true;
  } else {
    alert("The transaction is in process - please click OK and wait for a result.");
    return false;
  }
}


function sn(i) {
  if (document.sessionForm.serialNo.value == '') {
    b = false;
  } else {
    b = true;
  }

  if (i == 0) {
    document.sessionForm.pass.checked = b;
  } else {
    document.sessionForm.pass[i].checked = b;
  }

}

function mn(s) {
  var fld1;
  var fld2;
  eval('fld1 = document.sessionForm.membershipNo' + s);
  eval('fld2 = document.sessionForm.memChk' + s);

  if (fld1.value == '') {
    fld2.checked = false;
  } else {
    fld2.checked = true;
  }
}

function mn2(s) {
  var fld1;
  var fld2;
  eval('fld1 = document.sessionForm.membershipNo' + s);
  eval('fld2 = document.sessionForm.qty' + s);

  if (fld1.value == '') {
    fld2.disabled = true;
  } else {
    fld2.disabled = false;
  }
}


function clearCart() {
  if (confirm("Are you sure you wish to clear your cart?") == true) {
    document.location.href='cartUtil.asp?m=clear';
  }
}

function cancelSubmit() {
  return false;
}

function checkCardType(i) {
  var frm = document.aForm;
  if (!frm.cardType.length) {
    frm.cardType.checked = true;
  } else {
    frm.cardType[i].checked = true;
  }
}



function addPass() {

  // record sn details before adding html
  var sn = document.sessionForm.serialNo;

  document.getElementById('passBoxes').innerHTML += '<br />Pass No: <input type="text" name="serialNo" value="" maxlength="10" />';
  //sn = sn.split(', ');

  if (!sn.length) {
    document.sessionForm.serialNo[0].value = sn.value;
  } else {

    for (var i=0;i<sn.length;i++) {
      if (sn[i].value != '') {
        document.sessionForm.serialNo[i].value = sn[i].value;
      }
    }
  }

}

function useMobile() {
  //var html = '';
  //html = '<div style="position:absolute;top:50%;left:50%;margin-left:-121px;margin-top:-80px;width:150px;height:150px;background:url(img/mobilePhone.png) no-repeat;height:159px;width:242px;z-index:22;filter:alpha(opacity=100);	-moz-opacity:100;opacity:100;padding:15px;" id="mobilePhoneQ1">';
  //html += '<div style="width:155px;font-size:12px;font-weight:bold;color:#fff;margin-bottom:40px;">Would you like to use the mobile version of this website?</div>'
  //html +='<div style="float:left;padding-right:25px;"><a href="Javascript:selectMobile(false)"><img src="img/mobilePhoneNo.png" alt="No thanks" /></a></div>'
  //html += '<div style="float:left;"><a href="Javascript:selectMobile(true)"><img src="img/mobilePhoneOK.png" alt="OK" /></a></div>';
  //html += '</div>';
  //html +='<div style="width:100%;height:100%;background:#333;position:absolute;filter:alpha(opacity=70);-moz-opacity:0.7;opacity:0.7;color:#fff;z-index:11;" id="mobilePhoneQ2">&nbsp;</div>';

  //document.body.innerHTML += html;

  if (confirm('Would you like to use the mobile version of this website?') == true) {
  	selectMobile(true);
  } else {
  	selectMobile(false);
  }

}


function selectMobile(answer) {
  var x = document.getElementById('mobilePhoneQ1');
  if (x) {
    x.style.display = 'none';
  }
  x = document.getElementById('mobilePhoneQ2');
  if (x) {
    x.style.display = 'none';
  }

  if (answer == true) {
    switchToMobile(1);
  }
}


function cleanLoc(loc) {
  if (loc.indexOf("px") != -1) {
    loc = loc.substring(0, (loc).indexOf("px"))
  }
  loc = parseInt(loc);
  return loc;
}



function expandSessionImage(i) {
	var x = document.getElementById("sessionImage");
	if (x.style.width == "" || x.style.width == (i + "px")) {
		x.style.width = "100%";
	}  else {
		x.style.width = i + "px";
	}
}

function readMore(b) {
	var x = document.getElementById("sessionDescriptionMoreText")
	var y = document.getElementById("sessionDescriptionMoreLink")
	var z = document.getElementById("sessionDescriptionLessLink")

	if (b == true) {
		x.style.display = 'inline';
		y.style.display = 'none';
		z.style.display = 'inline';
	} else {
		x.style.display = 'none';
		y.style.display = 'inline';
		z.style.display = 'none';
	}
}





function jsWebRequest(URL, fallbackURL, divName, callFunction) {
  // If eeeyax is available use
  var xmlHttp;

  try {
    // Firefox, Opera 8.0+, Safari (best browser by the way)
    xmlHttp = new XMLHttpRequest();
  }
  catch(e) {
    // Billies special browser
    try {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e) {
      try {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e) {
        // browser is bad and can't handle eeeeyaxe (Suprised it isn't IE)
        if (fallbackURL != '') {
          document.location.href = fallbackURL;
        } else {
          alert(e.description);
        }
        return;
      }
    }
  }

  // Code to execute once web request complete
  xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState == 4) {
      if (xmlHttp.responseText != '') {

         //alert(xmlHttp.responseText);

        if (divName != '') {
          x = document.getElementById(divName);
          x.innerHTML = xmlHttp.responseText;
        }
        if (callFunction != '') {
          if (callFunction.indexOf(')') > -1) { callFunction = callFunction.substring(0, callFunction.indexOf(')')); }
          if (callFunction.indexOf('(') == -1) { callFunction += '('; }
          eval(callFunction + "'" + escape(xmlHttp.responseText) + "')");
        }
      } else {
        if (fallbackURL != '') {
          document.location.href = fallbackURL;
        }
      }
    }
  }

  xmlHttp.open("GET", URL + returnUniqueID(), true);
  xmlHttp.send(null);

}


function returnUniqueID() {
  var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
  var myStr = '&';
  for (var i=0; i<8; i++) {
    var randNum = Math.floor(Math.random() * chars.length);
    myStr += chars.substring(randNum, randNum+1);
  }
  myStr += "="
  for (var i=0; i<8; i++) {
    var randNum = Math.floor(Math.random() * chars.length);
    myStr += chars.substring(randNum, randNum+1);
  }
  return myStr;
}




function toggleSearch() {
	var x = document.getElementById('searchBox');
	var y = document.getElementById('searchButton');
	if (x.style.display != 'block') {
		x.style.display = 'block';
		y.src = 'img/button_search2.gif';
	} else {
		x.style.display = 'none';
		y.src = 'img/button_search.gif';
	}
}



function switchToMobile(i) {
	var url = document.location.href;
	if (url.substring(url.length-1) == '?') {
		document.location.href += 'mobile=' + i;
	} else if (url.indexOf('?') == -1) {
		document.location.href += '?mobile=' + i;
    } else {
    	url = url.replace(/mobile=/, "mobileX=");
		document.location.href = url + '&mobile=' + i;
    }
}


function updateSessionTimer() {
	g_sessionTimeout--;
	var x = document.getElementById('ef_sessionTimer');
	if (x) {
		if (g_sessionTimeout == 1) {
			x.innerHTML = 'You have 1 minute left in your session.';
			setTimeout("updateSessionTimer()", 5000);
		} else if (g_sessionTimeout == 0) {
			x.innerHTML = 'Your session and tickets in your cart may have expired.';
		} else {
			x.innerHTML = 'You have ' + g_sessionTimeout + ' minutes left in your session to purchase your tickets.';
			setTimeout("updateSessionTimer()", 5000);
		}
	}
}


//-->