GIF89a php
Current File : /home/hencockfreshchic/public_html/admin.cpanel/uploadjs/createDeal.js
function createDeal()
{
	var prod=$("#prod").val();
	var sprice=$("#sprice").val();
	var rprice=$("#rprice").val();
	var sdate=$("#sdate").val();
	var edate=$("#edate").val();

	if(prod=="")
	{
		alert("Invalid product name");
      $("#prod").focus();
      return false;
	}	

	var regexp;
   regexp = /^[-+]?\d*\.?\d*$/;
   if (!regexp.test(sprice))
   {
      alert("Invalid sale price");
      $("#sprice").focus();
      return false;
   }
   if (sprice == "")
   {
      alert("Enter sale price");
      $("#sprice").focus();
      return false;
   }
   if (sprice.length < 1)
   {
      alert("Enter sale price");
      $("#sprice").focus();
      return false;
   }
   if (sprice.length > 8)
   {
      alert("Enter sale price");
      $("#sprice").focus();
      return false;
   }

   regexp = /^[-+]?\d*\.?\d*$/;
   if (!regexp.test(rprice))
   {
      alert("Invalid real price");
      $("#rprice").focus();
      return false;
   }
   if (rprice == "")
   {
      alert("Enter real price");
      $("#rprice").focus();
      return false;
   }
   if (rprice.length < 1)
   {
      alert("Enter real price");
      $("#rprice").focus();
      return false;
   }
   if (rprice.length > 8)
   {
      alert("Enter real price");
      $("#rprice").focus();
      return false;
   }

   if(sdate=="")
	{
		alert("Invalid start date");
      $("#sdate").focus();
      return false;
	}

	if(edate=="")
	{
		alert("Invalid end date");
      $("#edate").focus();
      return false;
	}

	if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
        } else {          
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } 
  xmlhttp.onreadystatechange=function() 
   {
    if (this.readyState==4 && this.status==200) 
	{
      if(this.responseText==1)
      {
      	alert("New hot deal has been created");
      	window.location.href = ("hot_deals.php");
      }
      else if(this.responseText==2)
      {
      	alert("This product already avilable in hot deal");
      	window.location.href = ("hot_deals.php");
      }
      else if(this.responseText==0)
      {
      	alert("Error : We are unable to create hot deal | Please contact to developer");

      }
	}
  };

  xmlhttp.open("GET","createDeal.php?prod="+prod+"&sprice="+sprice+"&rprice="+rprice+"&sdate="+sdate+"&edate="+edate,true);
  xmlhttp.send();
}