
////Validating Special charecters

function validate(element)
{
		
		var s,i,c,nme,temp,valid,bnFlag;
		bnFlag=false;
 
		valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
		s=element.value;
		
		for(i = 0; i < s.length ; i++) 
		{
          		c = s.charAt(i);
				if (valid.indexOf(c) == -1) 
				{
                  	bnFlag=true;
					element.value="";
				    element.focus();
					break;
				}
			
		}
		return bnFlag;		
}

///Checking Numarics

function CheckNum(element)
{
  var s,i,c,nme;
  s = element.value;
  for (i = 0; i < s.length ; i++) {
    c = s.charAt(i);
    if (c < "0" || c > "9") {
      nme=element.name
	  if (nme.charAt(0)=="x") nme=nme.substring(1)
		element.focus();
	     return false;
	}
  }
  return true
}



///Checking Empty

function isEmpty(element)
	{
      var s,i,c;
	   s = element.value;
	for (i = 0; i < s.length; i++) {
		c = s.charAt(i);
		if(c==" ");
		else
			return false;
		}
      element.value="";
	//element.focus();
      return true
	}		


function email_check(a)
{
	
	if (a.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		{
			return true;
		}
	else	{
			return false;
		}
		
}


//Date checking

//Date Checking

function getYear(d) { 
   return (d < 1000) ? d + 1900 : d;
   }

 function isDate (strDate) {

   var year, month, day

  	year=strDate.substring(6,10);
	month=strDate.substring(3,5);
	day=strDate.substring(0,2);
	  
   month = month - 1;  
   var tempDate = new Date(year,month,day);
   if ( (getYear(tempDate.getYear()) == year) && (month == tempDate.getMonth()) && (day == tempDate.getDate()) )
       return true;
   else
      return false
   }