﻿function chkPupDetails()
{
/*------------------Validate First Name-----------------*/
   if (document.aspnetForm.ctl00_content1_txtname.value=="")
   {
     alert("Enter the Name.");
     document.aspnetForm.ctl00_content1_txtname.focus();
     return false;
   } 
   if (document.aspnetForm.ctl00_content1_txtname.value!="")
         {   
             var alphaExp = /^[a-zA-Z&.', ]+$/;
	         if(document.aspnetForm.ctl00_content1_txtname.value.match(alphaExp))
	         {
        		
	         }
	         else
	         {
		        alert("Enter only letters for  Name.");
		        document.aspnetForm.ctl00_content1_txtname.focus();
		        return false;
	         } 
	     }     
/*------------------Validate home-----------------*/
   if (document.aspnetForm.ctl00_content1_txthome.value=="")
   {
     alert("Enter the Home(Location).");
     document.aspnetForm.ctl00_content1_txthome.focus();
     return false;
   } 
    if (document.aspnetForm.ctl00_content1_txthome.value!="")
         {   
             var alphaExp = /^[a-zA-Z.,'& ]+$/;
	         if(document.aspnetForm.ctl00_content1_txthome.value.match(alphaExp))
	         {
        		
	         }
	         else
	         {
		        alert("Enter only letters for  Home(Location).");
		        document.aspnetForm.ctl00_content1_txthome.focus();
		        return false;
	         } 
	     }     
   /*------------------Validate Age-----------------*/
   if (document.aspnetForm.ctl00_content1_txtage.value=="")
   {
     alert("Enter the Age.");
     document.aspnetForm.ctl00_content1_txtage.focus();
     return false;
   } 
   if (document.aspnetForm.ctl00_content1_txtage.value==0)
   {   
        alert("Enter valid value for Age.");
        document.aspnetForm.ctl00_content1_txtage.focus();
        return false;
   }
   if (isNaN(document.aspnetForm.ctl00_content1_txtage.value))
      {
        alert("Enter only number for Age.");
        document.aspnetForm.ctl00_content1_txtage.focus();
        return false;
      } 
    var str=document.aspnetForm.ctl00_content1_txtage.value;
      var str1=document.aspnetForm.ctl00_content1_txtage.value.length;
      var iChars = "*|\":<>[]{}`\';()@&$#%.+-,";
      for (var i = 0; i < str1; i++) 
      {
        if (iChars.indexOf(str.charAt(i)) != -1)
        {
          alert("Please enter a proper value for the Age."); 
          document.aspnetForm.ctl00_content1_txtage.focus();
          return false;
        }
        }
         /*------------------Validate Age-----------------*/
      if (document.aspnetForm.ctl00_content1_ddlage.value=="-Select-")
    {
     alert("Select Month or Year.");
     document.aspnetForm.ctl00_content1_ddlage.focus();
     return false;
   } 
    /*------------------Validate Gender-----------------*/
    if (document.aspnetForm.ctl00_content1_txtgender.value=="")
   {
     alert("Enter the Gender.");
     document.aspnetForm.ctl00_content1_txtgender.focus();
     return false;
   } 
   if (document.aspnetForm.ctl00_content1_txtgender.value!="")
         {   
             var alphaExp = /^[a-zA-Z ]+$/;
	         if(document.aspnetForm.ctl00_content1_txtgender.value.match(alphaExp))
	         {
        		
	         }
	         else
	         {
		        alert("Enter only letters for  Gender.");
		        document.aspnetForm.ctl00_content1_txtgender.focus();
		        return false;
	         } 
	     }     
       /*------------------Validate Breed-----------------*/
    if (document.aspnetForm.ctl00_content1_txtbreed.value=="")
   {
     alert("Enter the Breed.");
     document.aspnetForm.ctl00_content1_txtbreed.focus();
     return false;
   } 
   if (document.aspnetForm.ctl00_content1_txtbreed.value!="")
         {   
             var alphaExp = /^[a-zA-Z&,.' ]+$/;
	         if(document.aspnetForm.ctl00_content1_txtbreed.value.match(alphaExp))
	         {
        		
	         }
	         else
	         {
		        alert("Enter only letters for  Breed.");
		        document.aspnetForm.ctl00_content1_txtbreed.focus();
		        return false;
	         } 
	     }        
        /*------------------Validate Breed-----------------*/
    if (document.aspnetForm.ctl00_content1_DateTextFrom.value=="")
   {
     alert("Enter the Birthday Date.");
     document.aspnetForm.ctl00_content1_DateTextFrom.focus();
     return false;
   } 
      
        /*------------------Validate Love Text-----------------*/
    if (document.aspnetForm.ctl00_content1_txtlove.value=="")
   {
     alert("Enter the 'I Love' Text.");
     document.aspnetForm.ctl00_content1_txtlove.focus();
     return false;
   }
//   if (document.aspnetForm.ctl00_content1_txtlove.value!="")
//         {   
//             var alphaExp = /^[a-zA-Z ]+$/;
//	         if(document.aspnetForm.ctl00_content1_txtlove.value.match(alphaExp))
//	         {
//        		
//	         }
//	         else
//	         {
//		        alert("Enter only letters for  'I Love' text.");
//		        document.aspnetForm.ctl00_content1_txtlove.focus();
//		        return false;
//	         } 
//	     }       
       /*------------------Validate Hate Text-----------------*/
    if (document.aspnetForm.ctl00_content1_txthate.value=="")
   {
     alert("Enter the 'I Hate' Text.");
     document.aspnetForm.ctl00_content1_txthate.focus();
     return false;
   } 
//    if (document.aspnetForm.ctl00_content1_txthate.value!="")
//         {   
//             var alphaExp = /^[a-zA-Z ]+$/;
//	         if(document.aspnetForm.ctl00_content1_txthate.value.match(alphaExp))
//	         {
//        		
//	         }
//	         else
//	         {
//		        alert("Enter only letters for  'I Hate' text.");
//		        document.aspnetForm.ctl00_content1_txthate.focus();
//		        return false;
//	         } 
//	     }       
        /*------------------Validate Place-----------------*/
    if (document.aspnetForm.ctl00_content1_txtplace.value=="")
   {
     alert("Enter Favourite Sleeping Spot.");
     document.aspnetForm.ctl00_content1_txtplace.focus();
     return false;
   }  
//   if (document.aspnetForm.ctl00_content1_txtplace.value!="")
//         {   
//             var alphaExp = /^[a-zA-Z' ]+$/;
//	         if(document.aspnetForm.ctl00_content1_txtplace.value.match(alphaExp))
//	         {
//        		
//	         }
//	         else
//	         {
//		        alert("Enter only letters for  Favourite sleeping Spot.");
//		        document.aspnetForm.ctl00_content1_txtplace.focus();
//		        return false;
//	         } 
//	     }       
      /*------------------ Validate Food -----------------*/
    if (document.aspnetForm.ctl00_content1_txtfood.value=="")
   {
     alert("Enter Favourite Food.");
     document.aspnetForm.ctl00_content1_txtfood.focus();
     return false;
   }  
//    if (document.aspnetForm.ctl00_content1_txtfood.value!="")
//         {   
//             var alphaExp = /^[a-zA-Z ]+$/;
//	         if(document.aspnetForm.ctl00_content1_txtfood.value.match(alphaExp))
//	         {
//        		
//	         }
//	         else
//	         {
//		        alert("Enter only letters for  Favourite Food.");
//		        document.aspnetForm.ctl00_content1_txtfood.focus();
//		        return false;
//	         } 
//	     }    
      /*------------------Validate Toy-----------------*/
    if (document.aspnetForm.ctl00_content1_txttoys.value=="")
   {
     alert("Enter Favourite Toy.");
     document.aspnetForm.ctl00_content1_txttoys.focus();
     return false;
   }  
//    if (document.aspnetForm.ctl00_content1_txttoys.value!="")
//         {   
//             var alphaExp = /^[a-zA-Z ]+$/;
//	         if(document.aspnetForm.ctl00_content1_txttoys.value.match(alphaExp))
//	         {
//        		
//	         }
//	         else
//	         {
//		        alert("Enter only letters for  Favourite Toys.");
//		        document.aspnetForm.ctl00_content1_txttoys.focus();
//		        return false;
//	         } 
//	     }    
      /*------------------Validate Like Text-----------------*/
    if (document.aspnetForm.ctl00_content1_txtlike.value=="")
   {
     alert("Enter Favourite Trick.");
     document.aspnetForm.ctl00_content1_txtlike.focus();
     return false;
   } 
//    if (document.aspnetForm.ctl00_content1_txtlike.value!="")
//         {   
//             var alphaExp = /^[a-zA-Z ]+$/;
//	         if(document.aspnetForm.ctl00_content1_txtlike.value.match(alphaExp))
//	         {
//        		
//	         }
//	         else
//	         {
//		        alert("Enter only letters for  Favourite Trick.");
//		        document.aspnetForm.ctl00_content1_txtlike.focus();
//		        return false;
//	         } 
//	     }     
       /*------------------Validate  Text-----------------*/
   if (document.aspnetForm.ctl00_content1_txtmet.value=="")
   {
     alert("Enter 'How i met my Furever Family' Text.");
     document.aspnetForm.ctl00_content1_txtmet.focus();
     return false;
   }
//    if (document.aspnetForm.ctl00_content1_txtmet.value!="")
//         {   
//             var alphaExp = /^[a-zA-Z ]+$/;
//	         if(document.aspnetForm.ctl00_content1_txtmet.value.match(alphaExp))
//	         {
//        		
//	         }
//	         else
//	         {
//		        alert("Enter only letters for  'How i met my Furever Family' Text.");
//		        document.aspnetForm.ctl00_content1_txtmet.focus();
//		        return false;
//	         } 
//	     }     
     /*------------------Validate Image1---------------*/
     if (document.aspnetForm.ctl00_content1_hdval.value=="edit")
	   {
	   }
	   else
	   {
           if (document.aspnetForm.ctl00_content1_FileUpload1.value=="" )
           {
             alert("Upload  Picture.");
             document.aspnetForm.ctl00_content1_FileUpload1.focus();
             return false;
           }  
       }
}

function chkSearchOption()
{
 if (document.aspnetForm.ctl00_txtname.value=="" &&  document.aspnetForm.ctl00_ddlbreed.value=="-Select-" && document.aspnetForm.ctl00_txtlocation.value=="")
           {
             alert("Enter atleast one option");
             document.aspnetForm.ctl00_txtname.focus();
             return false;
           }  
}

function chkSearchOption1()
{
var blnflag=0;

 arr=document.getElementsByName("ctl00$content1$rdsearch");
  var l = arr.length;
 
  for (var i=0; i<arr.length; i++)
 {
if (arr[i].type=="radio" && arr[i].checked)
{
blnflag = 1;
}
}
if (blnflag==1)
{
}
else
{
alert("Select atleast one option ");
return false;
}
if (arr[1].checked)
{
 if (document.aspnetForm.ctl00_content1_txtname.value=="" &&  document.aspnetForm.ctl00_content1_ddlbreed.value=="-Select-" && document.aspnetForm.ctl00_content1_txtlocation.value=="")
           {
             alert("Enter atleast one option");
             document.aspnetForm.ctl00_content1_txtname.focus();
             return false;
           }  
           }
}


function confirmMsg(frm,msg,msg1)
{

  // loop through all elements
  for (i = 0; i < frm.length; i++)
  {
    // Look for our checkboxes only
    if (frm.elements[i].name.indexOf("checkRec") !=  - 1)
    {
      // If any are checked then confirm alert, otherwise nothing happens
      if (frm.elements[i].checked)
      return confirm(msg)
    }    
  }
  alert(msg1);
 return false;
}