document.write('
'); var jQuery; var schoolaxisEventsData = {"mode":"event","event":{"id":3,"name":"School Tours","instances":[{"id":3,"datetime":"2027-01-14 08:30:00","tz":"MST","duration":"","location":"Great Hearts Anthem\r\n3950 W. Arroyo Norte Dr. \r\nAnthem, AZ 85086\r\n(623) 465-4776\r\n","description":"Please select your tour date below, and plan to arrive a few minutes early. Please note that tours are separated between our Archway (grades K-5) and Preparatory (grades 6-12). Tours last about one hour.\r\n \r\nImportant tour information:","remaining":18},{"id":5,"datetime":"2027-01-19 08:30:00","tz":"MST","duration":"","location":"Great Hearts Anthem\r\n3950 W. Arroyo Norte Dr. \r\nAnthem, AZ 85086\r\n(623) 465-4776\r\n","description":"","remaining":20},{"id":7,"datetime":"2027-01-21 08:30:00","tz":"MST","duration":"","location":"Great Hearts Anthem\r\n3950 W. Arroyo Norte Dr. \r\nAnthem, AZ 85086\r\n(623) 465-4776\r\n","description":"","remaining":20},{"id":9,"datetime":"2027-01-26 08:30:00","tz":"MST","duration":"","location":"Great Hearts Anthem\r\n3950 W. Arroyo Norte Dr. \r\nAnthem, AZ 85086\r\n(623) 465-4776\r\n","description":"","remaining":20},{"id":11,"datetime":"2027-01-28 08:30:00","tz":"MST","duration":"","location":"Great Hearts Anthem\r\n3950 W. Arroyo Norte Dr. \r\nAnthem, AZ 85086\r\n(623) 465-4776\r\n","description":"","remaining":20}],"grades":[],"askstudent":false,"askcommpref":true,"schoolname":"Anthem Preparatory Academy"}}; var schoolaxisEventsHost = "ghastaging.schoolaxis.com"; var schoolaxisEventsScheme = "https"; var schoolaxisEventsRecaptchaHtml = "
"; var schoolaxisEventsSubmitting = false; if (window.jQuery === undefined || window.jQuery.fn.jquery !== "3.1.0") { var script_tag = document.createElement("script"); script_tag.setAttribute("type","text/javascript"); script_tag.setAttribute("src", "https://code.jquery.com/jquery-3.1.0.min.js"); if (script_tag.readyState) { script_tag.onreadystatechange = function () { if (this.readyState == "complete" || this.readyState == "loaded") schoolaxisEventsScriptLoadHandler(); }; } else { script_tag.onload = schoolaxisEventsScriptLoadHandler; } (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag); } else { jQuery = window.jQuery; schoolaxisEventsMain(); } function schoolaxisEventsScriptLoadHandler() { jQuery = window.jQuery.noConflict(true); schoolaxisEventsMain(); } function schoolaxisEventsMain() { jQuery(document).ready(function($) { schoolaxisEventsRenderRoot(); }); } function schoolaxisEventsRenderRoot() { var $root = jQuery("#schoolaxiseventsembed"); $root.html(""); if ( schoolaxisEventsData.mode == "school" ) { schoolaxisEventsRenderEventList($root, schoolaxisEventsData.events); } else { schoolaxisEventsRenderInstanceList($root, schoolaxisEventsData.event, schoolaxisEventsData.event.instances); } } function schoolaxisEventsEsc(s) { return jQuery("
").text(s == undefined ? "" : s).html(); } function schoolaxisEventsFormatDate(dt) { if ( !dt ) return ""; var d = new Date(dt.replace(" ", "T")); if ( isNaN(d.getTime()) ) return dt; return d.toLocaleDateString(undefined, {weekday:"long", month:"long", day:"numeric", year:"numeric"}); } function schoolaxisEventsFormatTime(dt) { if ( !dt ) return ""; var d = new Date(dt.replace(" ", "T")); if ( isNaN(d.getTime()) ) return dt; return d.toLocaleTimeString(undefined, {hour:"numeric", minute:"2-digit", hour12:true}); } function schoolaxisEventsRow(label, value) { return "
" + label + ": " + value + "
"; } function schoolaxisEventsRenderEventList($root, events) { var html = '
'; if ( events.length == 0 ) { html += '

No events are currently open for booking.

'; } for ( var i = 0; i < events.length; i++ ) { var ev = events[i]; html += '
'; html += '

' + schoolaxisEventsEsc(ev.name) + "

"; if ( ev.duration ) html += schoolaxisEventsRow("Duration", schoolaxisEventsEsc(ev.duration)); if ( ev.location ) html += schoolaxisEventsRow("Location", schoolaxisEventsEsc(ev.location)); if ( ev.instances.length == 0 ) { html += '

No upcoming times available.

'; } else { html += schoolaxisEventsRow("Available Times", ev.instances.length); html += schoolaxisEventsRow("Next Available", schoolaxisEventsFormatDate(ev.instances[0].datetime)); html += "
"; html += ''; } html += "
"; } html += "
"; $root.html(html); window.schoolaxisEventsEventsCache = events; } function schoolaxisEventsShowInstances(idx) { var ev = window.schoolaxisEventsEventsCache[idx]; schoolaxisEventsRenderInstanceList(jQuery("#schoolaxiseventsembed"), ev, ev.instances, true); } function schoolaxisEventsRenderInstanceList($root, event, instances, showBack) { // Callers that come back from the booking form do not pass showBack: in a school embed the list always has a way back to all events. if ( showBack === undefined ) showBack = ( schoolaxisEventsData.mode == "school" ); var html = ""; if ( showBack ) html += '

← Back to all events

'; html += "

" + schoolaxisEventsEsc(event.name) + "

"; if ( instances.length == 0 ) { html += '

No upcoming times are available for this event.

'; } else { html += '
'; for ( var i = 0; i < instances.length; i++ ) { var inst = instances[i]; html += '
'; html += schoolaxisEventsRow("Date", schoolaxisEventsFormatDate(inst.datetime)); html += schoolaxisEventsRow("Time", schoolaxisEventsFormatTime(inst.datetime) + (inst.tz ? " " + schoolaxisEventsEsc(inst.tz) : "")); if ( inst.duration ) html += schoolaxisEventsRow("Duration", schoolaxisEventsEsc(inst.duration)); if ( inst.location ) html += schoolaxisEventsRow("Location", schoolaxisEventsEsc(inst.location)); html += schoolaxisEventsRow("Available Spots", inst.remaining); if ( inst.description ) html += schoolaxisEventsRow("Details", schoolaxisEventsEsc(inst.description)); html += "
"; html += ''; html += "
"; } html += "
"; } jQuery(($root && $root.length) ? $root : "#schoolaxiseventsembed").html(html); window.schoolaxisEventsInstancesCache = instances; window.schoolaxisEventsCurrentEvent = event; } function schoolaxisEventsShowBookingForm(idx) { var inst = window.schoolaxisEventsInstancesCache[idx]; var event = window.schoolaxisEventsCurrentEvent; var maxGuests = Math.max(0, inst.remaining - 1); var html = '

← Back to available times

'; html += "

" + schoolaxisEventsEsc(event.name) + "

"; html += schoolaxisEventsRow("Date", schoolaxisEventsFormatDate(inst.datetime)); html += schoolaxisEventsRow("Time", schoolaxisEventsFormatTime(inst.datetime) + (inst.tz ? " " + schoolaxisEventsEsc(inst.tz) : "")); if ( inst.duration ) html += schoolaxisEventsRow("Duration", schoolaxisEventsEsc(inst.duration)); if ( inst.location ) html += schoolaxisEventsRow("Location", schoolaxisEventsEsc(inst.location)); html += schoolaxisEventsRow("Available Spots", inst.remaining); html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; if ( event.askcommpref ) { html += '
'; var prefs = [["email", "Email"], ["text", "Text"], ["both", "Email and text"]]; for ( var p = 0; p < prefs.length; p++ ) { html += '
"; } html += 'By choosing Text or Email and text, you agree to receive text messages from ' + schoolaxisEventsEsc(event.schoolname || "the school") + ' about this booking. Message and data rates may apply. Reply STOP to opt out.
'; } if ( event.grades && event.grades.length ) { html += '
'; for ( var g = 0; g < event.grades.length; g++ ) { html += '
"; } html += "
"; } if ( event.askstudent ) { html += '
'; html += '
"; html += '
'; } if ( maxGuests > 0 ) { var guestLabel = event.askstudent ? "Additional Guests (not including your student)" : "Additional Guests"; html += '
'; } html += '
'; html += '
'; html += ''; html += "
"; jQuery("#schoolaxiseventsembed").html(html); jQuery("#schoolaxisEventsCaptchaContainer").append(schoolaxisEventsRecaptchaHtml); } function schoolaxisEventsSubmit(instanceid) { if ( schoolaxisEventsSubmitting ) return; var email = jQuery("#schoolaxisEventsEmail").val(); if ( !email || email.indexOf("@") < 0 ) { jQuery("#schoolaxisEventsFormMessage").html('
A valid email is required.
'); return; } var email2 = jQuery("#schoolaxisEventsEmail2").val(); if ( jQuery.trim(email).toLowerCase() !== jQuery.trim(email2 || "").toLowerCase() ) { jQuery("#schoolaxisEventsFormMessage").html('
The email addresses do not match. Please check them and try again.
'); return; } var phoneText = jQuery.trim(jQuery("#schoolaxisEventsPhone").val() || ""); var phoneDigits = phoneText.replace(/[^0-9]/g, ""); if ( /[^0-9+()\.\- ]/.test(phoneText) || !(phoneDigits.length == 10 || (phoneDigits.length == 11 && phoneDigits.charAt(0) == "1")) ) { jQuery("#schoolaxisEventsFormMessage").html('
A valid 10-digit phone number is required.
'); return; } var formEvent = window.schoolaxisEventsCurrentEvent; var commpref = jQuery("input[name=schoolaxisEventsCommpref]:checked").val() || ""; var grades = jQuery("input[name=schoolaxisEventsGrade]:checked").map(function() { return this.value; }).get(); var student = jQuery("input[name=schoolaxisEventsStudent]:checked").val() || ""; var missing = ""; if ( formEvent.askcommpref && !commpref ) missing = "Please choose how we should contact you."; else if ( formEvent.grades && formEvent.grades.length && grades.length == 0 ) missing = "Please choose the grades you are interested in."; else if ( formEvent.askstudent && student === "" ) missing = "Please tell us whether your student is coming."; if ( missing ) { jQuery("#schoolaxisEventsFormMessage").html('
' + missing + "
"); return; } schoolaxisEventsSubmitting = true; var payload = { firstname: jQuery("#schoolaxisEventsFirstname").val(), lastname: jQuery("#schoolaxisEventsLastname").val(), email: email, phone: phoneText, commpref: commpref, grades: grades, studentcoming: student, additionalguests: jQuery("#schoolaxisEventsGuests").length ? jQuery("#schoolaxisEventsGuests").val() : 0, "g-recaptcha-response": (typeof grecaptcha !== "undefined") ? grecaptcha.getResponse() : "", callback: "schoolaxisEventsSubmitCallback" }; jQuery.ajax({ type: "post", async: true, url: schoolaxisEventsScheme + "://" + schoolaxisEventsHost + "/events/public/submitbooking/" + instanceid, data: payload, dataType: "jsonp", jsonpCallback: "schoolaxisEventsSubmitCallback" }).done(function(r) { schoolaxisEventsSubmitting = false; if ( r.error ) { jQuery("#schoolaxisEventsFormMessage").html('
' + r.message + "
"); if ( typeof grecaptcha !== "undefined" ) grecaptcha.reset(); } else if ( r.redirecturl && /^https?:\/\//i.test(r.redirecturl) ) { window.location.href = r.redirecturl; } else { jQuery("#schoolaxiseventsembed").html('
' + (r.confirmedmessage ? '
' + r.confirmedmessage + '
' : '') + '

Your booking is confirmed!

Save this link to manage your reservation later:

' + r.managelink + "

"); } }); }