$(function(){

//Do what we need to when form is submitted.
$('#form_submit').click(function(){


    
var input_name = $('#form_name').val();
var input_surname = $('#form_surname').val();
var input_company = $('#form_company').val();
var input_address = $('#form_address').val();
var input_city = $('#form_city').val();
var input_province = $('#form_province').val();
var input_zip_code = $('#form_zip_code').val();
var input_country = $('#form_country').val();
var input_phone = $('#form_phone').val();
var input_mobile = $('#form_mobile').val();
var input_fax = $('#form_fax').val();
var input_email = $('#form_email').val();
var input_website = $('#form_website').val();
var input_messaggio = $('#form_messaggio').val();
var input_convalida = $('#form_convalida').val();
var input_language = $('#form_language').val();
    
    var response_text = $('#response');
    
    response_text.hide();

    //Change response text to 'loading...'
    response_text.html('Loading...').show();

    //Make AJAX request
    $.post('http://www.arzuffisrl.it/assets_eng/php/contact-send.php', {
    
name: input_name,
surname: input_surname,
company: input_company,
address: input_address,
city: input_city,
province: input_province,
zip_code: input_zip_code,
country: input_country,
phone: input_phone,
mobile: input_mobile,
fax: input_fax,
email: input_email,
website: input_website,
messaggio: input_messaggio,
convalida: input_convalida,
language: input_language            }, function(data){
                if (data=='OK')
                {
                     if ( input_language == 'it')
                     {
                         var OK_RedirectPage='conferma-invio.htm';
                     }
                     else if ( input_language== 'en')
                     {
                         var OK_RedirectPage='../../eng/send-confirmation.html';
                     }
                     else if ( input_language== 'fr')
                     {
                         var OK_RedirectPage='/';
                     }
                     else if ( input_language== 'es')
                     {
                         var OK_RedirectPage='/';
                     }
                     else if ( input_language== 'de')
                     {
                         var OK_RedirectPage='/';
                     }
                     else if ( input_language== 'ru')
                     {
                         var OK_RedirectPage='/';
                     }
                     else
                     {
                         var OK_RedirectPage='conferma-invio.htm';
                     }

                     location.href =OK_RedirectPage;
                }
                else
                {
                    response_text.html(data);
                }
                });

            //Cancel default action
            return false;
    });

});
