﻿//JScript File

/*----------------------------COMMON FUNCTIONS------------------------------------------*/
function trim(strText) 
{ 
   // this will get rid of leading spaces 
   while (strText.substring(0,1) == ' ') 
       strText = strText.substring(1, strText.length); 
   // this will get rid of trailing spaces 
   while (strText.substring(strText.length-1,strText.length) == ' ') 
       strText = strText.substring(0, strText.length-1); 
  return strText; 
} 

// Funtion to check blank value
function Blank(theField,s)
{
    if(trim(theField.value)=="")
    {
        alert("Please enter " + s);
        theField.focus();
        return false;
    }
    return true;    
}
// Function to check Email
function chkEmail(theField,msg)
{
        var a=theField.value;
        var reg_mail=(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+(\.[A-Za-z0-9]{2,3})(\.[A-Za-z0-9]{2,3})?$/);
      
        if((a.search(reg_mail)==-1))
          { 
            alert(msg);
            theField.focus();
            return false;            
          }
        
          return true;
          
}
//Function to check DropDown
function SelectDropDown(theField,s)
{
    if(theField.selectedIndex==0)
        {
            alert("Please select " +s);
            theField.focus();
            return false;
        }
     return true;
}
//Function to check url
function isValidURL(theField,msg)
{
    var url=theField.value;
    var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/;
    if(RegExp.test(url))
    {
        return true;
    }
    else
    {
            alert(msg);
            theField.focus();
            return false;
    }
} 
//Function to check image format
function isValidImamge(theField,msg)
{
    var img=theField.value;
    var RegExp =/^.*(\.(gif|jpg|bmp|jpeg|png|GIF|JPG|BMP|JPEG|PNG))$/;
    if(img!="")
    {
     if(RegExp.test(img))
    {
        return true;
    }
    else
    {
            alert(msg);
            theField.focus();
            return false;
    }
    }
    return true;
}
//Function to check lenght of the control 
function lengthRange(theField,len1,len2,msg)
{
      var i;
      var valuec=theField.value;
      var len=valuec.length;
      if(valuec!="")
      {
     if((len<len1) || (len>len2))
        {
      alert(msg);
      theField.focus();
       return false;
        } 
      }
      return true;
}
//Function to validate number 
function isValidNumber(theField,s)
{
     var strno=/^[0-9]+$/;
     var no=theField.value;
     if(no!="")
     {
     if(strno.test(no))
     {
        return true;
     }
     else
     {
            alert("Please enter valid " + s);
            theField.focus();
            return false;
     }
      }
      return true;   
}
//Function to validate number 
function isValidFloat(theField,s)
{
     var strno=/^[0-9.]+$/;
     var no=theField.value;
     if(no!="")
     {
     if(strno.test(no))
     {
        return true;
     }
     else
     {
            alert("Please enter valid " + s);
            theField.focus();
            return false;
     }
     }
      else
      {
      return true;
      }
}
function isValidFloat_Prices(theField,theField1,s)
{
     var strno=/^[0-9.]+$/;
     var no=theField.value;
     if(theField1.selectedIndex!=2)
     {
     if(strno.test(no))
     {
        return true;
     }
     else
     {
            alert("Please enter valid " + s);
            theField.focus();
            return false;
     }
      }
      return true;   
}
function Blank_Prices(theField,theField1,s)
{
if(theField1.selectedIndex!=2)
{
    if(trim(theField.value)=="")
    {
        alert("Please enter " + s);
        theField.focus();
        return false;
    }
 
     } 
        return true;   
}

//Function to check password mismatch
function PasswordMismatch(Pwd1,Pwd2)
{
    if(Pwd1.value!=Pwd2.value)
      {
            alert("Your password entries did not match.");
            Pwd1.focus();
            return false;
      }
     return true;
}

//Function to check first name
function FirstName(theField,s)
{
     var strpar=/^[a-zA-Z][a-zA-Z\']*$/;
     var strcomp1=theField.value.match(strpar);
     if(strcomp1==null)
      {
            alert("Please enter valid " + s);
            theField.focus();
            return false;
      }
      return true;
}

//Function to check Name
function Name(theField,s)
{
    // var strpar=/^[a-zA-Z][a-zA-Z.'\s]*$/;
      var strpar=/^[a-zA-Z. ]+$/;
     var strcomp1=theField.value.match(strpar);
     if(strcomp1==null)
      {
            alert("Please enter valid " + s);
            theField.focus();
            return false;
      }
      return true;
}

//Function to check valid phone no(u.s only)
function PhoneNumber(theField,s)
{
     
     var strpar=/^[0-9]{3}[-]?[0-9]{3}[-]?[0-9]{4}$/;
     var strcomp1=theField.value.match(strpar);
     if(strcomp1==null)
      {
            alert("Please enter valid " + s + ", ex. 503-636-4962.");
            theField.focus();
            return false;
      }
   return true;
}




/*-----------------IncludedOn 19/10/2007--------------------------------------------------*/
function checkdate(theField)
{
var validformat=/^\d{2}\/\d{2}\/\d{4}$/ ;//Basic check for format validity
var returnval=false;
if (!validformat.test(theField.value))
alert("Invalid Date Format. Please correct.");
else
{ //Detailed check for valid date ranges
var monthfield=theField.value.split("/")[0];
var dayfield=theField.value.split("/")[1];
var yearfield=theField.value.split("/")[2];
var dayobj = new Date(yearfield, monthfield-1, dayfield);
if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
alert("Invalid Day, Month, or Year range detected. Please correct.");
else
returnval=true;
}
if (returnval==false) 
{
theField.select();
}
return returnval;
}
/*----------------------------SPECIFIC FUNCTIONS----------------------------------------*/
//Validation Used in form NewCategory.aspx
function ValidateCategory()
{
        //CategoryName
        if(!Blank(document.getElementById('ctl00_mainContent_txtCatName'),"category name."))
        { 
        return false;
        }   
        if(!lengthRange(document.getElementById('ctl00_mainContent_txtCatName'),2,25,"please enter category name between 2 to 25."))
        { 
        return false;
        }   
        //CategoryDescription
       if(!lengthRange(document.getElementById('ctl00_mainContent_txtCatDes'),2,500,"please enter category description between 2 to 500."))
        { 
        return false;
        }   
        //category image
        if(!isValidImamge(document.getElementById('ctl00_mainContent_CatImage'),"please enter image in correct format."))
        { 
        return false;
        }    
        //parent category
         if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlParCat'),"parent category."))
        { 
        return false;
        }   
       //Active  
        if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlActive'),"active status"))
        { 
        return false;
        }   
        //SortOrder
          if(!isValidNumber(document.getElementById('ctl00_mainContent_txtSortOrder'),"sort number."))
        { 
        return false;
        }       
}
//Validation used in form NewProduct.aspx
function ValidateProduct()
{
        //ProductName
        if(!Blank(document.getElementById('ctl00_mainContent_txtProName'),"product name."))
        { 
        return false;
        }   
        if(!lengthRange(document.getElementById('ctl00_mainContent_txtProName'),2,100,"please enter product name between 2 to 100 characters."))
        { 
        return false;
        }   
        //ProductDescription
       if(!lengthRange(document.getElementById('ctl00_mainContent_txtProDes'),2,250,"please enter product description between 2 to 250 characters."))
        { 
        return false;
        }   
        //ProductDetails 
        if(!lengthRange(document.getElementById('ctl00_mainContent_txtDetails'),2,500,"please enter product details between 2 to 500 characters."))
        { 
        return false;
        }   
       
        //Price 
        if(!Blank(document.getElementById('ctl00_mainContent_txtprice'),"price."))
        { 
        return false;
        }   
        if(!isValidFloat(document.getElementById('ctl00_mainContent_txtprice'),"price."))
        { 
        return false;
        }       
        //ThumbImage 
          if(!isValidImamge(document.getElementById('ctl00_mainContent_thumbimg'),"please enter thumb image in correct format."))
        { 
        return false;
        } 
        //LargeImage 
          if(!isValidImamge(document.getElementById('ctl00_mainContent_lgimg'),"please enter large image in correct format."))
        { 
        return false;
        } 
        //Parent Category
        if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlparcategory')," parent category."))
        { 
        return false;
        }   
        //Category 
        if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlcategory')," category."))
        { 
        return false;
        }   
         //Featured 
         if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlfeatured')," featured option."))
        { 
        return false;
        }   
        //Saleitem 
        if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlSaleItem')," sale item."))
        { 
        return false;
        }   
        //SalePrice 
         if(!Blank_Prices(document.getElementById('ctl00_mainContent_txtSalePrice'),document.getElementById('ctl00_mainContent_ddlSaleItem'),"sale price."))
        { 
        return false;
        }   
        if(!isValidFloat_Prices(document.getElementById('ctl00_mainContent_txtSalePrice'),document.getElementById('ctl00_mainContent_ddlSaleItem'),"sale price."))
        { 
        alert("hello");
        return false;
        }   
        //SpecialItem 
         if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlSpItem'),"special item."))
        { 
        return false;
        }    
        //Specialprice
         if(!Blank_Prices(document.getElementById('ctl00_mainContent_txtSpPrice'),document.getElementById('ctl00_mainContent_ddlSpItem'),"special price."))
        { 
        return false;
        }   
        if(!isValidFloat_Prices(document.getElementById('ctl00_mainContent_txtSpPrice'),document.getElementById('ctl00_mainContent_ddlSpItem'),"special price."))
        { 
        return false;
        }   
        //SortOrder 
        if(!isValidNumber(document.getElementById('ctl00_mainContent_txtSortOrder'),"sort number."))
        { 
        return false;
        }     
}
//Validation used in form NewOptionGroup.aspx
function ValidateOptionGroup()
{
        //OptionName
        if(!Blank(document.getElementById('ctl00_mainContent_txtOptName'),"option name."))
        { 
        return false;
        }   
        if(!lengthRange(document.getElementById('ctl00_mainContent_txtOptName'),2,25,"please enter option name between 2 to 25 characters."))
        { 
        return false;
        }   
}
//Validation used in JoinMaillingList
function ValidateEmail()
{
        //Email
        
        if(!Blank(document.getElementById('ctl00_EmailSubscription_txtemaillist'),"email."))
        { 
        return false;
        }   
           if(!chkEmail(document.getElementById('ctl00_EmailSubscription_txtemaillist'),"please enter valid email address."))
        { 
        return false;
        }   
        if(!lengthRange(document.getElementById('ctl00_EmailSubscription_txtemaillist'),5,200,"please enter email between 2 to 200 characters."))
        { 
        return false;
        }   
        
        return true;
       
}
//Validation used in form NewOptionGroup.aspx
function ValidateOptions()
{
        //Group Name
        if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlGrpName')," group name."))
        { 
        return false;
        }   
        //Option Code
         if(!Blank(document.getElementById('ctl00_mainContent_txtOptCode'),"option code."))
        { 
        return false;
        }   
         if(!lengthRange(document.getElementById('ctl00_mainContent_txtOptCode'),2,25,"please enter option code between 2 to 50 characters."))
        { 
        return false;
        }   
        //Option Name
          if(!Blank(document.getElementById('ctl00_mainContent_txtOptName'),"option name."))
        { 
        return false;
        }   
//         if(!lengthRange(document.getElementById('ctl00_mainContent_txtOptName'),2,25,"please enter option name between 2 to 50 characters."))
//        { 
//        return false;
//        } 
        //price
         if(!Blank(document.getElementById('ctl00_mainContent_txtOptPrice'),"price."))
        { 
        return false;
        }    
          
         if(!isValidFloat(document.getElementById('ctl00_mainContent_txtOptPrice'),"price."))
        {
        return false;
        }
}

 


/* Functions Developed GS */

function validateDate(theField)
        {
            var input = document.getElementById(theField)
            var validformat=/^\d{1,2}\/\d{1,2}\/\d{4}$/ //Basic check for format validity
            var returnval=false
            if (!validformat.test(input.value))
                alert('Invalid Date Format. Please correct.')
            else{ //Detailed check for valid date ranges
            var monthfield=input.value.split("/")[0]
            var dayfield=input.value.split("/")[1]
            var yearfield=input.value.split("/")[2]
           
            var dayobj = new Date(yearfield, monthfield-1, dayfield)
            if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
            alert('Invalid Day, Month, or Year range detected. Please correct.')
            else
            {
                returnval=true
            }
            }
            if (returnval==false) input.focus()
            return returnval
        } 

        function ValidateEvent()
        {
             if(!Blank(document.getElementById('ctl00_mainContent_txtName')," Event Title."))
             { 
                return false;
             }   

             if(!Blank(document.getElementById('ctl00_mainContent_txtDescription')," Event Description."))
             { 
                return false;
             }   
             if(!Blank(document.getElementById('ctl00_mainContent_txtDetails')," Event Details."))
             { 
                return false;
             }   
             

            
                          
             if(!Blank(document.getElementById('ctl00_mainContent_txtCity')," Event City."))
             { 
                return false;
             }   
             if(!isValidURL(document.getElementById('ctl00_mainContent_txtUrl'),"Please enter valid Event Url."))
             { 
                return false;
             }  
             
             if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlStatus'),"Page Status."))
             { 
              return false;
             }  
             
             if(!Blank(document.getElementById('ctl00_mainContent_txtDate')," Event Date."))
             { 
                return false;
             }  
             else
             {
                //validateDate(document.getElementById('ctl00_mainContent_txtDate'));   
                var input = document.getElementById('ctl00_mainContent_txtDate')
                var validformat=/^\d{1,2}\/\d{1,2}\/\d{4}$/ //Basic check for format validity
                var returnval=false
                if (!validformat.test(input.value))
                    alert('Invalid Date Format. Please correct.')
                else{ //Detailed check for valid date ranges
                var monthfield=input.value.split("/")[0]
                var dayfield=input.value.split("/")[1]
                var yearfield=input.value.split("/")[2]
               
                var dayobj = new Date(yearfield, monthfield-1, dayfield)
                if ((dayobj.getMonth()+1!=monthfield)||(dayobj.getDate()!=dayfield)||(dayobj.getFullYear()!=yearfield))
                alert('Invalid Day, Month, or Year range detected. Please correct.')
                else
                {
                    returnval=true
                }
                }
                if (returnval==false) input.focus()
                return returnval
            
             }
            return true;
        }
        
        function BlankFCK(theField,s)
        {
            //window.frames["ctl00_mainContent_txtDetails___Frame"].document.body.innerHTML.length
            if(theField.innerHTML.length<=25068)
            {
                alert("Please enter " + s);
                theField.focus();
                return false;
            }
            else
                return true;
        }
        
        
        function ValidatePage()
        {
            
             if(!Blank(document.getElementById('ctl00_mainContent_txtName'),"Page Name."))
             { 
                return false;
             }  
             
             if(!Blank(document.getElementById('ctl00_mainContent_txtHeading'),"Page Heading."))
             { 
                return false;
             }  
             
             if(!Blank(document.getElementById('ctl00_mainContent_txtDescription'),"Page Description."))
             { 
                return false;
             } 
             
            // if(!BlankFCK(window.frames["ctl00_mainContent_txtDetails___Frame"].document.body,"Page Content."))
            // { 
            //    return false;
            // }  
             
             if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlStatus'),"Page Status."))
             { 
              return false;
             }  
        
            return true;
        
        }
        
        
/*----------------------------------------------------------------------------------------------*/        

/* Functions Developed GS  */
/*Functions Developed SS*/
 function ValidateNewsLetter()
        {
/*        if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddltype'),"Type."))
             { 
/              return false;
             }  */
             if(!Blank(document.getElementById('ctl00_mainContent_txtDate'),"Date."))
             { 
                return false;
             }  
             if(!checkdate(document.getElementById('ctl00_mainContent_txtDate')))
             {
                return false;
             }
             
             if(!Blank(document.getElementById('ctl00_mainContent_txtsubject'),"Subject."))
             { 
                return false;
             } 
             if(!Blank(document.getElementById('ctl00_mainContent_txtbody'),"Body."))
             { 
                return false;
             } 
            return true;
        }

/*----------------------------------------------------------------------------------------------*/        
/*function for Validating Rotating Image page */
 function ValidateRotatingImages()
 {
    if(!Blank(document.getElementById('ctl00_mainContent_txtImageName'),"Image Name."))
       { 
            return false;
       } 
       
    if(!Blank(document.getElementById('ctl00_mainContent_FileUploadImage'),"Image."))
       { 
            return false;
       } 
   
   return true;
 }


/*----------------------------------------------------------------------------------------------*/        



/*------------------------------------------------------------------------------------------------*/

//Validation used in form New Shipping
function ValidateShipping() 
{
    
     if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlShippingType'),"Shipping Type."))
       { 
           return false;
       } 

     if(!Blank(document.getElementById('ctl00_mainContent_txtShipCost'),"Shipping Cost."))
     {
         return false;
     }

    return true;
}

//Validation used in form Manage Design Product page
function ValidateManageDesignProduct()
{
    if(!Blank(document.getElementById('ctl00_mainContent_thumbimg'),"Thumbnail Image."))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_mainContent_lgimg'),"Large Image."))
    {
        return false;
    }

    return true;
}

    
 //<!-------------------------------Apparel AdminPassword Functions-------------------------------------->
 
  function AdminPassword_Validation()
  {
 
   if(!Blank(document.getElementById('ctl00_mainContent_txtUserId'),"User Name !"))
      {
        return false;
      }
   if(!Blank(document.getElementById('ctl00_mainContent_txtPassword'),"Password !")) 
      {
        return false;
      }
   }
   
      //<!-------------------------------Validation Customer Form --------------------------------------> 
  //<!------------Page name:- AddEditCustomer.aspx -----------> 
  function CustomerForm_Validation()
  {
   
     if(!Blank(document.getElementById('ctl00_mainContent_txtUserName'),"User Name!"))
     {
        return false;
     }
     
     if(!Blank(document.getElementById('ctl00_mainContent_txtPassword'),"Password!"))
     {
        return false;
     }
          
     if(!Blank(document.getElementById('ctl00_mainContent_txtConfirmPassword'),"Confirm Password!"))
     {
        return false;
     }
     
      if(!PasswordMismatch(document.getElementById('ctl00_mainContent_txtPassword'),document.getElementById('ctl00_mainContent_txtConfirmPassword')))
     {
        return false;
     }
     
     
     
     if(!chkEmail(document.getElementById('ctl00_mainContent_txtEmailID'),"Please Enter Valid Email!"))
     {
        return false;
     }
     
     if(!Blank(document.getElementById('ctl00_mainContent_txtFname'),"First Name!"))
     {
        return false;
     }
     
      if(!Name(document.getElementById('ctl00_mainContent_txtFname'),"First Name!"))
     {
        return false;
     }
     
     if(!Blank(document.getElementById('ctl00_mainContent_txtLName'),"Last Name!"))
     {
        return false;
     }
     
     if(!Name(document.getElementById('ctl00_mainContent_txtLName'),"Last Name!"))
     {
        return false;
     }
     
     if(!Blank(document.getElementById('ctl00_mainContent_txtAddressLine1'),"Address!"))
     {
        return false;
     }
     
      if(!Blank(document.getElementById('ctl00_mainContent_txtcity'),"City!"))
     {
        return false;
     }
     
     if(!Blank(document.getElementById('ctl00_mainContent_txtzip'),"Zip code!"))
     {
        return false;
     }
     
     if(!isValidNumber(document.getElementById('ctl00_mainContent_txtzip'),"Zip code!"))
     {
        return false;
     }
     
       if(!Blank(document.getElementById('ctl00_mainContent_txtPhoneNumber'),"Phone Number!"))
     {
        return false;
     }
     
      if(!PhoneNumber(document.getElementById('ctl00_mainContent_txtPhoneNumber'),"Phone Number!"))
     {
        return false;
     }
     
     
     return true;
  }
   

  //<!-------------------------------Validation Registration Form --------------------------------------> 
  //<!------------Page name:- Register.aspx -----------> 
  function RegistrationForm_Validation()
  {
   
     if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtUserName'),"User Name!"))
     {
        return false;
     }
    
     if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtUserName'),"User Name!"))  
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtPassword'),"Password!") )
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtConfirmPassword'),"Confirm Password!") )
    {
        return false;
    }
    
    if(!PasswordMismatch(document.getElementById('ctl00_ContentPlaceHolder1_txtPassword'),document.getElementById('ctl00_ContentPlaceHolder1_txtConfirmPassword')))
     {
        return false;
     }
    
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtEmailID'),"Email!") )
    {
        return false;
    }
    
    if(!chkEmail(document.getElementById('ctl00_ContentPlaceHolder1_txtEmailID'),"Enter valid Email!") )
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtFname'),"First Name!" ))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtFname'),"First Name!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtLName'),"Last Name!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtLName'),"Last Name!"))
    {
        return false;
    }
        if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtAddressLine1'),"Address Line1!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtcity'),"City!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtzip'),"Zip Code!"))
    {
        return false;
    }
    
    if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtzip'),"Zip Code !"))
    {
        return false;
    }
     if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtFirstname'),"First Name!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtFirstname'),"First Name!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtLastName'),"Last Name !"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtLastName'),"Last Name!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtAddLine1'),"Address line!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtshippingCity'),"City!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtshippingCity'),"City!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtShippingZip'),"Zip code!"))
    {
        return false;
    }
    
    if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtShippingZip'),"Zip code!"))
    {
        return false;
    }
    
     if(!PhoneNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtPhoneNumber'),"Phone Number!"))
     {
        return false;
     }
     
      if(!PhoneNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtPhoneNumber1'),"Phone Number!"))
     {
        return false;
     }
    
   
    return true;    
   }
   
    //<!-------------------------------Validation Payment Confirmation Form --------------------------------------> 
  //<!------------Page name:- Confirmation.aspx -----------> ctl00_ContentPlaceHolder1_txtCardno
   
    function PaymentConfirmation_Validation()
    {
 
       if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtCardno'),"Credit Card number!"))
      {
        return false;
      }
     if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtCardno'),"Valid Card Number!")) 
      {
        return false;
      }
      
           if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtCVV2code'),"CVV2 Card number!"))
      {
        return false;
      }
     if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtCVV2code'),"Valid Card Number!")) 
      {
        return false;
      }
      
      
      if(!SelectDropDown(document.getElementById('ctl00_ContentPlaceHolder1_ddlMonth'),"Month."))
        { 
          return false;
         }  
       if(!SelectDropDown(document.getElementById('ctl00_ContentPlaceHolder1_ddlyear'),"Year ."))
        { 
          return false;
         }   
         
        return true; 
      }
      
      
      
  //<!-------------------------------Validation Personal Profile Form --------------------------------------> 
  //<!------------Page name:- Personal_profile.aspx -----------> 
  function Personal_profile_Validation()
  {
   
     if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtUserName'),"User Name!"))
     {
        return false;
     }
    
     if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtUserName'),"User Name!"))  
    {
        return false;
    }
   
   
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtPassword'),"Password!") )
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtConfirmPassword'),"Confirm Password!") )
    {
        return false;
    }
    
    if(!PasswordMismatch(document.getElementById('ctl00_ContentPlaceHolder1_txtPassword'),document.getElementById('ctl00_ContentPlaceHolder1_txtConfirmPassword')))
     {
        return false;
     }
      
    
        
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtEmailID'),"Email!") )
    {
        return false;
    }
    
    if(!chkEmail(document.getElementById('ctl00_ContentPlaceHolder1_txtEmailID'),"Enter valid Email!") )
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtFname'),"First Name!" ))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtFname'),"First Name!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtLName'),"Last Name!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtLName'),"Last Name!"))
    {
        return false;
    }
        if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtAddressLine1'),"Address Line1 !"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtcity'),"City!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtzip'),"Zip Code!"))
    {
        return false;
    }
    
    if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtzip'),"Zip Code!"))
    {
        return false;
    }
     if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtFirstname'),"First Name !"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtFirstname'),"First Name!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtLastName'),"Last Name!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtLastName'),"Last Name!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtAddLine1'),"Address line!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtshippingCity'),"City!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtshippingCity'),"City!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtShippingZip'),"Zip code!"))
    {
        return false;
    }
    
    if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtShippingZip'),"Zip code !"))
    {
        return false;
    }
    
     if(!PhoneNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtPhoneNumber'),"Phone Number !"))
     {
        return false;
     }
     
      if(!PhoneNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtPhoneNumber1'),"Phone Number !"))
     {
        return false;
     }
    
   
    return true;    
   }
   
   
   
    //<!-------------------------------Validation Edit Personal  Profile Form --------------------------------------> 
  //<!------------Page name:- EditPersonal_profile.aspx -----------> 
  function EditPersonal_profile_Validation()
  {
   
     if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtUserName'),"User Name!"))
     {
        return false;
     }
    
     if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtUserName'),"User Name!"))  
    {
        return false;
    }
   
        
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtEmailID'),"Email!") )
    {
        return false;
    }
    
    if(!chkEmail(document.getElementById('ctl00_ContentPlaceHolder1_txtEmailID'),"Enter valid Email!") )
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtFname'),"First Name!" ))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtFname'),"First Name!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtLName'),"Last Name!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtLName'),"Last Name!"))
    {
        return false;
    }
        if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtAddressLine1'),"Address Line1!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtcity'),"City!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtzip'),"Zip Code!"))
    {
        return false;
    }
    
    if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtzip'),"Zip Code!"))
    {
        return false;
    }
     if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtFirstname'),"First Name!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtFirstname'),"First Name!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtLastName'),"Last Name!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtLastName'),"Last Name!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtAddLine1'),"Address line!"))
    {
        return false;
    }
    
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtshippingCity'),"City!"))
    {
        return false;
    }
    if(!Name(document.getElementById('ctl00_ContentPlaceHolder1_txtshippingCity'),"City!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtShippingZip'),"Zip code!"))
    {
        return false;
    }
    
    if(!isValidNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtShippingZip'),"Zip code!"))
    {
        return false;
    }
    
     if(!PhoneNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtPhoneNumber'),"Phone Number!"))
     {
        return false;
     }
     
      if(!PhoneNumber(document.getElementById('ctl00_ContentPlaceHolder1_txtPhoneNumber1'),"Phone Number!"))
     {
        return false;
     }
    
   
    return true;    
   }
   
//   -----------------------------------------------Manage Style Validation------------------------------------
   //Validation used in form New Style
function ValidateStyle()
{
      if(!Blank(document.getElementById('ctl00_mainContent_txtStyleCode'),"Style Code!"))
    {
        return false;
    }
   
     if(!Blank(document.getElementById('ctl00_mainContent_txtStyleName'),"Style Name!"))
    {
        return false;
    }
   
    if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlparcategory'),"Parent Category!"))
    { 
          return false;
    }
        
   if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlcategory'),"child Category!"))
    { 
          return false;
    } 

    return true;
}
   
//---------------------------------Manage Discount Validation -------------------------------------------
//Validation used in form :- AddEditDiscount
function ValidateDiscount()
{
      if(!Blank(document.getElementById('ctl00_mainContent_txtDiscountCode'),"Discount Code!"))
    {
        return false;
    }
   
     if(!Blank(document.getElementById('ctl00_mainContent_txtDisname'),"Discount Name!"))
    {
        return false;
    } 
   
     if(!SelectDropDown(document.getElementById('ctl00_mainContent_ddlMainCategory'),"Parent Category!"))
    { 
          return false;
    } 

        return true;
}
   
   
   //---------------------------------Manage Swatches Validation -------------------------------------------
//Validation used in form :- Newswatch
function ValidateSwatches()
{
      if(!Blank(document.getElementById('ctl00_mainContent_txtSwtchName'),"Swatch Name!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_mainContent_txtSwtchDesc'),"Description!"))
    {
        return false;
    }
    if(!Blank(document.getElementById('ctl00_mainContent_txtprice'),"Price!"))
    {
        return false;
    }
     if(!isValidNumber(document.getElementById('ctl00_mainContent_txtprice'),"Price!"))
    {
        return false;
    } 
    
    
    
 return true;
}   

//------------------------Manage sale tax validation
function ValidateTax()
{
    if(!Blank(document.getElementById('ctl00_mainContent_txtTax'),"Tax !"))
    {
        return false;
    }
    
    if(!isValidNumber(document.getElementById('ctl00_mainContent_txtTax'),"Tax!"))
    {
        return false;
    }

    return true;
}
//<!-------------------------------Apparel Login Functions-------------------------------------->
 
  function UserLogin_Validation()
  {
 
   if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtUserName'),"User Name !"))
      {
        return false;
      }
   if(!Blank(document.getElementById('ctl00_ContentPlaceHolder1_txtPassword'),"Password !")) 
      {
        return false;
      }
   }
   //---------------------------------------------------------------------------------//