function isSpecial(str)
{
	var j=0;
	specialCharList = new Array("!","@","#","%","&","'","{","}");
	for(j=0;j<=(specialCharList.length)-1;j++)
	{
		if(str.search(specialCharList[j])!= -1)
		{
			alert(specialCharList[j] + " Found");
			return true;
		}
	}
	return false ; // special char does'nt exist
}

function isAlpha(str)
{
	var j=0;
	for (j=0;j<=str.length-1;j++)
	{
		chr = str.substring(j,j+1);
		if (!((chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') ||
			(chr == ' ') || (chr=='\'') || (chr=='.')))
			return false;
	}
	return true;
}

function isEmail(str)
{
	var j=0;
	if((str.search('@') == -1) || (str.indexOf('.') == -1))
	{
		return false;
	}
	else
	{
		if (getCountOfOccurance(str,'@')>1 || (isMiddle(str,'@')==false) || (isMiddle(str,'.')==false))
			return false;
	}
	for (j=0;j<=str.length-1;j++)
	{
		chr = str.substring(j,j+1);
		if (!((chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') ||
		(chr=='.') || (chr=='@') || (chr=='_') || (chr=='-') || (chr>='0' && chr <= '9')))
			return false;
	}
	return true;
}

function isNumeric(str)
{
	if (!isNaN(str))
	{
		return true;
	}
	return false;
}

function getCountOfOccurance(str,chr)
{
	var j=0;
	var count = 0;
	for (j=0;j<=str.length;j++)
	{
		if(str.charAt(j)==chr)
		{
			count++;
		}
	}
return count;
}

function isMiddle(str,chr)
{
	if(str.indexOf(chr)<1 || str.indexOf(chr)>str.length-2)
		return false;
	else
		return true;
}

function isAge(str)
{
	if(isNumeric(str))
	{
		if (str>0 && str<=100)
			return true;
	}
	return false;
}

function selectObject(obj)
{
	obj.select();
	obj.focus();
}

function isFloat(str)
{
	if (isNumeric(str))
	{
		if(getCountOfOccurance(str,'.')>0)
		{
			return true;
		}
	}
	return false;
}

function isInteger(str)
{
	if (isNumeric(str) && !(isFloat(str)))
		return true;
	return false;
}


function isNumberFloat(str)
{ 
	if (isNumeric(str) && (isFloat(str))){
		return true;
	}
	return false;
}
function isLessThan(str,min)
{
	if (isNumeric(str) && isNumeric(min))
	{
		if (parseFloat(str) < parseFloat(min)) return true;
	}
	return false;
}

function isId(str)
{
	if (isNumeric(str.substring(0,1)) || !(isAlphaNumeric(str)))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function isAlphaNumeric(str)
{
	var j=0;
	for (j=0;j<=str.length-1;j++)
	{
		chr = str.substring(j,j+1);
		if (!((chr >= 'a' && chr <= 'z') || (chr >= 'A' && chr <= 'Z') || (chr >= '0' && chr <= '9') ))
			return false;
	}
	return true;
}

function isOnlySpace(str)
{
	var j=0;
	for (j=0;j<=str.length-1;j++)
	{
		chr = str.substring(j,j+1);
		if (chr!=' ')
			return false;
	}
	return true;
}


function isItPassword(str){
	if (str == '') {alert("Password field can't be blank"); return false;} 
	if (isOnlySpace(str)) { alert("Password Should be only alphaNumeric"); return false;} 
	if(isSpecial(str)) { alert("Password Should be only alphaNumeric"); return false;} 
	if(str.length > 12) { alert("Password can be of Maximum 12 Charachers"); return false;}
return true;
}

function isFilled(str){
	if (str == '') { return false;}
//	if (isOnlySpace(str)) {  return false;}
//	if (isSpecial(str)) {  return false;}
//	if (!(isAlpha(str))) { return false;}
return true;
}

function isFilledG(str){
	if (str == '') { return false;}
	if (isOnlySpace(str)) {  return false;}
	if (isSpecial(str)) {  return false;}
return true;
}

function isFilledA(str){
	if (str == '') { return false;}
	if (isOnlySpace(str)) {  return false;}
	if (isSpecial(str)) {  return false;}
	if(str.length > 12) { alert("Agent can be of Maximum 12 Charachers"); return false;}
return true;
}