$("#sss").hide();
$(function(){
$("#medical_concern").change(function(){
$("#current_medical_concern3722").val('');
var displaycode = $("#medical_concern option:selected").val();
if (displaycode == "") {
$("#current_medical_concern3722").val('');
$("#sss").show();
}
else if(displaycode == "select_medical_concern"){
$("#sss").hide();
$("#current_medical_concern3722").val('');
}
else{
$("#sss").hide();
$("#current_medical_concern3722").val(displaycode);
}
});
// $("#medical_concern").change(function(){
// var displaycode = $("#medical_concern option:selected").val();
// if (displaycode == "") {
// $("#sss").show();
// }
// else if(displaycode == "Select Medical Concern"){
// $("#sss").hide();
// $("#medical_concern option:selected").val('');
// }
// else{
// $("#sss").hide();
// }
// $("#current_medical_concern3722").val(displaycode);
// });
});
function SubmitPost()
{
if (!Validate()) {
return false;
}
}
$(function () {
$('.date').mask('00-00-0000');
});
function isValidDateText(s) {
if (s.length > 0) {
var bits = s.split('-');
var d = new Date(bits[2] + '/' + bits[0] + '/' + bits[1]);
return !!(d && (d.getMonth() + 1) == bits[0] && d.getDate() == Number(bits[1]));
}
else
return true;
}
function validatePhoneNumber() {
if (isNaN($("#tel1-cell_phone1569871587").val()) || isNaN($("#tel2-cell_phone1569871587").val()) || isNaN($("#tel3-cell_phone1569871587").val()) ||
($("#tel1-cell_phone1569871587").val() + $("#tel2-cell_phone1569871587").val() + $("#tel3-cell_phone1569871587").val()).length != 10) {
alert('Please enter Phone Number correctly');
return false;
}
return true;
}
function validatePharmacyNumber()
{
if (isNaN($("#tel1-preferred_pharm1570200022").val()) || isNaN($("#tel2-preferred_pharm1570200022").val()) || isNaN($("#tel3-preferred_pharm1570200022").val()) ||
($("#tel1-preferred_pharm1570200022").val() + $("#tel2-preferred_pharm1570200022").val() + $("#tel3-preferred_pharm1570200022").val()).length != 10) {
alert('Please enter Pharmacy Number correctly');
return false;
}
return true;
}
function Validate()
{
if ((!validatePhoneNumber()) || (!validatePharmacyNumber()))
{
return false;
}
if (isNaN($("input[name=zip_personal]").val()))
{
alert("Zip should be a Number");
$("input[name=zip_personal]").focus();
return false;
}
if (isNaN($("#height_inches_1569871735").val()))
{
alert("Height should be a Number");
$("#height_inches_1569871735").focus();
return false;
}
if (isNaN($("#weight_lbs_1569871748").val())) {
alert("Weight should be a Number");
$("#weight_lbs_1569871748").focus();
return false;
}
if (isNaN($("#body_temperature_f_1569871821").val())) {
alert("Temperature should be a Number");
$("#body_temperature_f_1569871821").focus();
return false;
}
if (!isValidDateText($("#date_of_birth1570200138").val()))
{
alert('Please enter a valid date');
$("#date_of_birth1570200138").focus();
return false;
}
if (!isValidDateText($("#date_of_last_ph1570200153").val())) {
alert('Please enter a valid date');
$("#date_of_last_ph1570200153").focus();
return false;
}
return true;
}
function DisplayHideExistingMemberLink() {
$("#existingMemberLink").attr("href", "");
var phoneNumber = $("#tel1-cell_phone1569871587").val() + $("#tel2-cell_phone1569871587").val() + $("#tel3-cell_phone1569871587").val();
if (phoneNumber.length == 10) {
$.get("https://member.my24hourphysicians.com/user/MemberExists/?phone=" + phoneNumber, function (data, status) {
var obj = JSON.parse(data);
if (obj == 1) {
$("#existingMemberLink").show();
$("#form_list").hide();
$("#existingMemberLink").show();
$("#existingMemberLink").attr("href", "https://member.my24hourphysicians.com/user/loginExternally/?username=" + phoneNumber);
window.location.href = "https://member.my24hourphysicians.com/user/loginExternally/?username=" + phoneNumber;
}
else {
$("#existingMemberLink").hide();
$("#form_list").show();
$("#Checkcell").hide();
$("#first_name1569871428").focus();
}
});
}
else {
$("#existingMemberLink").hide();
}
}
function SubmitPost() {
//$("#overlay").fadeIn(300);
$(".form-group").removeClass("has-error");
$(".help-block").remove();
var formData = {
cellphone1:$('input[name=tel1-cell_phone1569871587]').val(),
cellphone2:$('input[name=tel2-cell_phone1569871587]').val(),
cellphone3:$('input[name=tel3-cell_phone1569871587]').val(),
preferred_pharm1:$('input[name=tel1-preferred_pharm1570200022]').val(),
preferred_pharm2:$('input[name=tel2-preferred_pharm1570200022]').val(),
preferred_pharm3:$('input[name=tel3-preferred_pharm1570200022]').val(),
first_name: $("input[name=first_name1569871428]").val(),
last_name: $("input[name=last_name1569871443]").val(),
middle_name: $("input[name=middle_name1569871434]").val(),
member_email_address: $("input[name=inputEmail]").val(),
member_sex: $("select[name=patients_sex1569871322] option:selected").val(),
member_birthday: $("input[name=date_of_birth1570200138]").val(),
memberlast_birthday: $("input[name=date_of_last_ph1570200153]").val(),
member_address1: $("input[name=street_personal]").val(),
member_address2: $("input[name=suit_personal]").val(),
member_city: $("input[name=city_personal]").val(),
member_state: $("#zone_id").val(),
stateofservice: $("#select_a_state_1593193451").val(),
member_country: $("select[name=personal_country] option:selected").val(),
member_zip: $("input[name=zip_personal]").val(),
signature: $("input[name=signature_type_your_full_name1569871904]").val(),
member_current_medical_concern: $("textarea[name=current_medical_concern3722]").val(),
member_known_allergies: $("textarea[name=known_allergies1569871703]").val(),
member_height_inches: $("input[name=height_inches_1569871735]").val(),
member_weight_lbs: $("input[name=weight_lbs_1569871748]").val(),
member_smoker: $("select[name= smoker1569871769] option:selected").val(),
cfid: $("input[name=cfid]").val(),
consultationtype: $("input[name=consultationtype]").val(),
currentmedicine:$('textarea[name=please_list_all_current_medications_rx_over_the_counter_home_remedy_1569871841]').val(),
anymedicalhistory:$('textarea[name=any_medical_history_not_covered_in_any_of_the_previous_questions1569871857]').val(),
cardiovascular:$('select[name=do_you_have_cardiovascular_disease1590091650] option:selected').val(),
member_body_temperature: $("input[name=body_temperature_f_1569871821]").val(),
call_type: $("select[name=call_type] option:selected").val(),
primary_physician_name: $("input[name=primary_physician_name]").val(),
primaryphysician1: $('input[name=tel1-cell_phone_physician]').val(),
primaryphysician2: $('input[name=tel2-cell_phone_physician]').val(),
primaryphysician3: $('input[name=tel3-cell_phone_physician]').val(),
captcha: grecaptcha.getResponse()
};
var date_of_last = $('input[name= date_of_last_ph1570200153]').val();
var cellphone1 = $('input[name=tel1-cell_phone1569871587]').val();
var cellphone2 = $('input[name=tel2-cell_phone1569871587]').val();
var cellphone3 = $('input[name=tel3-cell_phone1569871587]').val();
var preferred_pharm1 = $('input[name=tel1-preferred_pharm1570200022]').val();
var preferred_pharm2 = $('input[name=tel2-preferred_pharm1570200022]').val();
var preferred_pharm3 = $('input[name=tel3-preferred_pharm1570200022]').val();
var first_name = $('input[name= first_name1569871428]').val();
var last_name = $('input[name= last_name1569871443]').val();
var middle_name = $('input[name= middle_name1569871434]').val();
var member_email_address = $('input[name= inputEmail]').val();
var member_sex = $('select[name= patients_sex1569871322] option:selected').val();
var member_birthday = $('input[name= date_of_birth1570200138]').val();
var member_address1 = $('input[name= street_personal]').val();
var member_address2 = $('input[name= suit_personal]').val();
var member_city = $('input[name= city_personal]').val();
var member_state = $('select[name= personal_state] option:selected').val();
var member_country = $('select[name= personal_country] option:selected').val();
var member_select_a_state = $('select[name= select_a_state_1593193451] option:selected').val();
var member_zip = $('input[name= zip_personal]').val();
var member_current_medical_concern = $('textarea[name=current_medical_concern3722]').val();
var member_known_allergies = $('textarea[name=known_allergies1569871703]').val();
var member_height_inches = $('input[name= height_inches_1569871735]').val();
var member_weight_lbs = $('input[name= weight_lbs_1569871748]').val();
var member_smoker = $('select[name= smoker1569871769] option:selected').val();
var member_body_temperature = $('input[name= body_temperature_f_1569871821]').val();
var cardiovascular = $('select[name= do_you_have_cardiovascular_disease1590091650] option:selected').val();
var member_signature = $('input[name= signature_type_your_full_name1569871904]').val();
var anymedicalhistory= $('textarea[name=any_medical_history_not_covered_in_any_of_the_previous_questions1569871857]').val();
var currentmedicine= $('textarea[name=please_list_all_current_medications_rx_over_the_counter_home_remedy_1569871841]').val();
var call_type = $('select[name= call_type] option:selected').val();
var nameRegex = /^[a-zA-Z ]{2,30}$/;
var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
if (isNaN(cellphone1) || isNaN(cellphone2) || isNaN(cellphone3) ||
(cellphone1.toString() + cellphone2.toString()+ cellphone3.toString()).length != 10) {
alert('Please enter Phone Number correctly');
return false;
}
if (!nameRegex.test(first_name)) {
alert('Please enter a valid First Name');
$("#first_name1569871428").focus();
return false;
}
if (!nameRegex.test(last_name)) {
alert('Please enter a valid Last Name');
$("#last_name1569871443").focus();
return false;
}
if (!emailRegex.test(member_email_address)) {
alert('Please enter a valid Email Address');
$("#inputEmail").focus();
return false;
}
if (member_sex==="") {
alert('Please enter a valid Sex');
$("#patients_sex1569871322").focus();
return false;
}
if (member_birthday==="") {
alert("Please enter member birthday.");
$('input[name= date_of_birth1570200138]').focus();
return false;
}
if (member_address1==="") {
alert('Please enter a valid Address1');
$("input[name=street_personal]").focus();
return false;
}
if (member_city==="") {
alert('Please enter a valid City');
$("input[name=city_personal]").focus();
return false;
}
if (member_state=="") {
alert('Please enter a valid State');
$("#zone_id").focus();
return false;
}
if (member_country=="") {
alert('Please select a valid Country');
$("#country_id").focus();
return false;
}
if (member_zip==="" || isNaN(member_zip)) {
alert("Please enter zip.");
$('input[name= zip_personal]').focus();
return false;
}
if (member_select_a_state=="") {
alert('Please select State of Service');
$("#member_select_a_state").focus();
return false;
}
if (call_type==="") {
alert('Please select call type');
$("#call_type").focus();
return false;
}
if (isNaN(preferred_pharm1) || isNaN(preferred_pharm2) || isNaN(preferred_pharm3) ||
(preferred_pharm1.toString() + preferred_pharm2.toString()+ preferred_pharm3.toString()).length != 10) {
alert('Please enter Pharmacy Fax No');
return false;
}
if (member_current_medical_concern.trim()=="") {
alert("Please enter member current medical concern.");
if($("#medical_concern").val()=='')
{
$('#current_medical_concern3722').focus();
}
else{
$("#medical_concern").focus();
}
return false;
}
// if (member_current_medical_concern==="") {
// alert("Please enter member current medical concern.");
// $('input[name= current_medical_concern3722]').focus();
// return false;
// }
if (member_known_allergies==="") {
alert("Please enter Allergies.");
$('textarea[name= known_allergies1569871703]').focus();
return false;
}
if (member_height_inches==="" || isNaN(member_height_inches)) {
alert("Please enter height.");
$('input[name= height_inches_1569871735]').focus();
return false;
}
if (member_weight_lbs==="" || isNaN(member_weight_lbs)) {
alert("Please enter weight.");
$('input[name= weight_lbs_1569871748]').focus();
return false;
}
if (member_smoker==="") {
alert("Please select Smoker.");
$("smoker1569871769").focus();
return false;
}
if (member_body_temperature==="" || isNaN(member_body_temperature)) {
alert("Please enter temp.");
$('input[name= body_temperature_f_1569871821]').focus();
return false;
}
if (currentmedicine==="") {
alert("Please enter current medicine.");
$('textarea[name= please_list_all_current_medications_rx_over_the_counter_home_remedy_1569871841]').focus();
return false;
}
if (date_of_last==="") {
alert("Date of last Physical is required.");
$('input[name= date_of_last_ph1570200153]').focus();
return false;
}
if (anymedicalhistory==="") {
alert("Please enter any medical history.");
$('textarea[name= any_medical_history_not_covered_in_any_of_the_previous_questions1569871857]').focus();
return false;
}
if (cardiovascular==="") {
alert('Please enter a valid cardiovascular');
$("#do_you_have_cardiovascular_disease1590091650").focus();
return false;
}
if (member_signature==="") {
alert('Please enter a Signature');
$("#signature_type_your_full_name1569871904").focus();
return false;
}
$.ajax({
type: "POST",
url: "https://my24hourphysicians.com/Members/addMember",
data: formData,
dataType: "json",
encode: true,
})
.done(function(data) {
if (data.success) {
location.href=data.url;
}
else {
grecaptcha.reset();
alert(data.error);
//alert(data.errors);
}
})
.fail(function(data) {
console.log(data);
});
return false;
}