var navAgent       = navigator.appVersion;
var browserType    = "";
var cMinPageHeight = "500";

browserType = (navAgent.indexOf("4.") == -1) ? 'Not4.0'  : '4';

if (browserType == '4') {
  browserType = (navAgent.indexOf("MSIE") == -1)
             ? (navigator.appName == 'Netscape')
             ? 'NN'
             : 'Unknown'
             : 'IE';
}

else if (navigator.appName == 'Netscape' && navigator.vendorSub) { 
  //Extra check in case browser doesn't support vendorSub
  if (navigator.vendorSub.substring(0,1) == '6') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,1) == '7') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,3) == '0.9') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,4) == '0.10') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,3) == '1.0') {
    browserType = 'NN6';
  }
 
} else {
  //Mozilla
  if (navigator.appName == 'Netscape' && navAgent.indexOf("5.") > -1 ) {
     browserType = 'NN6';
  } 
}

function joe() {
  //empty
} 
 
function reloadsite() {
  window.location.replace('index.php');
  //self.location == 'http://www.ramapodemocratsforchange.com';
} 
 
function dvWriteContent(content) {
  if (browserType == "NN") {
      bodyContent.document.open();
      bodyContent.document.write(content);
      bodyContent.document.close();
  } else {
    bodyContent.innerHTML = content;
    textFrame.focus();
    if (browserType == 'IE' || browserType == 'NN6') {
    bodyContent.style.visibility = 'visible';
    } else {
    bodyContent.visibility = 'visible';
    }
  }
}

function dvWriteContentHdr(content) {
  if (browserType == "NN") {
      bodyContentHdr.document.open();
      bodyContentHdr.document.write(content);
      bodyContentHdr.document.close();
  } else {
    bodyContentHdr.innerHTML = content;
  }
}

function getPage(cHTMLSource) {
  window.location.replace(cHTMLSource);
}

function chkGetData() {
  if ((document.getDist.lastname.value == '') && (document.getDist.street.value == '')) {
    alert('Please enter last name or street');
    return false;
  }
    
  if ((document.getDist.lastname.value != '') && (document.getDist.lastname.value.length < 3)) {
    alert('Last Name must be at least 3 letters');
    return false;
  }
  
  if ((document.getDist.street.value != '') && (document.getDist.street.value.length < 3)) {
    alert('Street Name must be at least 3 letters');
    return false;
  }  
  
//  if (document.getProspect.phone.value == '') {
//    alert('Please enter your phone');
//    return false;
//  }
  
  document.getDist.submit();
}

function saveBio() {
  document.getBio.submit();	
}

function candidateLookup() {
  window.location.replace("candidate_lookup.htm");
}	

function chkMsg() {
  
  if (document.getMsg.fullname.value == '') {
    alert('Please enter your name');
    return false;
  }

  if (document.getMsg.email.value == '') {
    alert('Please enter your email so we can write back to you');
    return false;
  }
  
  //set action by msg type
  selMsgTypeHdl = document.getElementById("selMsgType");
  selMsgTypeValue = selMsgTypeHdl[selMsgTypeHdl.selectedIndex].value;
  
  if (selMsgTypeValue == "lookup") {
    document.getMsg.action = '/cgi-bin/cgiemail/lookup.txt';
  } 
  else 
  {
    document.getMsg.action = '/cgi-bin/cgiemail/geninq.txt';
  }	
 
  document.getMsg.submit();
}
	
