//Various Validations checks for forms


function checkStringExists(word)
{
	if(word.length == 0)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}


function checkInvalid(word)
{
	var invalid = "-=+[]{}\|;':,.<>/?\"";
	var i;
	for(i = 0; i < word.length ; i++)
	{
		if(invalid.indexOf(word.charAt(i),0) >= 0)
		{
			return 1;
		}
	}
	return 0;
}

function checkAlpha(word)
{
	var i;
	var currentChar;
	for(i = 0;i < word.length; i++)
	{
		currentChar = word.charAt(i);
		if(isNaN(currentChar) == false)
		{
			return 1;
		}
	}
	return 0;
}

function checkNumeric(word)
{
	var i;
	var currentChar;
	for(i = 0;i < word.length; i++)
	{
		currentChar = word.charAt(i);
		if(isNaN(currentChar) == true)
		{
			return 1;
		}
	}
	return 0;
}

function isFloat(val)
{
     var template = "x.ff";
     nval = val/1;
     if(isNaN(nval)) return false;
     // we are sure that we have a numeric value, let's see if we can find a . somewhere
     if((pos=val.indexOf("."))>0)
     {
          templatepos = template.indexOf(".");
          tmpf = template.length-templatepos-1;
          valf = val.length-pos-1;
          if(valf>tmpf) return false;
          else return true;
     }
     return true;
}

function roundDollars(cost)
{
	return Math.round(cost*100)/100;
}
