/* selection of dropdown
function checkDropdown(choice) {
    var error = "";
    if (choice == 0) {
       error = "You didn't choose an option
         from the drop-down list.\n";
    }    
return error;
}    
*/
/* For Left Trim */
function Ltrim(Str)
{
	for (i = 0; i < (Str.length); i++)
	{ 
		if (Str.charAt(i) != ' ')
			return Str.substring(i)
		else
			Str.substring(i)
	}
	return ""
}

/* For Checking Null */
function CheckNull(strchecknull)
{ 
	if(Rtrim(Ltrim(strchecknull)) == "")
	{
		return false;
	}
	else 
	{ 
		return true;
	}
}

/* For Right Trim */
function Rtrim(Str)
{
	for (i = Str.length; i != 0; i--)
	{ 
		if (Str.charAt(i) != ' ')
			return Str.substring(0,i)
		else
			Str.substring(0,i)
	}
	return ""
}  


function OnlyCharAllowed(str)
{
// accepts only characters
	if(str.search(/[^a-zA-Z_ ]/g)>-1)
		return false
	else
		return true
}

function OnlyNumAllowed(str)
{
// accepts only numerals
	if(str.search(/[^0-9]/g)>-1)
		return false
	else
		return true
}

//only number and number with decimal point
function OnlyNumDecAllowed(str)
{
// accepts only numerals
	if(str.search(/[^0-9.]/g)>-1)
		return false
	else
		return true
}

//accepts only numerals and characters 
function OnlyNumCharAllowed(str)
{
	if(str.search(/[^0-9a-zA-Z_ ]/g)>-1)
		return false
	else
		return true
}

function ChkLength(Str,intMinLength, intMaxLength)
{
	if((Str.length >= intMinLength )&& (Str.length <= intMaxLength))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function ChkLength(Str, intMaxLength)
{
	if( Str.length <= intMaxLength)
	{
		return true;
	}
	else
	{
		return false;
	}
}

//Changes by Ravi 14-07-06 Validate Search Criteria.
function OnlyNumCharWithSomeSplChar(str)
{
	var iChars = "%^*\',|\"<>";
	
	if(str.length == 0 )
	{
		return true;
	}
	else
	{
	for (var index = 0; index < str.length; index++) 
	{
		if(iChars.indexOf(str.charAt(index)) != -1)
		{
			return false;
		}
	}
	return true;
	}
}

function resetForm()
{
document.forms(0).reset();
}
function submitForm()
{
document.forms(0).submit();
}
	
function Left(str, n)
{
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}


/* For Comma Finding */
function CommaExists(Str)
{
	for (i = 0; i < (Str.length); i++)
	{ 
		if (Str.charAt(i) == ',')
			return true;
	}
	return false;
}
/* Email ID validation*/


function echeck(str) 
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1)
		{
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
}









