// JavaScript Document
function validate_email(field)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
		{
		    field.style.background = "#f6b76d";
			  return "Please enter a valid email\n";
		}
		else
		{
		    field.style.background = "#FFFFFF";
			return "";
		}
	}
}
function validate_required(field,alerttxt)
{
	var str
	with (field)
	{
	  if (value!=null) //if not null, check for string length, etc...
	  {
	  	  str = trim(value);
		  if(str=="")
		  {
			field.style.background = "#f6b76d";
			return alerttxt;
		  }
		  else
		  {
			field.style.background = "#FFFFFF";
			return "";
		  }
	   }
	  else //is null
	  {
			field.style.background = "#f6b76d";
			return alerttxt;
	  }	   
	}
}
function trim(data)
{
	var trimmed = data.replace(/^\s+|\s+$/g, '') ;
	return trimmed;
}
function changecolor(field)
{

	with (field)
	{
	  if (value!=null) //if not null, check for string length, etc...
	  {
	  	  str = trim(value);
		  if(str=="")
		  {
			field.style.background = "#f6b76d";
			return "";
		  }
		  else
		  {
			field.style.background = "#FFFFFF";
			return "";
		  }
	   }
	  else //is null
	  {
			field.style.background = "#f6b76d";
			return "";
	  }
	}
}