<!--

function trim(sOriginalStr){
  return ltrim(rtrim(sOriginalStr));
}
 
function ltrim(sOriginalStr){
  return sOriginalStr.replace(/^\s+/,'');
}
 
function rtrim(sOriginalStr){
  return sOriginalStr.replace(/\s+$/,'');
  }
  
  
// Check whether string s is empty.
function isEmpty(s)
{   
	return ((s == null) || (s.length == 0))
}


// Returns true if string s is empty or 
// whitespace characters only.
function isWhitespace (s)

{   var i;
	var whitespace = " \t\n\r";
    // Is s empty?
    if (isEmpty(s)) return true;

    // Search through string's characters one by one
    // until we find a non-whitespace character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }

    // All characters are whitespace.
    return true;
}

function ValidateBlank(objfield,StrFld)
{
	//Check whether the feild is blank.. If Yes then returns false..
	var datafield = objfield;

	if (trim(datafield.value) == "") 
	{
	    alert("Please Enter " +StrFld);
		datafield.select();
		datafield.focus();
		return false;
	}
	
	return true;
}



function isEmail(s)
{   
	//Check whether the email is in valid format..
	
	if (isEmpty(s)) 
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);
   
    // is s whitespace?
    if (isWhitespace(s)) return false;
    //Added by Asha on 20 Feb 2007
    //if special characters are present other than '@'and '.'in the email id then return false..
     var iChars = "!#$%^&;*()+=[]\\\';,/{}|\":<>?";
     for(i=0;i<s.length;i++)
		{
  			if (iChars.indexOf(s.charAt(i)) != -1) 
  			{
  				return false;
  			}
		}
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var ctr1 = 0;
    var ctr2 = 0;
    var sLength = s.length;

    // look for @
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    // look for .
    while ((i < sLength) && (s.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    
    //Check for multiple '@' and '.'
    for (i=0 ;i<sLength;i++)
				 {
				   if( s.charAt(i) == "@")
				     ctr1 ++;
				   if( s.charAt(i) == ".")
				     ctr2 ++;
				 }
				 if (ctr1>1 || ctr2>1) return false;
				 
    else return true;
}



function isValidMultipleEmail(obj) 
{					
	var email= obj.value.split(',');
	for (var i = 0; i < email.length; i++) {
		if (!isEmail(email[i],false)) 	
		{
			alert("Please Enter Valid e-mail's seperated by commas")
			obj.focus()
			return false
		}
	}
	return true;
} 

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}
function isNumeric(s,StrFld)
{
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var strvalue = trim(s.value);
	var Char;
	for (i = 0; i < strvalue.length && IsNumber == true; i++) 
		{ 
		Char = strvalue.charAt(i); 
		if (ValidChars.indexOf(Char) == -1) 
			{
				alert( StrFld + "has to be numeric");
				s.focus();
				return false;
			}
		}
	return true;
}

function isaNumber(s, StrFld)
{
				
//Check whether 's' is numeric..
				var m,j,trigger,j,a,x;
				trigger=1;
				m=s.value;
				a=m.length;
				var z;
				for(j=0; j<a; j++)
				{
					var x;
					x=m.charAt(j);
					if(isDigit(x))
						;
					else
					{
						alert( StrFld + "has to be numeric");
						trigger=0;
						break;
					}
					
				}
				if(trigger==0)
					return false;
				else
					return true; 
				
}

function isDate1(sDate) 
{
	var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/
	if (re.test(sDate)) 
	{
		var dArr = sDate.split("/");
		var d = new Date(sDate);
		return d.getMonth() + 1 == dArr[0] && d.getDate() == dArr[1] &&
		d.getFullYear() == dArr[2];
		return true; 
	}
	else 
	{
	alert("Please enter the valid date")
	return false;
	}
}


function isDate(dateStr) 
{

	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
	var matchArray = dateStr.match(datePat); // is the format ok?

	if (matchArray == null) {
		alert("Please enter date as mm/dd/yyyy format.");
		return false;
	}

	month = matchArray[1]; // parse date into variables
	day = matchArray[3];
	year = matchArray[5];

	if (month < 1 || month > 12) { // check month range
		alert("Month must be between 1 and 12.");
		return false;
	}

	if (day < 1 || day > 31) {
		alert("Day must be between 1 and 31.");
		return false;
	}

	if ((month==4 || month==6 || month==9 || month==11) && day==31) {
		alert("Month "+month+" doesn't have 31 days!")
		return false;
	}

	if (month == 2) { // check for february 29th
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day > 29 || (day==29 && !isleap)) {
			alert("February " + year + " doesn't have " + day + " days!");
			return false;
		}
	}
	return true; // date is valid
}


-->