function SubmitSales() {
    var isValid = false;
    var phone_number = $("#txtPhoneSales").val();
    if (phone_number.length >= 1 && phone_number.length <= 11 && phone_number.match(/0?[1-9][0-9]?[0-9]{8}$/))
        isValid = true;
    if (!isValid) {
        alert("יש להזין מספר תקין");
        return;
    }
    if (isValid) {
        jQuery.ajax({
            dataType: "html",
            cache: false,
            contentType: "application/x-www-form-urlencoded",
            async: true,
            type: "POST",
            url: "/umbraco/plugins/click2call.ashx",
            data: { phone: phone_number, id:1 },
            complete: function(XMLHttpRequest, textStatus) {
                var isSuccess = XMLHttpRequest.responseText;
                if(isSuccess =="0")
                    alert("השיחה נשלחה בהצלחה");
                else
                    alert("נסה שנית מאוחר יותר");
                //alert(XMLHttpRequest.responseText);
                $("#txtPhoneSales").val("מספר טלפון שלך");
                //alert("השיחה נשלחה בהצלחה");
            }
        });
    }
}

function SubmitSupport() {
    $("#phone").css("background-color", "white");
    $("#full_name").css("background-color", "white");
    var isValid = false;
    var phone_number = $("#phone").val();
    if (phone_number.length >= 1 && phone_number.length <= 11 && phone_number.match(/0?[1-9][0-9]?[0-9]{8}$/))
        isValid = true;
    if (!isValid) {
         $("#phone").css("background-color", "red").effect("pulsate");
    }
    
    var name = $("#full_name").val();
    if(name == '' || name == 'שם')
    {
       $("#full_name").css("background-color", "red").effect("pulsate");
    }
      
    var c_type = $("#c_id :selected").val();
    
    //alert(name + " " + c_type );
    //return;
      
    if (isValid) {
        $("#click2callSupportDIV").html("<img alt='wait...' title='Please wait...' src='/images/loading11.gif' />");
        jQuery.ajax({
            dataType: "html",
            cache: false,
            contentType: "application/x-www-form-urlencoded",
            async: true,
            type: "POST",
            url: "/umbraco/plugins/click2call.ashx",
            data: { phone: phone_number, id:2, full_name : name,c_id:c_type   },
            complete: function(XMLHttpRequest, textStatus) {
                var isSuccess = XMLHttpRequest.responseText;
                if(isSuccess =="0")
                    $("#click2callSupportDIV").html("בקשתך התקבלה. הטלפון שלך יצלצל בעוד מספר שניות...");
                    
                else
                     $("#click2callSupportDIV").html(XMLHttpRequest.responseText);

                //alert(XMLHttpRequest.responseText);
                //$("#txtPhoneSales").val("מספר טלפון שלך");
                //alert("השיחה נשלחה בהצלחה");
            }
        });
    }
    else
        return;
}
