/*function emailCheck(s1) {
emailStr=s1;

var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)
if (matchArray==null) 
{
	alert("Email address seems incorrect (check @ and .'s)")
	return false;
}
return true;
}
*/
function emailCheck(s1) 
{
	if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(s1)))
	{
		alert("Please enter a valid e-mail address");
		return false;
	}
	else
		return true;
}
function isblank(s)
{
	for(var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		
		if((c != ' ') && (c != '\n') && (c != '\t'))
			return false;
	}
	return true;
}
function checkSpace(s)
{
	for(var i=0; i < s.length; i++)
	{
		var c = s.charAt(i);
		
		if((c == ' ') || (c == '\n') || (c == '\t'))
			return false;
	}
	return true;
}

function str_replace(needle, newNeedle, haystack)
{
  maxLoop = haystack.length;
  newNeedleLength = newNeedle.length;
  needleLength = needle.length;

  x = 0;

  proceed = true

  while (proceed)
  {
    //if this is the needle we're looking for...
    if (haystack.substring(x, (x + needleLength)) == needle)
    {
      //get the substring before this character (watch out for the first character)
      if (x == 0)
      {
        preString = '';
      }
      else
      {
        preString = haystack.substring(0, x);
      }

      //get the substring after this character (watch out for the last character
      if (x == (haystack.length - needleLength))
      {
        postString = '';
      }
      else
      {
        postString = haystack.substring(x + needleLength);
      }

      //build new haystack
      haystack = preString + newNeedle + postString;

      x = x + newNeedleLength;

      //if the newNeedle is 0 characters long, the haystack is shorter, so run the search for charAt(x) again
      if (newNeedleLength == 0)
      {
        if (x != 0)
        {
          x = x - 1;
        }
      }
    }

    //Move along
    x = x + 1;

    //if we're shortened the haystack so that the new length is less than the original, and we're at the end of the new, then break.
    if (haystack.length < x)
    {
      proceed = false;
    }
    else
    {
      proceed = true;
    }

  }

  //return the new haystack
  return haystack;
}
function trim(sString)
{
  trimString = lTrim(rTrim(sString));
  return trimString;
}
function rTrim(sString)
{
  while (sString.substring(sString.length-1, sString.length) == ' ')
  {
    sString = sString.substring(0,sString.length-1);
  }
  return sString;
}
function lTrim(sString)
{
  while (sString.substring(0,1) == ' ')
  {
    sString = sString.substring(1, sString.length);
  }
  return sString;
}
function smsg(msgStr) { //v1.0
  status=msgStr;
  document.prs_return = true;
}
function nosmsg(msgStr) { //v1.0
  status=msgStr;
  document.prs_return = true;
}