() { var strSubject, strCompany, strEmail, strName, strTel, strMessage, strCode; strSubject = $("input#subject").val(); strCompany = $("input#company").val(); strEmail = $("input#Email").val(); strName = $("input#name").val(); strTel = $("input#tel").val(); strMessage = $("#content").val(); strCode = $("#code").val(); if (strSubject == "") { if (true) { alert("Vänligen ange din Ämne"); $("input#subject").focus(); return false; } } if (strCompany == "") { if (false) { alert("Vänligen ange din Företag"); $("input#company").focus(); return false; } } if (strEmail == "") { if (true) { alert("Vänligen ange din E-post"); $("input#Email").focus(); return false; } } else { var myreg = /^[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/; if (!myreg.test(strEmail)) { alert("E-postformatfel"); $("input#Email").focus(); return false; } } if (strName == "") { if (true) { alert("Vänligen ange din namn"); $("input#name").focus(); return false; } } if (strTel == "") { if (false) { alert("Vänligen ange din Tel"); $("input#tel").focus(); return false; } } if (strMessage == "") { if (true) { alert("Vänligen ange din Meddelande"); $("#content").focus(); return false; } } if (strCode == "") { $("#code").focus(); return false; } if (ttt == 1) { alert("5 s!"); return false; } ttt = 1; var timer1 = setTimeout("timerli()", 5000); try { var url = window.location.pathname; $.ajax({ type: "POST", url: "/js/AjaxData.ashx", data: "Action=AddBook1&Type=NewBook&Subject=" + encodeURIComponent(strSubject) + "&Company=" + encodeURIComponent(strCompany) + "&Email=" + encodeURIComponent(strEmail) + "&Name=" + encodeURIComponent(strName) + "&Url=" + encodeURIComponent(url) + "&Tel=" + encodeURIComponent(strTel) + "&Message=" + encodeURIComponent(strMessage) + "&Code=" + encodeURIComponent(strCode), success: function (ret) { if (ret == "200") { window.location.href = "/thank.html"; } else { alert(ret); } } }); } catch (ex) { alert("Erro" + ex); } } function timerli() { ttt = 0; }