var WebsiteDomain   ="https://www.mekorhatextil.com/BaseEcommerceAA"; function CreateOrderButton(GetFrm,PayBuy,PayAmount) {  var Frm = document.getElementById(GetFrm);   if(Frm.Fullname.value==''){ alert("הערה: חובה לרשום שם מלא"); Frm.Fullname.focus(); return false; }  if(Frm.Mobile.value==''){ alert("הערה: חובה לרשום טלפון נייד"); Frm.Mobile.focus(); return false; } if(Frm.Mobile.value!='' && checkPhoneNumber(Frm.Mobile)==false){ alert("המספר אינו תקין"); Frm.Mobile.focus(); return false; } if(Frm.Email.value!='' && isValidEmailAddress(Frm.Email.value)==false){  alert("דואר אלקטרוני אינו תקין"); Frm.Email.focus(); return false;  } if(Frm.ShippingStatus.value=='Shipping') {   if(Frm.City.value==''){ alert("הערה: חובה לרשום עיר למשלוח"); Frm.City.focus(); return false; }   if(Frm.Address.value==''){ alert("הערה: חובה לרשום כתובת מלאה למשלוח"); Frm.Address.focus(); return false; } } else if(Frm.ShippingStatus.value=='LocalPickup') { }  if(PayBuy=='ccard' || PayBuy=='paypal'){ if(Frm.terms.checked==false){ alert("נא לאשר תקנון האתר"); return false; } } switch(PayBuy) { case "Regular": break; case "whatsapp": document.getElementById("payButtonWhatsApp").disabled = true; if(document.getElementById("payButtonPayPal")){ document.getElementById("payButtonPayPal").disabled = true; } if(document.getElementById("payButtonCreditCard")){ document.getElementById("payButtonCreditCard").disabled = true; } document.getElementById("payButtonWhatsApp").innerHTML =" מייצר הזמנה, אנה המתן..."; document.getElementById("payButtonWhatsAppBootstrap").className ="col-12";   if(document.getElementById("payButtonPayPalBootstrap")){ document.getElementById("payButtonPayPalBootstrap").style.display ='none'; } if(document.getElementById("payButtonCreditCardBootstrap")){ document.getElementById("payButtonCreditCardBootstrap").style.display ='none'; } break; case "paypal": if(document.getElementById("payButtonWhatsApp")){ document.getElementById("payButtonWhatsApp").disabled = true; } document.getElementById("payButtonPayPal").disabled = true; if(document.getElementById("payButtonCreditCard")){ document.getElementById("payButtonCreditCard").disabled = true; } document.getElementById("payButtonPayPal").innerHTML =" מייצר הזמנה, אנה המתן..."; if(document.getElementById("payButtonWhatsAppBootstrap")){ document.getElementById("payButtonWhatsAppBootstrap").style.display ='none'; } document.getElementById("payButtonPayPalBootstrap").className ="col-12"; if(document.getElementById("payButtonCreditCardBootstrap")){ document.getElementById("payButtonCreditCardBootstrap").style.display ='none'; } break; case "ccard": if(document.getElementById("payButtonWhatsApp")){ document.getElementById("payButtonWhatsApp").disabled = true; } if(document.getElementById("payButtonPayPal")){ document.getElementById("payButtonPayPal").disabled = true; } document.getElementById("payButtonCreditCard").disabled = true; document.getElementById("payButtonCreditCard").innerHTML =" מייצר הזמנה, אנה המתן..."; if(document.getElementById("payButtonWhatsAppBootstrap")){ document.getElementById("payButtonWhatsAppBootstrap").style.display ='none'; } if(document.getElementById("payButtonPayPalBootstrap")){ document.getElementById("payButtonPayPalBootstrap").style.display ='none'; } document.getElementById("payButtonCreditCardBootstrap").className ="col-12"; break; }  var uniqNum   ="b86408ed5d7122c9e6"; var data ="";  data+="task=CreateOrder";  data+="&Fullname="+Frm.Fullname.value;  data+="&Mobile="+Frm.Mobile.value; data+="&Email="+Frm.Email.value;  data+="&City="+Frm.City.value;  data+="&Address="+Frm.Address.value;  data+="&Remark="+Frm.Remark.value; data+="&uniqNum="+encodeURIComponent(uniqNum);  $.ajax({   type: "POST" ,   url: 'GlobalIncludes/_CLASS/class.basket.php' ,   data: data ,   async: false ,   cache: false ,   timeout: 5000 ,   dataType: 'text' ,   error: function() {    return 'error';   },   success: function(Result) { Result = trim(Result," "); switch(PayBuy) { case "Regular":      alert("הזמנה נשלחה למערכת");    window.location.href ="index.php"; break;  case "whatsapp":  var whatsapp_phone  ="972552473338";  var location_href  ="https://api.whatsapp.com/send?phone="+whatsapp_phone+"&text="+Result+"&source=&data=";       window.location.href = location_href; break; case "paypal":  var paypal_email   =""; var btn_return    = encodeURIComponent(WebsiteDomain+"/ThanksPage.php"); var btn_cancel_return  =""; encodeURIComponent(WebsiteDomain+'/CancelPage.php'); var cbt     =""; var location_href ="https://www.paypal.com/cgi-bin/webscr/";  location_href+="?business="+paypal_email; location_href+="&cmd=_xclick"; location_href+="&item_name=תשלום מ"+Frm.Fullname.value+" עבור מס "+uniqNum; location_href+="&amount="+PayAmount; location_href+="¤cy_code=ILS"; location_href+="&return="+btn_return; location_href+="&cancel_return="+btn_cancel_return;       window.location.href = location_href; break;     case "ccard": var location_href ="PayPlusCreatePaymentPage.php"; location_href+="?uniqNum="+uniqNum;  location_href+="&custom_invoice_name=תשלום מ"+Frm.Fullname.value+" עבור מס "+uniqNum; location_href+="&amount="+PayAmount; location_href+="&Fullname="+Frm.Fullname.value; location_href+="&Email="+Frm.Email.value; location_href+="&Mobile="+Frm.Mobile.value; location_href+="&City="+Frm.City.value; location_href+="&Address="+Frm.Address.value; window.location.href = location_href; break; }   }  }); }