<!--
function getSelectedRadio(buttonGroup){
// returns the array index of the selected radio button or -1 if no button is selected
 if (buttonGroup[0]) { // if the button group is an array (1 button is not an array)
  for (var i=0; i<buttonGroup.length; i++) {
   if (buttonGroup[i].checked) return i
  }
 } else {
  if (buttonGroup.checked) {return 0;} // if the one button is checked, return 0
 }
 return -1;
}
function getSelectedRadioValue(buttonGroup){
 // returns the value of the selected radio button or "" if no button is selected
 var i = getSelectedRadio(buttonGroup);
 if (i == -1) {
  return '';
 } else {
  if (buttonGroup[i]) { // Make sure the button group is an array (not just one button)
   return buttonGroup[i].value;
  } else { // The button group is just the one button, and it is checked
   return buttonGroup.value;
  }
 }
}
function getSelectedCheckbox(buttonGroup){
 // Go through all the check boxes. return an array of all the ones
 // that are selected (their position numbers). if no boxes were checked,
 // returned array will be empty (length will be zero)
 var retArr = new Array();
 var lastElement = 0;
 if (buttonGroup[0]) { // if the button group is an array (one check box is not an array)
  for (var i=0; i<buttonGroup.length; i++) {
   if (buttonGroup[i].checked) {
    retArr.length = lastElement;
    retArr[lastElement] = i;
    lastElement++;
   }
  }
 } else { // There is only one check box (it's not an array)
  if (buttonGroup.checked) { // if the one check box is checked
   retArr.length = lastElement;
   retArr[lastElement] = 0; // return zero as the only array value
  }
 }
 return retArr;
}
function getSelectedCheckboxValue(buttonGroup){
 // return an array of values selected in the check box group. if no boxes
 // were checked, returned array will be empty (length will be zero)
 var retArr = new Array(); // set up empty array for the return values
 var selectedItems = getSelectedCheckbox(buttonGroup);
 if (selectedItems.length != 0) { // if there was something selected
  retArr.length = selectedItems.length;
  for (var i=0; i<selectedItems.length; i++) {
   if (buttonGroup[selectedItems[i]]) { // Make sure it's an array
    retArr[i] = buttonGroup[selectedItems[i]].value;
   } else { // It's not an array (there's just one check box and it's selected)
    retArr[i] = buttonGroup.value;// return that value
   }
  }
 }
 return retArr;
}
function getSelectedOptionValue(optionGroup){return optionGroup.options[optionGroup.selectedIndex].value;}
function deleteAllOptions(sel){sel.options.length=0;}
function deleteOption(sel,idx){sel.options[idx]=null;}
function addOption(sel,option){var idx=sel.options.length;sel.options[idx]=option;}
function insertOptionAt(sel,option,idx){
 for (var i=sel.options.length; i>idx; i--) sel.opitons[i]=sel.options[i-1];
 sel.options[idx]=option;
}

function checkDate(mSel,dSel,ySel,bEmptyOptionAtTop){
 var lastDay = dSel.options.length;
 var month=mSel.value;
 var year=ySel.value;
 var i,idx;
 if (bEmptyOptionAtTop) lastDay = lastDay - 1;
 if (month=='1' || month=='3' || month=='5' || month=='7' || month=='8' || month=='10' || month=='12') {
  for (i=lastDay;i<31;i++) {
   if (bEmptyOptionAtTop) idx=i+1; else idx=i;
   insertOptionAt(dSel, new Option(i+1,i+1), idx);
  }
 }
 if (month=='4' || month=='6' || month=='9' || month=='11') {
  for (i=lastDay;i<30;i++) {
   if (bEmptyOptionAtTop) idx=i+1; else idx=i;
   insertOptionAt(dSel, new Option(i+1,i+1), idx);
  }
  if (bEmptyOptionAtTop) idx=31; else idx=30;
  deleteOption(dSel, idx);
 }
 if (month=='2') {
  for (i=lastDay;i<29;i++) {
   if (bEmptyOptionAtTop) idx=i+1; else idx=i;
   insertOptionAt(dSel, new Option(i+1,i+1), idx);
  }
  if ( ((year % 4)==0) && ( ((year % 100)!=0) || ((year % 400)==0) ) ) { // leap year
   for (i=30;i<=31;i++) {
    if (bEmptyOptionAtTop) idx=30; else idx=29;
    deleteOption(dSel, idx);
   }
  } else {
   for (i=29;i<=31;i++) {
    if (bEmptyOptionAtTop) idx=29; else idx=28;
    deleteOption(dSel, idx);
   }
  }
 }
 return true;
}
function validate_email(email_str){
var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; //not valid
var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; //valid
if (! email_str){return -1;}
else if (reg1.test(email_str) || ! reg2.test(email_str)) {return 0;}
return 1;
}
function disableEnterKey(){if(window.event.keyCode==13) window.event.keyCode=0;}
function createRequestObject(){if(navigator.appName=="Microsoft Internet Explorer"){return new ActiveXObject("Microsoft.XMLHTTP");}else{return new XMLHttpRequest();}}

function displayMsg(msgDiv,msg,msgType) {
if (!msgType) msgType = 'error';
var iconImage = '';
if (msgType=='error') {
  iconImage = '<img src="/image/i_alert.gif" width="19" height="19" alt="Error"\/>';
}
msgDiv.innerHTML='<table width="100%" cellpadding="3"><tr><td width="25">' + iconImage + '</td><td>'+msg+'</td></tr></table>';
msgDiv.style.display='block';
}

-->
