(function($){ $(document).bind('ready', function() { $(window).load(function(){ $('#noactive').change(function() { $('#filtro-h2s').prop('disabled', true); }); $('#active').change(function() { $('#filtro-h2s').prop('disabled', false); }); }); $("#field23 #field23-1").hide(); $("input[name$='atex']").click(function(){ var radio_value = $(this).val(); if(radio_value=='1') { $("#field23 #field23-1").hide("slow"); } else if(radio_value=='2') { $("#field23 #field23-1").show("slow"); } }); $('[name="atex"]:checked').trigger('click'); }); })(jQuery); var submitted ; $(document).ready(function() { $('#username').keyup(username_check); $("#signin_errors").hide(); $('#no').hide(); $('#yes').hide(); $('#form-submit-register').prop('disabled', true); }); function username_check() { var username = $('#username').val(); if (username == "" || username.length < 4) { $('#yes').hide(); } else { $.ajax({ type: "POST", url: "https://www.bio-komp.com/ajax/user.php", data: 'checkUsername=' + username, cache: false, success: function(response) { if (response == 1) { $('#yes').hide(); $('#no').fadeIn(); $('#form-submit-register').prop('disabled', true); } else { $('#no').hide(); $('#yes').fadeIn(); $('#form-submit-register').prop('disabled', false); } } }); } } $('#signupForm').validate({ rules: { username: { required: true, minlength: 4 }, password: { required: true, regex: /^[A-Za-z0-9_]{6,8}$/ }, email: { required: true, email: true }, referer: { required: true }, mansione: { required: true }, company: { required: true }, phone: { required: true }, AGREET: { required: true }, AGREE: { required: true }, address: { required: true } }, //end rules messages: { username: { required: 'Insert Username', minlength: jQuery.format("insert at least {0} chars for the username") }, password: { required: 'Insert Password', regex: "Password lenght: 6 a 8 chars with at least one uppercase letter and one digit character" }, email: { required: 'Insert a valid E-Mail', email: 'this is not a valid e-mail' }, referer: { required: 'Insert a Contact person' }, mansione: { required: 'Insert a Position' }, company: { required: 'Insert a Company' }, phone: { required: 'Insert a Phone Number' }, AGREET: { required: '
To continue, read the information on data processing and tick the box below' }, AGREE: { required: '
To continue please read our terms and tick the box below' }, address: { required: 'Insert an Address' } },//end messages errorPlacement: function(error, element) { if( element.is(':radio') || element.is(':checkbox')) { error.appendTo(element.parent()); } else { error.insertAfter(element); } },//end errorPlacement showErrors: function(errorMap, errorList) { if (submitted) { var summary = "The following fields are still empty:
"; $.each(errorList, function() { summary += " " + this.message + "
"; }); submitted = false; //$("#signin_errors").html(summary); $.alert({ title: 'This form is still incomplete. Please enter all required fields (*) and make sure that the e-mail address is correct', content: summary + '

', buttons: { modify : function(){ // button action $('html, body').animate({scrollTop: $("header").offset().top}, 2000); }} }); return false; } this.defaultShowErrors(); }, invalidHandler: function(form, validator) { submitted = true; }, submitHandler: function (form) { submitForm(); } });//end validate //form per registrare utenti function submitForm(){ // Initiate Variables With Form Content var username = $("#username").val(); var password = $("#password").val(); var referer = $("#referer").val(); var mansione = $("#mansione").val(); var lastip = $("#lastip").val(); var company = $("#company").val(); var address = $("#address").val(); var country = $("#country").val(); var email = $("#email").val(); var message = $("#message").val(); var message = message.replace(/&/g, '%26'); var phone = $("#phone").val(); var web = $("#web").val(); var doRegister = $("#doRegister").val(); $.ajax({ type: "POST", url: "https://www.bio-komp.com/ajax/user.php", data: "username=" + username + "&password=" + password + "&referer=" + referer + "&mansione=" + mansione + "&phone=" + phone + "&email=" + email + "&message=" + message + "&country=" + country + "&address=" + address + "&lastip=" + lastip + "&company=" + company + "&web=" + web+ "&doRegister=" + doRegister , beforeSend: function() { // setting a timeout $("#signupForm").parent().find('button#form-submit-register').addClass("flash").html('Loading.....'); }, success : function(responseText){ $('form#signupForm input[type="text"],input[type="tel"],input[type="email"],textarea, select').val(''); $("#signupForm").parent().find('button#form-submit-register').removeClass("flash"); responseText = "You are registered correctly on our site! You will receive a receipt of your registration in your inbox.
Thanks. "; $.alert({ title: 'Success!', content: responseText + '

', theme: 'green', animation: 'zoom', buttons: { ok: function(){ // button action $('html, body').animate({scrollTop: $("header").offset().top}, 2000); window.location.href = ("https://www.bio-komp.com/index.php"); }} }); $("form#signupForm").parent().find('button#form-submit-register').removeClass("flash").html("You're registered !"); return false; //$('form#contactForm input[type="text"],input[type="tel"],input[type="email"],textarea, select').val(''); }, error: function() { alert("Chiamata fallita, si prega di riprovare..."); } }); } $('#contactForm').validate({ rules: { email: { required: true, email: true }, referer: { required: true } ,mansione: { required: true }, company: { required: true }, phone: { required: true }, AGREET: { required: true }, AGREE: { required: true }, address: { required: true } }, //end rules messages: { email: { required: 'Insert an E-Mail', email: 'This is not a valid email address' }, referer: { required: 'Insert a Contact person' }, mansione: { required: 'Insert a Position' }, company: { required: 'Insert a Company' }, phone: { required: 'Insert a Phone' }, AGREET: { required: '
To continue, read the information on data processing and tick the box below' }, AGREE: { required: '
To continue please read our terms and tick the box below' }, address: { required: 'Insert an Address' } },//end messages errorPlacement: function(error, element) { if( element.is(':radio') || element.is(':checkbox')) { error.appendTo(element.parent()); } else { error.insertAfter(element); } },//end errorPlacement showErrors: function(errorMap, errorList) { if (submitted) { var summary = "The following fields are still empty:
"; $.each(errorList, function() { summary += " " + this.message + "
"; }); submitted = false; //$("#signin_errors").html(summary); $.alert({ title: 'This form is still incomplete. Please fill in all mandatory fields (*) and ensure that the email address is correct.', content: summary + '

', buttons: { modify : function(){ // button action $('html, body').animate({scrollTop: $("header").offset().top}, 2000); }} }); return false; } this.defaultShowErrors(); }, invalidHandler: function(form, validator) { submitted = true; }, submitHandler: function (form) { submitFormContact(); } });//end validate function submitFormContact(){ // Initiate Variables With Form Content var referer = $("#referer").val(); var mansione = $("#mansione").val(); var company = $("#company").val(); var address = $("#address").val(); var country = $("#country").val(); var email = $("#email").val(); var message = $("#message").val(); var phone = $("#phone").val(); var web = $("#web").val(); var message = message.replace(/&/g, '%26'); var lastip = $("#lastip").val(); var unit = $("#Unit").val(); $.ajax({ type: "POST", url: "https://www.bio-komp.com/ajax/sendmail.php", data: "referer=" + referer + "&mansione=" + mansione + "&phone=" + phone + "&email=" + email + "&message=" + message + "&country=" + country + "&address=" + address + "&lastip=" + lastip + "&company=" + company + "&web=" + web + "&unit=" + unit, beforeSend: function() { // setting a timeout $("#contactForm").parent().find('button#form-submit').addClass("flash").html('Sending.....'); }, success : function(responseText){ $('form#contactForm input[type="text"],input[type="tel"],input[type="email"],textarea, select').val(''); $("#contactForm").parent().find('button#form-submit').removeClass("flash"); if (($('div#breadcrumbs img.breadcrumbs[id=1]').attr("rel")==="1" || $('div#breadcrumbs img.breadcrumbs[id=2]').attr("rel")==="2"|| $('div#breadcrumbs img.breadcrumbs[id=3]').attr("rel")==="3"|| $('div#breadcrumbs img.breadcrumbs[id=4]').attr("rel")==="4") && (($('div#breadcrumbs img.breadcrumbs[id=5]').attr("rel")==="5") && ($('div#breadcrumbs img.breadcrumbs[id=6]').attr("rel")==="6"))) { responseText == "Thank you for submitting your quote information! Our sales team will be reviewing your enquiry and get back to you soon to provide you our detailed offer.For further inquiries, please contact us here"; }else{ responseText == "Thank you for submitting your information!"; } $.alert({ title: 'Success!', content: responseText + '

', theme: 'green', animation: 'zoom', buttons: { ok: function(){ // button action $('html, body').animate({scrollTop: $("header").offset().top}, 2000); window.location.href = ("https://www.bio-komp.com/index.php"); }} }); $("form#contactForm").parent().find('button#form-submit').removeClass("flash").html("Sent"); return false; //$('form#contactForm input[type="text"],input[type="tel"],input[type="email"],textarea, select').val(''); } }); } //spare parts $('#contactFormSpareParts').validate({ rules: { email: { required: true, email: true }, referer: { required: true } ,mansione: { required: true }, company: { required: true }, phone: { required: true }, address: { required: true }, Compressor_code: { required: true }, Serial_number: { required: true }, Delivery_address_of_invoice: { required: true }, Delivery_address_of_spare_parts: { required: true }, AGREET: { required: true }, AGREE: { required: true }, Transportation: { required: true }, list_of_required_parts_and_their_quantity: { required: true } }, //end rules messages: { email: { required: 'Insert an E-Mail', email: 'This is not a valid email address' }, referer: { required: 'Insert a Contact person' }, mansione: { required: 'Insert a Position' }, company: { required: 'Insert a Company' }, phone: { required: 'Insert a Phone' }, address: { required: 'Insert an Address' }, Compressor_code: { required: 'Insert an Compressor code' }, Serial_number: { required: 'Insert a Serial number' }, Delivery_address_of_invoice: { required: 'Insert a Delivery address of invoice' }, Delivery_address_of_spare_parts: { required: 'Insert an Delivery address of spare parts' }, Transportation: { required: 'Insert a Transportation' }, AGREET: { required: '
To continue, read the information on data processing and tick the box below' }, AGREE: { required: '
To continue please read our terms and tick the box below' }, list_of_required_parts_and_their_quantity: { required: 'Insert a list of required parts and their quantity' } },//end messages errorPlacement: function(error, element) { if( element.is(':radio') || element.is(':checkbox')) { error.appendTo(element.parent()); } else { error.insertAfter(element); } },//end errorPlacement showErrors: function(errorMap, errorList) { if (submitted) { var summary = "The following fields are still empty:
"; $.each(errorList, function() { summary += " " + this.message + "
"; }); submitted = false; //$("#signin_errors").html(summary); $.alert({ title: 'This form is still incomplete. Please fill in all mandatory fields (*) and ensure that the email address is correct.', content: summary + '

', buttons: { modify : function(){ // button action $('html, body').animate({scrollTop: $("header").offset().top}, 2000); }} }); return false; } this.defaultShowErrors(); }, invalidHandler: function(form, validator) { submitted = true; }, submitHandler: function (form) { submitFormContactSpare(); } });//end validate function submitFormContactSpare(){ // Initiate Variables With Form Content var referer = $("#referer").val(); var mansione = $("#mansione").val(); var company = $("#company").val(); var address = $("#address").val(); var country = $("#country").val(); var email = $("#email").val(); var phone = $("#phone").val(); var web = $("#web").val(); var Compressor_model = $("#Compressor_model").val(); var Compressor_code = $("#Compressor_code").val(); var Serial_number = $("#Serial_number").val(); var Delivery_address_of_invoice = $("#Delivery_address_of_invoice").val(); var Delivery_address_of_spare_parts = $("#Delivery_address_of_spare_parts").val(); var Transportation = $("#Transportation").val(); var list_of_required_parts_and_their_quantity = $("#list_of_required_parts_and_their_quantity").val(); var lastip = $("#lastip").val(); $.ajax({ type: "POST", url: "https://www.bio-komp.com/ajax/sendmail-spare-parts.php", data: "referer=" + referer + "&mansione=" + mansione + "&phone=" + phone + "&email=" + email + "&message=" + message + "&country=" + country + "&address=" + address + "&lastip=" + lastip + "&company=" + company + "&web=" + web + "&Compressor_model=" + Compressor_model + "&Compressor_code=" + Compressor_code + "&Serial_number=" + Serial_number + "&Delivery_address_of_invoice=" + Delivery_address_of_invoice + "&Delivery_address_of_spare_parts=" + Delivery_address_of_spare_parts + "&Transportation=" + Transportation + "&list_of_required_parts_and_their_quantity=" + list_of_required_parts_and_their_quantity , beforeSend: function() { // setting a timeout $("#contactFormSpareParts").parent().find('button#form-submit').addClass("flash").html('Sending.....'); }, success : function(responseText){ $('form#contactFormSpareParts input[type="text"],input[type="tel"],input[type="email"],textarea, select').val(''); $("#contactFormSpareParts").parent().find('button#form-submit').removeClass("flash"); $.alert({ title: 'Success!', content: responseText + '

', theme: 'green', animation: 'zoom', buttons: { ok: function(){ // button action $('html, body').animate({scrollTop: $("header").offset().top}, 2000); window.location.href = ("https://www.bio-komp.com/index.php"); }} }); $("form#contactFormSpareParts").parent().find('button#form-submit').removeClass("flash").html("Sent"); return false; //$('form#contactFormSpareParts input[type="text"],input[type="tel"],input[type="email"],textarea, select').val(''); } }); } //loginForm $('#loginForm').validate({ rules: { username: { required: true }, password: { required: true } }, //end rules messages: { username: { required: 'Username is required' }, password: { required: 'Password is required' } },//end messages errorPlacement: function(error, element) { if( element.is(':radio') || element.is(':checkbox')) { error.appendTo(element.parent()); } else { error.insertAfter(element); } },//end errorPlacement showErrors: function(errorMap, errorList) { if (submitted) { var summary = "The following fields are still empty:
"; $.each(errorList, function() { summary += " " + this.message + "
"; }); submitted = false; $("#login_response").html(summary); return false; } this.defaultShowErrors(); }, invalidHandler: function(form, validator) { submitted = true; }, submitHandler: function (form) { submitFormLogin(); } });//end validate function submitFormLogin(){ // Initiate Variables With Form Content var username = $("#username").val(); var password = $("#password").val(); var doLogin = $("#doLogin").val(); $.ajax({ type: "POST", url: "https://www.bio-komp.com/ajax/ajax_login.php", data: "username=" + username + "&password=" + password + "&doLogin=" + doLogin, beforeSend: function() { // setting a timeout $("#login_response").addClass("flash").html('Loading.....'); }, success : function(responseText){ if(responseText == 'OK') // LOGIN OK? { $("#loginForm").parent().find('button#form-submit').removeClass("flash"); $("form#loginForm").hide(); var login_response = '
' + '
' + '
' + '' + '
' + '
'+ "You are successfully logged in!
Please wait while you're redirected...
"; $("#login_response").html(login_response); // Refers to 'status' // After 3 seconds redirect the setTimeout('go_to_private_page()', 3000); } else // ERROR? { $("#loginForm").parent().find('button#form-submit').removeClass("flash"); var login_response = responseText; $('form')[0].reset(); $('#login_response').html(login_response); $('#login_response').show().delay(5000).fadeOut('slow'); } // $.magnificPopup.close(); // $(location).attr('href', 'https://www.bio-komp.com/account.php') } }); } function go_to_private_page() { window.location = '../../account.php'; // Members Area } //form di contatto generico $("#configurationForm").submit(function(event){ // cancels the form submission event.preventDefault(); submitConfigurationForm(); }); function submitConfigurationForm(){ // Initiate Variables With Form Content var referer = $("#referer").val(); var mansione = $("#mansione").val(); var company = $("#company").val(); var address = $("#address").val(); var country = $("#country").val(); var email = $("#email").val(); var message = $("#message").val(); var message = message.replace(/&/g, '%26'); var phone = $("#phone").val(); var web = $("#web").val(); var lastip = $("#lastip").val(); $.ajax({ type: "POST", url: "https://www.bio-komp.com/ajax/sendmail.php", data: "referer=" + referer + "&mansione=" + mansione + "&phone=" + phone + "&email=" + email + "&message=" + message + "&country=" + country + "&address=" + address + "&lastip=" + lastip + "&company=" + company + "&web=" + web, beforeSend: function() { // setting a timeout $("#configurationForm").parent().find('button#form-submit').addClass("flash").html('Loading.....'); }, success : function(responseText){ $('form#configurationForm input[type="text"],input[type="tel"],input[type="email"],textarea, select').val(''); $("#configurationForm").parent().find('button#form-submit').removeClass("flash").html(responseText); } }); }