function isValidDate(DateStr)
 {
     var isAllInt = true;
     var DateArr = DateStr.split("/");

         for (i = 0; i< DateArr.length; i++)
         {  
	    if (isNaN(DateArr[i]))
            {  isAllInt = false;
               break;
            };
         }


         if (isAllInt)
         {  var Year_Int = parseInt(DateArr[2],10);
            var Month_Int = parseInt(DateArr[1],10);
            var Day_Int = parseInt(DateArr[0],10);


            if (Year_Int <= 0 || Month_Int <= 0 || Day_Int <= 0)
            {  return false;
            }
            else if (!(Month_Int >= 1 && Month_Int <= 12))
            {  return false;
            }
            else
            { 

	       var MonthDays = new Array(12);

               MonthDays[0] = 31;    // Days in january
               MonthDays[2] = 31;  // Days in March
               MonthDays[3] = 30;    // Days in April
               MonthDays[4] = 31;    // Days in May
               MonthDays[5] = 30;    // Days in June
               MonthDays[6] = 31;    // Days in July
               MonthDays[7] = 31;    // Days in August
               MonthDays[8] = 30;    // Days in September
               MonthDays[9] = 31;    // Days in October
               MonthDays[10] = 30;    // Days in November
               MonthDays[11] = 31;    // Days in December

               if (Year_Int%4 == 0)
               {  MonthDays[1] = 29;    // Days in February
               }
               else
               {  MonthDays[1] = 28;     // Days in February
               };

               if (!(Day_Int >= 1 && Day_Int <= MonthDays[Month_Int-1]))
               {  return false;
               };
            };   
     
         }
         else
         {  return(isAllInt);
         };

      return isAllInt;
   }

function DateComparison(fdate,tdate){
              
       FDate = new Date(fdate)
       TDate = new Date(tdate)
       
       yyyyFrom = FDate.getFullYear();
       yyyyTo	= TDate.getFullYear();
       
       mmFrom=FDate.getMonth();
       mmTo=TDate.getMonth();
       mmFrom+=1;
       mmTo+=1;
       
       ddFrom=FDate.getDate();
       ddTo=TDate.getDate();
      
       if (yyyyTo < yyyyFrom)
      {
              return(false);
      }
       else if(mmTo<mmFrom && yyyyTo==yyyyFrom)
      {                     
              return(false);
     }
       
       else if(ddTo<ddFrom && yyyyTo==yyyyFrom && mmTo==mmFrom)
       {
              return(false);
            }
    return(true);
}

function isBlank(Str)
{
  while(''+Str.charAt(0)==' ')
  Str=Str.substring(1,Str.length);

  while(''+Str.charAt(Str.length-1)==' ')
  Str=Str.substring(0,Str.length-1);
	     
  if (Str == '')
  { return(true);
  }
  else
  { return(false);
  };
}

function isValidEmailId(email)
{
  var isvalid = true;
			
  if (email.indexOf('@') == -1)
  { isvalid = false;
  }
  else
  { if (email.indexOf('@') == 0)
    { isvalid = false;
    }
    else if (email.indexOf('@') == (email.length-1))
    { isvalid = false;
    }
    else if (email.indexOf('@',(email.indexOf('@')+1)) != -1)
    { isvalid = false;
    };
  };

  return(isvalid);
}

function isNumber(number)
{
	if (isBlank(number)){return(false);}
	if (isNaN(number)){return(false);}
	else {return(true);}
}