﻿// JScript File

// JScript File
/* Form Validation Script for Contact us
Message			: Create an array of form elements and apply validation rules on them.
*/
    function ConfirmDelete()
    {
         var strGridName = document.getElementById("dtlCart"); 
         return CfmDelete(strGridName);
    }
    function SelectAll(obj)
    {
       var strGridName=document.getElementById("dtlCart");
       return CheckAll(obj,strGridName);
    }
    
 function validateUpdate()
 { 
    //return ValidateGreaterThanZero();
    var selectedBoxes = ""; 
    lblgrid = document.getElementById('dtlCart');
    var inputTags = lblgrid.getElementsByTagName("input"); 
    var tagsLength = inputTags.length; 
    for(var i=0;i<tagsLength ;i++)
    { 
       if(inputTags[i].checked==true)
       {
           selectedBoxes ="1"; 
       }
    } 
    if(selectedBoxes.length>0)
    {
            return window.confirm("Are you sure you want to update quantity?");
    }
    else
    {
        alert("Please select the item(s) you want to update!");
        return false;
    }
  }
  
function removeCart()
 {
    var selectedBoxes = ""; 
    lblgrid = document.getElementById('dtlCart');
    var inputTags = lblgrid.getElementsByTagName("input"); 
    var tagsLength = inputTags.length; 
    for(var i=0;i<tagsLength ;i++)
    { 
       if(inputTags[i].checked==true)
           selectedBoxes ="1"; 
    } 
    if(selectedBoxes.length>0)
    {
      return window.confirm("Are you sure you want to remove item(s) from the cart?");
      
    }
    else
    {
        alert("Please select the item(s) you want to remove!");
        return false;
    }
 }  
 
 function keypress(e)
{
    if ([e.keyCode||e.which]==8) //this is to allow backspace
    return true;
    if ([e.keyCode||e.which]==9) //this is to allow tab
    return true;
    //if ([e.keyCode||e.which]==46) //this is to allow period
   // return true;
    if ([e.keyCode||e.which] < 48 || [e.keyCode||e.which] > 57)
    e.preventDefault? e.preventDefault() : e.returnValue = false;
}
 function Shippingkeypress(e)
{
    if ([e.keyCode||e.which]==8) //this is to allow backspace
    return true;
    if ([e.keyCode||e.which]==9) //this is to allow tab
    return true;
    if ([e.keyCode||e.which]==46) //this is to allow period
   return true;
    if ([e.keyCode||e.which] < 48 || [e.keyCode||e.which] > 57)
    e.preventDefault? e.preventDefault() : e.returnValue = false;
}

