//Function relating to the online booking system


function ShowEvent(dropdown) {
	var urlquery=location.href.split("&");
	var myindex  = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;
	window.location.href = (urlquery[0] + '&event=' + SelValue)
}

function submit_detail(form) {
	var n = document.getElementById('nplace').value;
	if (n==1) {
		if (LiveValidation.massValidate( [ s1, f1, e1, t1 ] )) {
		confSubmit(form);
		}
	} else {
		if (LiveValidation.massValidate( [ s1, f1, e1, s2, f2, e2, t1 ] )) {
			confSubmit(form);
		}
	}
}

function confSubmit(form) {

var Fname = document.getElementById('Fname1').value;
var n = document.getElementById('nplace').value;
var ev_id = document.getElementById('event').selectedIndex;
var ev = document.getElementById('event').options[ev_id].text;


if (confirm("Dear "+ Fname +", \
		\n\
		\nYou are about to book "+ n +" place(s) for: \
		\n\
		\n " + ev + "\
		\n\
		\nAre you sure you wish to proceed?" )) {
form.submit();
} else {
}
}

function reserve_submit_detail(form) {
	var n = document.getElementById('nplace').value;
	if (n==1) {
		if (LiveValidation.massValidate( [ s1, f1, e1 ] )) {
			reserve_confSubmit(form);
		}
	} else {
		if (LiveValidation.massValidate( [ s1, f1, e1, s2, f2, e2 ] )) {
			reserve_confSubmit(form);
		}
	}
}

function reserve_confSubmit(form) {

var Fname = document.getElementById('Fname1').value;
var n = document.getElementById('nplace').value;
var ev = document.getElementById('event_ID').value;


if (confirm("Dear "+ Fname +", \
		\n\
		\n You have requested that " + n + " name/s be added to the reserve list for the following event: \
		\n\
		\n " + ev + "\
		\n\
		\nAre you sure you wish to proceed?" )) { 
form.submit();
} else {
}
}

function ShowBoxes(op) {
  document.getElementById('name_2').style.display='none';
  /* document.getElementById('name_3').style.display='none'; 
  document.getElementById('name_4').style.display='none'; */

  if (op == 1) {
    document.getElementById('name_2').style.display="block";
  }
  if (op == 2) {
    document.getElementById('name_2').style.display="block";
	document.getElementById('name_3').style.display="block";
  }
  if (op == 3) {
    document.getElementById('name_2').style.display="block";
	document.getElementById('name_3').style.display="block";
	document.getElementById('name_4').style.display="block";
  }
}


function ShowForm(op) {
	  document.getElementById('button_reserve').style.display='none';
	  document.getElementById('form_reserve').style.display='block';
}

