/**** MiniBooker.js:  Scripts for MiniBooker.ASP
 ****
 */


/* These functions provide the tab-change behavior for the MiniBooker
 */
function updateEdgeDisplay(edge, val){
	document.getElementById("bkrEdge" + edge + "_0").style.display=val;
	document.getElementById("bkrEdge" + edge + "_1").style.display=val;
	document.getElementById("bkrEdge" + edge + "_2").style.display=val;
	document.getElementById("bkrEdge" + edge + "_3").style.display=val;
}
function module0_header_onclick(){
	updateEdgeDisplay(0, 'inline');
	updateEdgeDisplay(1, 'none');
	updateEdgeDisplay(2, 'none');
}
function module1_header_onclick(){
	updateEdgeDisplay(0, 'none');
	updateEdgeDisplay(1, 'inline');
	updateEdgeDisplay(2, 'none');
}
function module2_header_onclick(){
	updateEdgeDisplay(0, 'none');
	updateEdgeDisplay(1, 'none');
	updateEdgeDisplay(2, 'inline');
}

/* This next block is to deal with a bug in Firefox that causes 
 * radio buttons like our fare category gruop that happen to
 * follow a dynamic input field (like our city selection boxes)
 * to change selected value each time the page renders.
 * Basically it depends no being able to save and restore the 
 * radio button state to a hidden input field that is on the page
 * above the dynamic input field, which keeps it away from harm --
 * if the hidden field were below it, problems still occurred.
 */
function initDefaultMiniBooker()
{
  reset_fareCatRadioState(); // Kluge for Firefox appendChild glitch.
}
function  preserve_fareCatRadioState()
{
  len = document.bBaf.fareCat.length;
  for(var i=0; i<len; i++) {
    if (document.bBaf.fareCat[i].checked) {
      document.bBaf.booker_fare_cat.value = document.bBaf.fareCat[i].value;
    }
  }
}
function reset_fareCatRadioState()
{
  len = document.bBaf.fareCat.length;
  for(var i=0; i<len; i++) {
    if (document.bBaf.fareCat[i].value == document.bBaf.booker_fare_cat.value) {
      document.bBaf.fareCat[i].checked = 1;
    }
  }
}
