$(document).ready(function(){
    var stock = $("#chkstock").val();
    if(stock < 1){
      $("#notify").show();
    }
    /*$("#shownotifyslide").click(function () {
      if ($("#notifyslide").is(":hidden")) {
        $("#notifyslide").slideDown("slow");
      } else {
        $("#notifyslide").slideUp("medium");
      }
    });*/
    
    $("#vEmail").click(function () {$("#vEmail").val('');});
    $("#btnsenddetail").click(function () {

var myLoc = location.href;
		  myLoc = myLoc.replace("http://", "");
		  var myurlParts = myLoc.split("/");
		  var myurl = myurlParts[0];
          
          var email = $("#vEmail").val();
          var proId = $("#proId").val();
          
          
          if(email == '' || email == 'Enter Email Address'){
            alert('Please, Enter Email address');
            $("#vEmail").val('');
            $("#vEmail").focus();
            return;
          }
          if(!isValidEmailAddress(email)){
            alert('Please, Enter valid Email address');
            $("#vEmail").focus();
            return;
          }          
          var query = 'email='+email+'&proId='+proId;
          myurl="http://"+myurl;
          $.post(myurl+"/"+"products/detail/notification.php", query, function(data){ 				
                $("#replacenotify").html(data);
          });
    });
   });
   function isValidEmailAddress(emailAddress){
        var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
        return pattern.test(emailAddress);
  }

