
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
function ChangeOptionDays(WhichForm,WhichDay,WhichMonth,WhichYear)
{
  DaysObject = eval("document." + WhichForm + "." + WhichDay);
  MonthObject = eval("document." + WhichForm + "." + WhichMonth);
  YearObject = eval("document." + WhichForm + "." + WhichYear);
  Month = MonthObject[MonthObject.selectedIndex].text;
  Year = YearObject[YearObject.selectedIndex].text;

  DaysForThisSelection = DaysInMonth(Month, Year);
  CurrentDaysInSelection = DaysObject.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      NewOption = new Option(DaysObject.options.length + 1);
      DaysObject.add(NewOption);
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}


function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
  return DaysInMonth;
}

function SetToToday(WhichForm,WhichDay,WhichMonth,WhichYear)
{
  DaysObject = eval("document." + WhichForm + "." + WhichDay);
  MonthObject = eval("document." + WhichForm + "." + WhichMonth);
  YearObject = eval("document." + WhichForm + "." + WhichYear);

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(WhichForm,WhichDay,WhichMonth,WhichYear);

  DaysObject[NowDay-1].selected = true;
}


//function to write option years plus x
function WriteYearOptions(YearsAhead)
{
  line = "";
  for (i=0; i<YearsAhead; i++)
  {
    line += "<OPTION>";
    line += NowYear + i;
  }
  return line;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////THIS FILE CONTAINS VIRTUALLY ALL THE FUNCTIONS REQUIRED TO VALIDATE A WEB PAGE	//
////																						AUTHOR: Vijay Thakre				//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/****************************************************************************************	*/
/*			THIS FUNCTION REMOVES ALL THE LEADING & TRAILING SPACES													*/
/*			This function expects an argument as document.formName.fieldName.value									*/
/****************************************************************************************	*/	
function Trim(theString)
{	
	if (theString == null) 
	   return;
	var StartOfString = false	// A BOOLEAN VALUE TO REPRESENT IF THE FIRST(NON-SPACE) CHARACTER FOUND
	var Temp = ""			// HOLDS THE CONSECUTIVE SPACES 
	var TrimmedString = ""		// THE VARIABLE TO HOLD THE TRIMMED STRING
	
	for(i=0;i<theString.length;i++)
	{
		if(StartOfString)	//FIRST CHARACTER(NON-SPACE CHARACTER) FOUND
		{	
			if(theString.charAt(i) != " " )	//THE CHARACTER IS NOT SPACE
			{	//CONSTRUCT THE RESULTANT STRING BY ADDING THE CHARACTER ALONG 
				//	WITH Temp STRING (TEMP IS ALSO ADDED BECAUSE IT HOLDS 
				//	THE CONSECUTIVE SPACES & AS THERE IS A CHARACTER AFTER
				//	THE SPACES, THE SPACES WILL FORM THE PART OF THE STRING 
				//	& HENCE	SHOULD NOT BE REMOVED FROM THE RESULTANT STRING)
				TrimmedString = TrimmedString + Temp + theString.substring(i,i+1)
				Temp = ""	//REINITIALIZE Temp STRING AS SPACE
			}
			else			//SPACE FOUND WITHIN THE STRING
			{			//GO ON ADDING SPACES TO THE TEMPORARY STRING(Temp) 
				Temp = Temp + theString.substring(i,i+1)
			}			
		}
		else	// THE FIRST CHARACTER(NON-SPACE) IS NOT YET FOUND IN THE STRING
		{	
			if(theString.charAt(i) != " ")//CHARACTER AT i LOCATION IS NOT SPACE
			{
				TrimmedString = theString.substring(i,i+1)//ADD THAT CHARACTER
						// 	TO THE RESULT STRING AS FIRST CHARACTER
				StartOfString = true	//SET THIS BOOLEAN VARIABLE TO "true" 
							//INDICATING THAT THE FIRST CHARACTER 
							//IS FOUND
			}
		}
	
	}	
	return(TrimmedString)	//RETURN THE STRING WITH ALL LEADING & TRAILING SPACES REMOVED

}
/*********************************************************************************************/
/*			 		END FUNCTION					*/
/*********************************************************************************************/

/*********************************************************************************************/
/*			isEmpty() FUNCTION TESTS IF THE STRING IS EMPTY OR NOT		*/
/*********************************************************************************************/
function isEmpty(theString)
{
	for(i=0;i<theString.length;i++)
	{
	       if(theString.charAt(i) != " ") 
	       return( false)
	}
  return (true)
}	

/**********************************************************************************************/
/*		isName() FUNCTION CHECKS THE VALID NAME WITH A EMBEDED CHARACTER	      */
/**********************************************************************************************/
function isName(theString,EmbededCharacter)
{	          
	var chkString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" //ALL ALPHABETS
	var count = 0
	for(i=0;i<=theString.length;i++)
	{
		var theCharacter = theString.substring(i,i+1)		
		if(chkString.indexOf(theCharacter) == -1)
		{			
			if(EmbededCharacter.indexOf(theCharacter) != -1) 
			{	
				count = count + 1
			}
			else
			{
				return(false)
			}	
		}		
	}			
	if(theString.length == count)
	{
		return(false)
	}	
	return(true)
}


/**********************************************************************************************/
/*		isNumber() FUNCTION CHECKS THE VALID NUMBER WITH A EMBEDED CHARACTER	      */
/**********************************************************************************************/
function isNumber(theNumber,EmbededCharacter)
{	    	
	var count = 0
	var i;
	for(i=0;i<=theNumber.length;i++)
	{	//alert("count = " +1)
		var theCharacter = theNumber.substring(i,i+1)		
		if(isNaN(theCharacter))
		{
			if(EmbededCharacter.indexOf(theCharacter) != -1) 
			{	
				count = count + 1
			}
			else
			{
				return(false)
			}	
		}		
	}			
	if(theNumber.length == count)
	{
		return(false)
	}	
	return(true)
}

/***********************************************************************************************/
/*					END OF SUBROUTINE														*/
/***********************************************************************************************/


/***********************************************************************************************/
/*			THIS FUNCTION VALIDATES E-Mail BY ALL POSSIBLE MEANS			*/
/***********************************************************************************************/
function isEmail(theString)
{	var validCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
	theString = Trim(theString)
	if(theString.indexOf(" ") !=-1)
	{
		return(false)
	}
	if(validCharacters.indexOf(theString.charAt(0))==-1)
	{	
		return(false)
	}
	var FirstAtTheRate = theString.indexOf("@")	//STRORES FIRST OCCURANCE OF "@"
	var LastAtTheRate = theString.lastIndexOf("@")	//STORES LAST OCCURANCE OF "@"
	var FirstPeriod = theString.indexOf(".") 	//STORES FIRST OCCURANCE OF "."
	var LastPeriod = theString.lastIndexOf(".") 	//STORES LAST OCCURANCE OF "."
	//alert(FirstAtTheRate + ":" + LastAtTheRate + ":" + FirstPeriod + ":" + LastPeriod + ":" + theString.length)
	/* ****************** FOLLOWING IF BLOCK CHECKS IF THE FIRST OR LAST CHARACTER ***********
		IS "." OR "@" OR IF ANY OF THE TWO CHARACTERS ARE ABSENT. ALSO CHECKS FOR
		AT LEAST one "." AFTER "@", & AT LEAST A CHARACTER IN BETWEEN THEM **************/
	if(FirstAtTheRate <= 0 || FirstPeriod <= 0 || LastAtTheRate == theString.length-1 ||
			LastPeriod == theString.length-1 || FirstAtTheRate != LastAtTheRate
			|| (LastPeriod - LastAtTheRate)<=3)
	{	//alert("here")
		return(false)
	}
	var AtTheRate = theString.indexOf("@")
	
	if(validCharacters.indexOf(theString.charAt(AtTheRate -1)) == -1 ||
				validCharacters.indexOf(theString.charAt(AtTheRate +1)) == -1)
	{		
		return(false)
	}	
	return(true)
	/**************************************END BLOCK******************************************/
}

/***********************************************************************************************/
/*					END OF SUBROUTINE				       */
/***********************************************************************************************/

/***********************************************************************************************/
/*			THIS FUNCTION VALIDATES THE KEYSTROKE FOR WORDS ONLY		       */
/***********************************************************************************************/


function KeyValidationForAlphabets(event,theField)
{	//alert("here" + theField)
	if(navigator.appName == "Microsoft Internet Explorer")	//Check if the client browser is IE
	{		
	var key = event.keyCode 
	
		if(((key < 97 || key > 122) &&	(key < 65 || key > 90)) && (key!=37 && key!=39))//In IE, the "keyCode" property holds the Ascii value for the key 
		{
			ValidateForAlphabets(theField)			//Call the function to remove the Non-numeric characters
		}	
	}	
	if(navigator.appName =="Netscape")	//In IE, the "which" property holds the Ascii value for the key
	{
		var Key = event.which		
		
		if((Key < 97 || Key > 122) &&	(Key < 65 || Key > 90) && (Key!=0))		
		{	
			ValidateForAlphabets(theField)	//Call the function to remove the Non-numeric characters
		}
	}
				
	function ValidateForAlphabets(theField)
	{		
	var theAlphabets="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
	var b=""					//define a variable to hold the updated string
	
		for (i=0;i<theField.value.length;i++)
		{
		var a = theField.value.charAt(i)	//get a character in the string
		
		if(theAlphabets.indexOf(a)!=-1)		//Check if it is a alphabet
		{		
			b = b + a			//Yes! It is a Alphabet.So add it to the string
		}	
		}	
	theField.value = b				//All non numeric characters removed. Assign it to the field
	}	
	
}

/***********************************************************************************************/
/*					END OF SUBROUTINE																													*/
/***********************************************************************************************/

/***********************************************************************************************/
/*			THIS FUNCTION VALIDATES THE KEYSTROKE FOR NUMBERS ONLY		       */
/***********************************************************************************************/
function KeyValidationForNum(event,theField)
{
	if(navigator.appName == "Microsoft Internet Explorer")	//Check if the client browser is IE
	{
		if((event.keyCode < 48 || event.keyCode > 57) && (event.keyCode!=37 && event.keyCode!=39))	//In IE, the "keyCode" property holds the Ascii value for the key 
		{
			ValidateForNum(theField)									//Call the function to remove the Non-numeric characters
		}	
	}	
	if(navigator.appName =="Netscape")		//In NETSCAPE, the "which" property holds the Ascii value for the key
	{	
		if((event.which < 48 || event.which > 57) && (event.which!=0))
		{
			ValidateForNum(theField)									//Call the function to remove the Non-numeric characters
		}
	}			
	
	function ValidateForNum(theField)
	{	
	var b=""												//define a variable to hold the updated string
	for (i=0;i<theField.value.length;i++)
	{
		var a = theField.value.charAt(i)			//get a character in the string
		if(!isNaN(a))										//Check if it is a number	
		{		
			b = b + a										//Yes! It is a number.So add it to the string
		}	
	}	
	theField.value = b									//All non numeric characters removed. Assign it to the field
	}
}


/**********************************************************************************************/
/*					END OF SUBROUTINE																													*/
/**********************************************************************************************/

/**********************************************************************************************/
/*	THIS FUNCTION CHECKS IF THE DATE IS VALID OR NOT.FUNCTION ACCEPTS DATE ARGUMENT						*/
/* 	AS MM/DD/YYYY. IT ALSO ACCEPTS LOWER LIMIT & UPPER LIMIT FOR THE DATE IN THE SAME					*/
/*	FORMATE & VALIDATES FOR BOTH THE LIMITS.																							*/
/**********************************************************************************************/

/*function isDateValid(UserDate,AllowedPastDate,AllowedFutureDate)
{	
	if(AllowedPastDate == "")
	{
		AllowedPastDate = "1/1/1900"
	}
	if(AllowedFutureDate == "")
	{
		AllowedFutureDate = "12/31/3000"
	}
	UDate =UserDate.split("/")		//THIS WILL CREATE AN ARRAY SEPERATED BY "/"
	LowerDate = AllowedPastDate.split("/")
	UpperDate = AllowedFutureDate.split("/")
	if(isNaN(UDate[0]) || isNaN(LowerDate[0]) || isNaN(UpperDate[0])||
		isNaN(UDate[1]) || isNaN(LowerDate[1]) || isNaN(UpperDate[1])||
		isNaN(UDate[2]) || isNaN(LowerDate[2]) || isNaN(UpperDate[2]))
	{	
		return(false)
	}
	if(UDate[0] > 12 || LowerDate[0] > 12 || UpperDate[0] > 12)
	{	
		return(false)
	}else if(UDate[1] > 31 || LowerDate[1] > 31 || UpperDate[1] > 31)
		{	
			return(false)
		}else if((UDate[1] == 31 && (UDate[0]==2 ||UDate[0]==4 || UDate[0]==6 || UDate[0]==9 || UDate[0]==11))||
					(LowerDate[1] == 31 && (LowerDate[0]==2 || LowerDate[0]==4 || LowerDate[0]==6 || LowerDate[0]==9 || LowerDate[0]==11))||
				(UpperDate[1] == 31 && (UpperDate[0]==2 || UpperDate[0]==4 || UpperDate[0]==6 || UpperDate[0]==9 || UpperDate[0]==11)))
			{	
				return(false)
			}else if((UDate[1] == 29 &&(UDate[2]%4 != 0)) || (LowerDate[1] == 29 &&(LowerDate[2]%4 != 0)) || 
				(UpperDate[1] == 29 && (UpperDate[2]%4 != 0)))
				{	
					return(false)
				}
	
	
	// IF NO CONDITION IS SATISFIED FROM ABOVE TESTS , IT INDICATES THAT THE DATES ARE VALID
	
	//alert("Day = " + UDate[0] + "  Month = " + UDate[1]  + " Year= " + UDate[2]) 
	
	UserDate = new Date(UDate[2],UDate[0]-1,UDate[1])
	AllowedPastDate = new Date(LowerDate[2],LowerDate[0]-1,LowerDate[1])
	AllowedFutureDate = new Date(UpperDate[2],UpperDate[0]-1,UpperDate[1])
	
	//alert(UserDate + "\n" + AllowedPastDate + "\n" + AllowedFutureDate)
	if(UserDate.getYear() < AllowedPastDate.getYear())
	{	
		return(false)
	}
	else if(UserDate.getYear() == AllowedPastDate.getYear())
		{
			if(UserDate.getMonth() < AllowedPastDate.getMonth())
			{			
				return(false)	
			}	
			else if(UserDate.getMonth() == AllowedPastDate.getMonth())				
				{					
					if(UserDate.getDate() < AllowedPastDate.getDate())
					{				
						return(false)
					}	
				}	
	}
				
	if(UserDate.getYear() > AllowedFutureDate.getYear())
	{		
		return(false)
	}
	else if(UserDate.getYear() == AllowedFutureDate.getYear())
		{ 
			if(UserDate.getMonth() > AllowedFutureDate.getMonth())
			{				
				return(false)	
			}	
			else if(UserDate.getMonth() == AllowedFutureDate.getMonth())				
				{					
					if(UserDate.getDate() > AllowedFutureDate.getDate())
					{						
						return(false)
					}	
				}	
	}			
	return(true)
}*/

function isDateValid(UserDate)
{
	flag = 0	

	UDate =UserDate.split("/")		//THIS WILL CREATE AN ARRAY SEPERATED BY "/"
	if(isNaN(UDate[0]) || isNaN(UDate[1]) ||isNaN(UDate[2]))
	{	
		flag = 1
	}

	if(UDate[0] > 12 || UDate[1] > 31 || UDate[2] > 9999)
	{	
		flag = 1
	}

	if ((UDate[0] == 1 || UDate[0] == 3 || UDate[0] == 5 || UDate[0] == 7 || UDate[0] == 8 || UDate[0] == 10 || UDate[0] == 12) && (UDate[1] > 31))
	{	
		flag = 1
	}

	if ((UDate[0] == 4 || UDate[0] == 6 || UDate[0] == 9 || UDate[0] == 11) && (UDate[1] > 30))
	{	
		flag = 1
	}

	if ((UDate[0] == 2) && (UDate[2] % 4 != 0) && (UDate[1] > 28))
	{	
		flag = 1
	}

	if ((UDate[0] == 2) && (UDate[2] % 4 == 0) && (UDate[1] > 29))
	{	
		flag = 1
	}

	if (flag == 0)
	{
		return(true)
	}
	else
	{
		return(false)
	}
}

/***********************************************************************************************/
/*					END OF SUBROUTINE				       */
/***********************************************************************************************/

function formatString(theString)
{
	theString = Trim(theString)		//Remove all the leading & trailing spaces	
	var periodPosition
	var spaceFoundafterPeriod = false	//A BOOLEAN VALUE TO SPECIFY THAT A SPACE IS FOUND
						//		AFTER A "."
	var resultString = ""
	var theCharacter
	var theCharacterString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
		
	for(i=0;i<=theString.length;i++)
	{	
		theCharacter = theString.charAt(i)		
		if(i==0 || spaceFoundAfterPeriod)
		{	
			if(theCharacterString.indexOf(theCharacter) != -1)
			{					
				spaceFoundAfterPeriod = false
			}
			resultString = resultString + theCharacter.toUpperCase()					
		}
		else
		{
			resultString = resultString + theCharacter.toLowerCase()											
		}
		
		if(theCharacter == ".")
		{	
			periodPosition = i
		}
		if(theCharacter == " " && periodPosition == (i-1))
		{	//alert("here")
			spaceFoundAfterPeriod = true
		}			
	}
	return(resultString)
}


<!-- isPhoneNo - suplied by suzi -->

function isPhoneNo(str,e)
{
var strCheck = '0123456789-+()_ /';
var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true;  // Enter
key = String.fromCharCode(whichCode);  // Get key value from key code
if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
}

<!-- NumericOnly - suplied by suzi -->

function NumericOnly(fld,e,decimalplace)
{

// fld = the value of the text filed
// e = window.event - the inbuild object to handle event ( here onkeypress event )
// decimalplace = the required decimal place

var key = '';
var i = j = 0;
var len = 0;
var strCheck = '0123456789-';

if (decimalplace > 0)		// if decimal place passed is greater than 0 then include "." in the checked string
strCheck = strCheck+"."

var whichCode = (window.Event) ? e.which : e.keyCode;
if (whichCode == 13) return true;  // Enter
key = String.fromCharCode(whichCode);  // Get key value from key code
if (strCheck.indexOf(key) == -1) return false;  // Not a valid key
len = fld.value.length;

if (key =='-')  
{
   if (len > 0)
   {
      return false;  // because "-" is valid at the starting position only
   }
}
    
if (key =='.')
  {
    var count = 0 ;
	for(i = 0; i < len; i++)
	{
	 if ( fld.value.charAt(i) == '.')
	   {
	    count++
	    if ( count > 0)
	         return false;  // Second occurance is not valid
	   }
	}
  }
  
  // check decimal palce
  
  if (fld.value.indexOf(".") != -1)
  {
     var pos = fld.value.indexOf(".")
     var afterdecimalplace = fld.value.substr(pos)
     if (afterdecimalplace.length > decimalplace)
        return false;
  }

}

<!-- emailCheck - suplied by suzi -->
<!-- Begin 
function emailCheck (emailStr) {

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* 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);

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];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// 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.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

//  End -->
<!-- dont allow the follwing character   -- by suzy -->

function NotAllowTheChar(theString,NotAllowedCharacter)
{	
    for(i=0;i<=(NotAllowedCharacter.length -1);i++)
	{
		if (!(theString.indexOf(NotAllowedCharacter.charAt(i)) == -1))
		{
			alert("Sorry , the special character " + NotAllowedCharacter + " are not allowed !")
			return false;
		}
	}
    return true;	
}



