function blank_check( entry, msg )																	//For text boxes
{
    if( entry.search( /\S/ ) == -1 )
	{
	alert( msg );
	return false;
    }
return true;
}

function chosen_check( entry, msg )																//For drop down select boxes Nairit keeps valoe="0" for the first option(default)
{
    if( entry == "0" )
	{
	alert( msg );
	return false;
    }
return true;
}

function number_check( entry, msg )																//WON'T ALLOW ANY SPACE. HOWEVER IT ALLOWS BLANK BOX
{
	if( !isFinite(entry) )
	{
	alert(msg);
	return false;
	}
return true;
}

function email_check( entry, msg )																	//THIS ONE WON'T ALLOW BLANK EMAIL ADDRESS
{
	if( (/^[a-zA-Z0-9-._]+(@[a-zA-Z0-9]{1,}[a-zA-Z0-9_.-]+\.)+[a-zA-Z]{2,4}$/).exec(entry) == null )
	{
	alert(msg);
	return false;
    }
return true;
}

function email_check2( entry, msg )																//THIS ONE ALLOWS BLANK EMAIL ADDRESS
{
	if( entry != "" )
	{
		if( (/^[a-zA-Z0-9-._]+(@[a-zA-Z0-9]{1,}[a-zA-Z0-9_.-]+\.)+[a-zA-Z]{2,4}$/).exec(entry) == null )
		{
		alert(msg);
		return false;
    	}
	}
return true;
}

function site_check( entry, msg )																	//ALLOWS BLANK WEB-SITE
{
	if( entry != "" )
	{
		if( (/^([a-zA-Z0-9_.-:\/]{1,}[a-zA-Z0-9_.-]+\.)+[a-zA-Z]{2,4}$/).exec(entry) == null )
		{
		alert(msg);
		return false;
    	}
	}
return true;
}

function length_check( entry_leng, msg )
{
    if( entry_leng < 5 )
    {
    alert( msg );
    return false;
    }
return true;
}

function same_check( pass1, pass2, msg )
{
    if( pass1 != pass2 )
    {
    alert( msg );
    return false;
    }
return true;
}

function chr_check( entry, msg )
{
    if( entry.search(/[^a-zA-Z0-9_~!@#$%^&*-=+|:<>?.,]/) > -1 )								//Nothing is allowed outside this set of characters. The first ^ probably stands for not(like !)
    {
    alert( msg );
    return false;
    }
return true;
}

function quote_check( entry, msg )
{ 
    if( entry.search('"') > -1 )																				//Double quote creates problems
    {
    alert( msg );
    return false;
    }
return true;
}

function isDate(da, mth, yr, msg1, msg2, msg3, msg4, msg5)
{
	if( (da==0) || (mth==0) || (yr==0) )
	{alert(msg1);return false}												//Please choose date of birth

	if( (mth==4) || (mth==6) || (mth==9) || (mth==11) )			// 30 days has SEPTEMBER, APRIL, JUNE and NOVEMBER
	{
		if( da > 30 )
		{alert(msg2);return false}											//The date is absurd
	}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If year is divisible by 4, then FEBRUARY has 1 day more ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	if( mth == 2 )
	{
		if( da > 29 )
		{alert(msg3);return false}											//The date does not exist ! Observe that the month is February !

		else if( (yr%100) == 0 )												//Millenium years, though divisible by 4 are not leap years. But 1600, 2000, 2400 are normal leap years
		{
			if( (yr%400) != 0 )
			{
				if( da > 28 )
				{alert(msg4);return false}									//The date does not exist ! 1700, 1800, 1900, 2100 millenium years are not leap-years in spite of being divisible by 4.  But 1600, 2000, 2400 millenium years are normal leap years. Honestly, didn't you know ?
			}
		}

		else if( (yr%4) != 0 )
		{
			if( da > 28 )															//Non-leap years have only 28 days
			{alert(msg5);return false}										//The date does not exist ! The year chosen is not a leap-year. How can it have more than 28 days ?
		}
	}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
return true
}

function cmp_dates( start_date, end_date, msg )				//Recieving the dates with same name
{
    if( (end_date - start_date) < 0 )
    {
		alert( msg );
		return false;
    }
    return true;
}