
function confirmDeleteImages()
{
   var confirmDelete = confirm("Are you sure you want to delete images?");
   if(confirmDelete)
   {
      document.frmDeleteImages.action =  'processdeleteimages.php';
      document.frmDeleteImages.submit();
      return false;
   }
   else
   {
      return false;
   }
}

function validateForm(thisForm)
{        
  /*************************************** Declare variables *********************************************/	
  var emailRegEx =/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  var phoneRegEx=/^\(+\d{3}\)\s+\d{3}\-+\d{4}$/;
  var strEmail=thisForm.txtEmail.value;
  var strPhone1=thisForm.txtPhone1.value;
  var strPhone2=thisForm.txtPhone2.value;
  
  /*************************************** End of Declare variables ***************************************/
  
   /************************************* Checks first and last name ******************************/
         if(thisForm.txtFirstName.value =="")
        {
                alert("You must have a first name");
                thisForm.txtFirstName.focus();
                return false;
                
        }
        if(thisForm.txtLastName.value =="")
        {
                alert("You must have a last name");
                thisForm.txtLastName.focus();
                return false;                
        }
        
         /************************************* Begin check of email ***********************************/
        if(thisForm.txtEmail.value =="")
        {
                alert("You must have an Email address");
                thisForm.txtEmail.focus();
                return false;
                
        }
        if(!strEmail.match(emailRegEx))
        {
                alert("You must enter a valid Email address");
                thisForm.txtEmail.focus();
                return false;
        }
        
        
        if(thisForm.txtEmail.value != thisForm.txtConfirmEmail.value)
        {
                alert("The Emails don't match");
                thisForm.txtPassword.value="";
                thisForm.txtConfirmPassword.value="";
                thisForm.txtEmail.focus();
                return false;
        }
        
        /************************************ End of checks email ********************************/
        
        
         
         
        /**************************************** Checks phone ************************************/
        if(strPhone1 !="")
        {
                if(!strPhone1.match(phoneRegEx))
                {
                        alert("You must enter a valid phone number");
                        thisForm.txtPhone1.focus();
                        return false;
                }
        }
        if(strPhone2 !="")
        {
                if(!strPhone2.match(phoneRegEx))        
                {
                        alert("You must enter a valid phone number");
                        thisForm.txtPhone2.focus();
                        return false;
                }	        
                
        }	

        /*************************************** End of Checks phone *********************************/
        
        /************************************ Checks password ************************************/
        
        if(thisForm.txtPassword.value =="")
        {
                alert("You must have a password");
                thisForm.txtPassword.focus();
                return false;
                
        }
        if(thisForm.txtPassword.value != thisForm.txtConfirmPassword.value)
        {
                alert("The Passwords don't match");
                thisForm.txtPassword.value="";
                thisForm.txtConfirmPassword.value="";
                thisForm.txtPassword.focus();
                return false;
        }
        
        /************************************ End of check password ******************************/
 }       
         



function checkAllImages()
{  
  var check_status = document.getElementsByName('chkImage[]');  
  for (i=0; i<check_status.length; i++)
    {
         check_status[i].checked = true;
        
    }
}

function uncheckAllImages()
{  
  var check_status = document.getElementsByName('chkImage[]');  
    for (i=0; i<check_status.length; i++)
    {
         check_status[i].checked = false;
         
    }  
}


