//----The following function is to check whether the given string is Empty or Not ----

function isBlank(s)
    {
    var v,l;
    v=s
    l=s.length;
    if(l==0) return true;
    var flag=true;
    for(var i=0;i<l;i++)
		if(v.charAt(i)!=" ") flag=false;
    return flag;
    }
//----The following function is to check whether the given string is Proper Date or Not -----

function isNotDate(s)
    {
    if(isBlank(s))
    {   
    //return false;
	alert("Date should not be BLANK");
	return true;
    }
    var i,j;

    i=s;
    m=i.indexOf("/");           
    j=i.substring(0,m);             
    n=i.lastIndexOf("/");
    if ((m==-1) || (n==-1))
    {
    //return false;
	//alert("Enter Date in DD/MM/YYYY format");
	return true;
    }
    m=m+1;
    
    k=i.substring(m,n);
    n=n+1;
    l=i.substring(n,i.length);
    if ((isNaN(j)) || (isNaN(k)) || (isNaN(l)) || (k.indexOf("/") != -1))
        {
        //return false;
		//alert("Enter Date in DD/MM/YYYY format");
		return true;
        }
    if( (j<1) || (j>31) || (k<1) || (k>12) || (l<1900) || (l>2100))
        {       
        //return false;
		//alert("Enter Date in Correct format");
		return true;
        }
//  var numDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    if ((k==1) || (k==3) || (k==5) || (k==7) || (k==8) || (k==10) || (k==12))       
        {
        if(j>31) 
            {       
            //return false;       
			//alert("Enter Date in Correct format");
			return true;
            }
        }
    if ((k==4) || (k==6) || (k==9) || (k==11))      
        {
        
        if (j>30) 
            {           
            //return false;               
			//alert("Enter Date in Correct format");
			return true;
            }
        }
    if (k==2)
        {

        if((l%4 != 0) && (j>28))
            {
			//alert("It is not a Leap Year");
            //return false;
			return true;
            }

        else
        if ((l%4 == 0) && (j>29))
            {           
            //return false;
			return true;
            }
        }
    //return true;

	return false;
    }

//  ----The following function is to check whether the given string is proper E-Mail Id  or  Not-----
function isNotEmail(s)
{
    if(isBlank(s))
		return true;
	i=s;		
	n=i.indexOf("@");
	m=i.indexOf(".");
	if ((n==0) || (n == -1) || (m == -1) || (n+1 == m) || (n != i.lastIndexOf("@")) || (i.lastIndexOf(".")==s.length-1))				
		return true;
	else
	{
		s_c="`~!#$%^&*'()+|}{[]?><,:;/-";						
		for(k=0;k<i.length;k++)
			for(x=0; x<s_c.length; x++)
				if((i.substring(k,k+1) == s_c.substring(x,x+1)) || (s.substring(x,x+1)==" "))
					return true;
	}	
	return false;
}

//----The following function is to check whether given string is proper Zip code or Not----

function isNotZip(s)
	{
	if (isBlank(s))
		{
		//return false;
		alert("Postal/Zip code should not be BLANK ");
		return true;
		}
	if (s.length > 10) 
		{
		//return false;
		alert("Postal/Zip code should not exceed TEN Digits ");
		return true;
		}	
	
		if (isNaN(s))
			{
			//return false;
			alert("Postal/Zip code should be in NUMBERS only");
			return true;
			}	
	
//	return true;
	return false;
	}


//----The following function is to check whether the given string is Proper Phone No. or Not----
function isNotPhone(s)
	{
	if (isBlank(s))
		{
		//return false;
		//alert("Phone Number should not be BLANK");
		return true;
		
		}
	for (var i=0; i<s.length; i++)
		{
		k=s.substring(i,i+1);

		if(isNaN(k))
			{			
		
			if ((k != '+') && (k != ",") && (k != "-"))
				{				
				
				//return false;
				//alert("Please enter Phone number (in numbers or '+' or '-'  or  ',')");
				return true;
				}
			}
		}
	//return true;
	
	return false;
	}

function isNotURL(s)
	{
	
	if(isBlank(s))
		{
		alert("URL should not be Blank");
		return true;
		}
	var i,j,k;
	i=s.indexOf("://");		
	if (i == -1)
		{
		alert("Enter Correct URL");
		return true;
		}
	  var isnot;
	  isnot="`!@$^*(){}[]\|;',<>";
	for(j=0; j<s.length; j++)
		{
		for(k=0; k<isnot.length; k++)
			{
			if ((s.substring(j,j+1)) == (isnot.substring(k,k+1)))
				{
				alert("Special characters not allowed in URL");
				return true;
				}
			}
		}
	return false;
	}

function isNumber(s)
		{
		var i,j;		
		i=s.indexOf(".");
		j=s.lastIndexOf(".");
		alert(i);
		alert(j);
		if (i != j)
			return false;
		return true;
		}

/*
function dtFormat(s)
	{
	alert s;
	var i,j;
    i=s;
	alert i;
    m=i.indexOf("/");           
    j=i.substring(0,m); 

    n=i.lastIndexOf("/");
    m=m+1;    
    k=i.substring(m,n);

    n=n+1;
    l=i.substring(n,i.length);
	i = m & "/" & j & "/" & l;
	alert i;
    return i;
	}
*/
//----The following function is to check whether the given value is correct URL or not---- 

	
				


