function _adoptHideImage() { var displayElement = _oE( "image-display" ); displayElement.innerHTML = ""; displayElement.style.visibility = "hidden"; } function _adoptHidePopup() { var displayElement = _oE( "popup" ); displayElement.style.visibility = "hidden"; _oE( "popup-content" ).innerHTML = ""; } function _adoptHideSubmit() { _oE( "submitting" ).style.visibility = "hidden"; _oE( "submitting-ok-button" ).style.visibility = "hidden"; } function _adoptShowImage( __src ) { var displayElement = _oE( "image-display" ); displayElement.innerHTML = "

click the image again to close"; displayElement.style.visibility = "visible"; } function _adoptShowPopup() { var displayElement = _oE( "popup" ); displayElement.style.visibility = "visible"; } function _adoptShowSubmit() { var displayElement = _oE( "submitting" ); displayElement.style.visibility = "visible"; } function _adoptSubmitForm() { var showPopup = false; var popupContent = _oE( "popup-content" ); popupContent.innerHTML = ""; var name = _v( "a_name" ); var email = _v( "a_email" ); var phone = _v( "a_phone" ); var howMany = _v( "a_how_many" ); var poisonNo = _c( "a_poison_no" ); var feralOk = _c( "a_feral_yes" ); var feralNok = _c( "a_feral_no" ); var building = _v( "a_building" ); var location = _v( "a_location" ); var heatNone = _c( "a_heat_none" ); var poisonYes = _c( "a_poison_yes" ); var heatRoom = _c( "a_heat_room" ); var heatOther = _v( "a_heat_other" ); var winterCare = _c( "a_winter_care" ); var transOther = _c( "a_trans_other" ); var transHaveRoom = _c( "a_trans_room" ); var otherAnimals = _v( "a_other_animals" ); var heatInsulated = _c( "a_heat_insulated" ); var heatLivestock = _c( "a_heat_livestock" ); var otherComments = _v( "a_other_comments" ); var unfixedCatsAround = _v( "a_unfixed_cats" ); var transHaveCrate = _c( "a_trans_have_crate" ); var transNeedCrate = _c( "a_trans_need_crate" ); var transOtherText = _c( "a_trans_other_text" ); var transHaveEnclosure = _c( "a_trans_enclosure" ); if ( name == null ) { showPopup = true; popupContent.innerHTML += "Name
"; } if ( phone == null ) { showPopup = true; popupContent.innerHTML += "Phone Number
"; } if ( email == null ) { showPopup = true; popupContent.innerHTML += "Email Address
"; } if ( location == null ) { showPopup = true; popupContent.innerHTML += "Location
"; } if ( building == null ) { showPopup = true; popupContent.innerHTML += "Tell us about your place.
"; } if ( otherAnimals == null ) { showPopup = true; popupContent.innerHTML += "Are there other animals there?
"; } if ( winterCare !== true ) { showPopup = true; popupContent.innerHTML += "It is important that the cats are fed/watered daily.
"; } if ( !(heatLivestock || heatRoom || heatInsulated || heatNone) && heatOther == null ) { showPopup = true; popupContent.innerHTML += "Type of heat source options for the cats in winter.
"; } if ( unfixedCatsAround == null ) { showPopup = true; popupContent.innerHTML += "Are there unfixed cats there?
"; } if ( howMany == null ) { showPopup = true; popupContent.innerHTML += "How many cats are you looking for?
"; } if ( !(poisonNo || poisonYes) ) { showPopup = true; popupContent.innerHTML += "Any poisons on site?
"; } if ( !(transHaveCrate || transNeedCrate || transHaveEnclosure || transHaveRoom || transOther) ) { showPopup = true; popupContent.innerHTML += "For the trantsition period at your place.
"; } if ( !(feralNok || feralOk) ) { showPopup = true; popupContent.innerHTML += "Are you OK with timid/semi-feral cats?
"; } if ( showPopup ) { _adoptShowPopup(); return; } if ( feralNok ) { _oE( "submitting-title" ).innerHTML = "Wait..."; _oE( "submitting-ok-button" ).style.visibility = "visible"; _oE( "submitting-content" ).innerHTML = "You selected that you were uncomfortable with feral cats - the last question. We will not submit your adoption request." + "

If this was a mistake, click 'Ok' and then change your answer for the last question before trying again."; _adoptShowSubmit(); return; } _oE( "submitting-ok-button" ).style.visibility = "hidden"; _oE( "submitting-title" ).innerHTML = "Submitting Your Information"; _oE( "submitting-content" ).innerHTML = "Please hang on while we submit your request."; _adoptShowSubmit(); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function () { if ( this.status >= 400 ) { _oE( "submitting-title" ).innerHTML = "We're Sorry"; _oE( "submitting-ok-button" ).style.visibility = "visible"; _oE( "submitting-content" ).innerHTML = "Something went wrong on our end handling your request. Please try again soon."; } else if ( this.status == 200 ) { _oE( "submitting-title" ).innerHTML = "Thank You!"; _oE( "submitting-ok-button" ).style.visibility = "visible"; _oE( "submitting-content" ).innerHTML = "Your request has been received! Thank you! We will be in touch as soon as possible."; } }; xhttp.open( "POST", "/handle/adoptform", true ); xhttp.setRequestHeader( "Content-type", "application/x-www-form-urlencoded" ); var heatChoice = heatLivestock ? "livestock" : heatRoom ? "room" : heatInsulated ? "insulated" : heatNone ? "none" : heatOther; var transitionChoice = transHaveCrate ? "havecrate" : transNeedCrate ? "needcrate" : transHaveEnclosure ? "haveenclosure" : transHaveRoom ? "haveroom" : ("other: " + transOtherText ); var data = "name=" + encodeURIComponent( name ) + "&email=" + encodeURIComponent( email ) + "&phone=" + encodeURIComponent( phone ) + "&howMany=" + encodeURIComponent( howMany ) + "&poison=" + encodeURIComponent( poisonYes ? "Yes" : "No" ) + "&building=" + encodeURIComponent( building ) + "&location=" + encodeURIComponent( location ) + "&heat=" + encodeURIComponent( heatChoice ) + "&transition=" + encodeURIComponent( transitionChoice ) + "&animals=" + encodeURIComponent( otherAnimals ) + "&comments=" + encodeURIComponent( otherComments ) + "&unfixed=" + encodeURIComponent( unfixedCatsAround ); xhttp.send( data ); } function _c( __id ) { return _oE( __id ).checked === true; } function _v( __id ) { var value = _oE( __id ).value; if ( typeof value == "string" ) { value = value.trim(); if ( value === "" ) { value = null; } } return _uton( value ); } function _oE( __id ) { var toReturn = document.getElementById( __id ); if ( _uton( toReturn ) == null ) { return {}; } return toReturn; } function _uton( _ ) { if ( typeof _ === "undefined" ) { return null; } return _; }