
function OnButton1()
{
  document.mrponline.method = "post"
  document.mrponline.action = "index.php"
  document.mrponline.submit();             // Submit the page
  return true;
}
function getSelectVal(sel) {
  var selNode = document.getElementById(sel);
  var opts = selNode.getElementsByTagName('option');
  for (var i in opts) {
    var o = opts[i];
    if( o.selected ) return o.value;
  }
}
function chkField($fld) {
  if( $fld == 'birthplace' ) {
    if( getSelectVal('birthplace') != 'Specified' ) document.getElementById('birthplace2').disabled=true; 
    else document.getElementById('birthplace2').disabled=false;
  }
  if( $fld == 'cstatus' ) {
    if( mrponline.cstatus.value == 'Single' ){
      mrponline.spousename.disabled = true;
      mrponline.spousecitizenship.disabled = true;
      mrponline.spousename.value = '';
      mrponline.spousecitizenship.value = '';
    } else {
      mrponline.spousename.disabled = false;
      mrponline.spousecitizenship.disabled = false;
    }
  }
  if( $fld == 'apptype' ){
    if( mrponline.apptype.value != 'Passport Renewal' ) {
      mrponline.oldppnum.disabled = true;
      mrponline.oldpppi.disabled = true;
      mrponline.oldppnum.value = '';
      mrponline.oldpppi.value = '';
      mrponline.day1.disabled = true;
      mrponline.day1.value = '';
      mrponline.month1.disabled = true;
      mrponline.month1.value = '';
      mrponline.year1.disabled = true;
      mrponline.year1.value = '';
    } else {
      mrponline.oldppnum.disabled = false;
      mrponline.oldpppi.disabled = false;
      mrponline.day1.disabled = false;
      mrponline.month1.disabled = false;
      mrponline.year1.disabled = false;
    }
  }
}
function hideDiv($id) {
  document.getElementById($id).style.visibility="hidden";
//  document.$id.visibility="hidden";
//  document.all.$id.style.visibility="hidden";
}
function showDiv($id) {
  activepage=$id;
  document.getElementById($id).style.visibility="visible";
//  document.$id.visibility="visible";
//  document.all.$id.style.visibility="visible";
}
function confirmLeave($msg) {
  var ans=window.confirm($msg);
  if(ans) return true;
  else return false;
}
function validateForm(thisform){
  if (thisform.reason.value==null || thisform.reason.value.length<5){
    alert("You need to give a reason for your cancellation!");
    thisform.reason.focus();
    return false;
  }else return true;
}
function chkRead(thisform) {
  val=document.getElementById('read').checked;
  if( val != true ) {
    alert('You need to agree on the terms and conditions to proceed with your Online Application!');
    return false;
  } else return true;
}
