function toggle_display(elementID) {
        var e = document.getElementById(elementID);
        if(e.style.display == "block") {
                e.style.display='none';
        }
        else {
                e.style.display='block';
        }
}

function participantTypeChange(id, partType) {
	selected = partType.options[partType.selectedIndex].text;
	if(selected == "Teacher" || selected == "Observer") {
		displayValue = "none";
	}
	else {
		displayValue = "inline";
	}
	var form = partType.form;
	var fields = form.elements;
	//m,d,Y
	fields["participant[" + id + "][dob][m]"].style.display = displayValue;
	fields["participant[" + id + "][dob][d]"].style.display = displayValue;
	fields["participant[" + id + "][dob][Y]"].style.display = displayValue;
	fields["participant[" + id + "][scholarshipTypeID]"].style.display = displayValue;
}

function showHideBilling(payByCheck) {
	bF = document.getElementById('billingFields');
	if(payByCheck.checked) {
		alert('Please be aware if paying by check: Your place will not be held until payment is received.');
		bF.style.display = 'none';
	}
	else {
		bF.style.display = 'block';
	}
}

function popUp(url, w, h) {
		var windowprops = "width=" + w + ",height=" + h + "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,top=0,left=0";
		imgwin = window.open(url,'remote',windowprops);
}


/*  
	This Javascript allows you to auto tab when filling out text fields
*/
var isNN = (navigator.appName.indexOf("Netscape")!=-1);

function autoTab(input,len, e) {
  var keyCode = (isNN) ? e.which : e.keyCode; 
  var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
  if(input.value.length >= len && !containsElement(filter,keyCode)) {
    input.value = input.value.slice(0, len);
    input.form[(getIndex(input)+1) % input.form.length].focus();
  }

  function containsElement(arr, ele) {
    var found = false, index = 0;
    while(!found && index < arr.length)
    if(arr[index] == ele)
    found = true;
    else
    index++;
    return found;
  }

  function getIndex(input) {
    var index = -1, i = 0, found = false;
    while (i < input.form.length && index == -1)
    if (input.form[i] == input)index = i;
    else i++;
    return index;
  }
  return true;
}

function SelectAll(id)
{
    document.getElementById(id).focus();
    document.getElementById(id).select();
}


