// JavaScript Document
function checkEmail(email) {
//var email = document.getElementById(email);
var filter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/ ;
if (!filter.test(email.value)) {
alert('Please provide a valid email address');
email.focus();
}
}
 
 function hiderow(donate) {
 	 if(donate==1) {
     document.getElementById('cost').style.visibility="hidden";
	 document.getElementById('dona').value="1";
     }
else {
     document.getElementById('cost').style.visibility="visible";
	 document.getElementById('dona').value="0";
     }
 }
 
function popitup(url) {
 	newwindow=window.open(url,'name','height=130,width=200,top=300 location=no,left=400,minimize=no,resizable=no,scrollbars=yes');
	 }


function openNewWindow(url) {
 	newwindow=window.open(url,'name','height=500,width=650,top=100location=no,left=400,,resizable=yes,scrollbars=yes');
	 }

function displayRow(rowid){	
//alert (rowid.value)
//alert(rowid)
var row = document.getElementById(rowid);
if (row.style.display == '')  row.style.display = 'none';
else row.style.display = '';}

function hideRow(rowid){	

var row = document.getElementById(rowid);
  row.style.display = 'none';
 }
function set(obj,mess) { 
  alert(mess);
 // obj.select();
//  obj.focus();
}
function chkdate(inpdate)

{



idate=inpdate.value;

if ( empty(stripSpaces(idate))) 

  {

   return true;

  }

if (idate.length > 10  )

  {

    alert("date cannot exceed more than 10 characters and should be in format dd-mm-yyyy") ;

	inpdate.focus();

	return false;

  }



 var dsh1 = idate.substring(3,2);

//alert (dsh1);

var dsh2 = idate.substring(6,5);

//alert (dsh2);

if (dsh1 != "-" ) 

   {

     alert ("Enter date in dd-mm-yyyy format >>> there is no '-' after day ");

     inpdate.focus();

     return false;

   }

if (dsh2 != "-" ) 

   {

   alert ("Enter date in dd-mm-yyyy format >>> there is no '-' after month  ");

   inpdate.focus();

   return false;

   }

   var yr=idate.substring(6,10);

   var mm=idate.substring(3,5);

   var dd=idate.substring(0,2);

//alert(yr+' Year');

//alert(mm+' Month');

//alert(dd+' Day');

if (isNaN(dd)) 

   {

     alert ("Day of month  should be numeric ");

     inpdate.focus();

     return false;

   }

if (isNaN(mm)) 

    {

     alert ("Month should be numeric ");

	 inpdate.focus();

     return false;

    }

if (isNaN(yr)) 

   {

    alert ("Year should be numeric ");

    inpdate.focus();

     return false;

   }

 

if (dd < 1) 

    { 

      alert ("Day of month cannot be less than 1 ");

	  inpdate.focus();

      return false;

     }

if (dd > 31 ) 

   {

    alert ("Day cannot be Greater than 31  ");

    inpdate.focus();

    return false;

   }

 

if (mm > 12 || mm < 1 ) {

  alert ("Month should be between 1 and 12  ");

  inpdate.focus();

  return false;

  }

if (mm == 6 || mm == 9 || mm==11 ) {

   if (dd > 30 ) { 

   alert ("There are 30 days in June, September and November  !!  please correct day ");

    inpdate.focus();

   return false;     

   } 

} 

 if (mm==2) 

     { 

	   

       var b=parseInt(yr /4); 

       if (isNaN(b)) {

	     alert( "Check no.of days in February NOT valid");

		  inpdate.focus();

     	 return false ; 

	    }

        if (dd>29)  {

	     alert("Check no.of days in February NOT valid days in February cannot exceed 29");

	     inpdate.focus();

		 return false ; 

	    }    

        if (dd==29 && ((yr/4)!=parseInt(yr/4))) {

	     alert( "Check no.of days !! This is NOt leap year  ");

	     return false  ; 

        } 

	 }

	 return true ;

}

function empty(x) { if (x.length > 0) return false; else return true; }

function stripSpaces(x) {

    while (x.substring(0,1) == ' ')
        x = x.substring(1);
        return x;
}


 


<!--
function checknumeric(mobile)
{ 
var sText=mobile.value;
 
 
   var ValidChars = "0123456789.-";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
		 alert("Please enter numberical value only"); 
		 mobile.focus()
         }
      }
 
   return IsNumber;
 
}  
function checkPhoto(image) {
	   var imagePath=image.value
 
   var pathLength = imagePath.length;
   var lastDot = imagePath.lastIndexOf(".");
   var fileType = imagePath.substring(lastDot,pathLength);

   if((fileType == ".gif") || (fileType == ".jpg") || (fileType == ".png") || (fileType == ".GIF") || (fileType == ".JPG") || (fileType == ".PNG" ) || (imagePath=="")) {
       return true;
   } else {
       alert("We supports .JPG, .PNG, and .GIF image formats. Your file-type is " + fileType + ". This precaution is needed so as to display the image on your web site");
	   image.focus()
   }
}
function checkattach(image) {
   var imagePath=image.value
 
   var pathLength = imagePath.length;
   var lastDot = imagePath.lastIndexOf(".");
   var fileType = imagePath.substring(lastDot,pathLength);

   if((fileType == ".pdf") || (fileType == ".doc") || (fileType == ".jpg") ||  (imagePath=="")) {
       return true;
   } else {
       alert("We supports .JPG, .PDF, and .DOC image formats. Your file-type is " + fileType + ". This precaution is needed so as to display the image on your web site");
	   image.focus()
   }
}

function checkcsv(image) {
   var imagePath=image.value
 
   var pathLength = imagePath.length;
   var lastDot = imagePath.lastIndexOf(".");
   var fileType = imagePath.substring(lastDot,pathLength);

   if((fileType == ".csv") ||  (imagePath=="")) {
       return true;
   } else {
       alert("We supports only csv  formats. Your file-type is " + fileType + ". This precaution is neede to uolad  web site database");
	   image.focus()
   }
}

