function tellerror(msg, url, linenumber){
alert('Error message= '+msg+'\nURL= '+url+'\nLine Number= '+linenumber)
return true
}
window.onerror=tellerror;

var passaccepted = false;

function ajaxpval(p,n) {
    $.getJSON("/pass/", { pass: p.value }, function(o) {
        var r = $('#passres');

        r.html(o.msg).css({ color: o.color });

        if( o.color == "red" && !n)
            p.value = "";
    });
}

function ajaxuval(u,n) {
    $.getJSON("/user/", { user: u.value }, function(o) {
        var r = $('#userres');

        r.html(o.msg).css({ color: o.color });

        if( o.color == "red" && !n)
            u.value = "";
    });
}

function validate() {
  var sPass=document.forms.AppForm.n12Password.value
  var sPay1=document.forms.AppForm.n17paytype[0].checked
  var sPay2=document.forms.AppForm.n17paytype[1].checked
  var sPay3=document.forms.AppForm.n17paytype[2].checked
  var sSvc0=document.forms.AppForm.n14service[0].checked
  var sSvc1=document.forms.AppForm.n14service[1].checked
  var sSvc2=document.forms.AppForm.n14service[2].checked
  var sSvc3=document.forms.AppForm.n14service[3].checked
  var sExchange=document.forms.AppForm.n07Telephone.value.substring(0,6)
  if ((sExchange=="269623") || (sExchange=="269721") || (sExchange=="29664") || (sExchange=="269758"))
    sBCTC=true
  else
    sBCTC=false
  if ((sSvc0==true) || (sSvc1==true) || (sSvc2==true) || (sSvc3==true))
    sService=true
  else
    sService=false
  if ((sPass.length!=0)  && ((sPay1==true) || (sPay2==true) || (sPay3==true)) && (sService==true))
      testresult=true
  else {
    alert("You must enter a password, service type, and paytype!")
    testresult=false
  }
  if ((testresult==true) && ((sPay1==true) && (sBCTC==false))) {
    alert("You must be a BCTC customer to pay on your phone bill.")
    testresult=false
  }   
  return (testresult)
};
