﻿
function NxHandleJavaScriptException(err, strExtraDescription) {
    try {
        if (strExtraDescription == undefined) {
            strExtraDescription = "An error occurred in the script.";
        }
        var strMessage = "" + strExtraDescription +
		"\r\nError name: " + err.name +
		". Error number: " + err.number +
		". Error message: " + err.message;

        alert(strMessage);
    } catch (e) {
        //now we have to ignore it
    }
}

function textCounter(field, maxlimit) {
    if (field.value.length > maxlimit)
        field.value = field.value.substring(0, maxlimit);
}

function resetme() {
    // (j.gruber 2009-03-04 13:10) - PLID 33330 - added some missing fields
    try {
        RequestForm.Specialty.value = "";
        RequestForm.SpecialtyList.value = "";
        RequestForm.DoctorFirst.value = '';
        RequestForm.DoctorLast.value = '';
        RequestForm.ContactName.value = '';
        RequestForm.Street.value = '';
        RequestForm.City.value = '';
        RequestForm.State.value = '';
        RequestForm.CountryCombo.value = "";
        RequestForm.Zip.value = '';
        RequestForm.Phone.value = '';        
        RequestForm.Hours.value = '';        
        RequestForm.chkEMR.checked = false;
        RequestForm.chkPracManage.checked = false;
        RequestForm.chkMarketing.checked = false;
        RequestForm.chkBilling.checked = false;
        RequestForm.chkInventory.checked = false;
        RequestForm.chkWebInt.checked = false;
        RequestForm.chkSurgCent.checked = false;
        RequestForm.chkSched.checked = false;
        RequestForm.chkPhotography.checked = false;
        RequestForm.chkConsents.checked = false;
        RequestForm.Referral.value = '';
        RequestForm.Stations.value = '';
        RequestForm.OldSystem.value = '';
        RequestForm.Elective.value = '';
        RequestForm.Doctors.value = '';
        RequestForm.Comments.value = '';
        RequestForm.EmailAddress.value = '';
        RequestForm.InfoAdditional.checked = false;
        RequestForm.InfoInstead.checked = false;        
        RequestForm.DecisionWithinMonths1.checked = false;
        RequestForm.DecisionWithinMonths3.checked = false;
        RequestForm.DecisionWithinMonths6.checked = false;
        RequestForm.DecisionWithinMonths12.checked = false;
        // (j.gruber 2009-03-04 13:10) - PLID 33334 - hidden field to tell the server side not to validate
        RequestForm.IsReset.value = "reset";
    } catch (e) {
        NxHandleJavaScriptException(e);
    }

    return false;
}

function CheckToShowOther() {

    if (RequestForm.SpecialtyList.value == "Other") {
        RequestForm.SpecialtyOther.style.visibility = "visible";
    }
    else {
        RequestForm.SpecialtyOther.style.visibility = "hidden";
    }

    RequestForm.Specialty.value = RequestForm.SpecialtyList.value;

}

// (b.cardillo 2011-08-30 12:54) - PLID 45250 - Removed GetReferral() since we do it on the server side now

