	// Global constants for the error messages
	var Err_Name = "Your name can contain alphabets and spaces only." 
	var Err_FirstName = "First name can contain alphabets only." 
	var Err_MiddleName = "Middle name can contain alphabets only." 
	var Err_LastName = "Last name can contain alphabets only." 
	var Err_LoginName = "Login name can contain alphabets, digits and underscores only." 
	var Err_UserName = "User name can contain alphabets, digits and underscores only." 
	var Err_OldPassword = "Old Password can contain alphabets, digits and underscores only." 
	var Err_Password = "Password can contain alphabets, digits and underscores only." 
	var Err_ConfirmPassword = "Confirm Password can contain alphabets, digits and underscores only." 
	var Err_Description = "Invalid Description." 
	var Err_JobTitle = "Job Title can contain alphabets, digits, dots, commas and spaces only." 
	var Err_Street = "Invalid street address. Street address can not be empty." 

	var Err_PhoneNumber = "Telephone number has to be filled in." 
	var Err_MobileNumber = "Mobile number can contain digits, hiphens and spaces only." 
	var Err_Fax = "Fax number has to be filled in." 
	var Err_Address = "Address has to be filled in. Make sure it is not too long." 
	var Err_City = "Country has to be filled in." 
	var Err_Country = "Country has to be filled in." 
	var Err_State = "State has to be filled in." 
	var Err_PostCode = "Post Code can contain alphabets, digits, hiphens and spaces only." 
	var Err_ZipCode = "Zip Code can contain digits, hiphens and spaces only." 
	var Err_EstablishedIn = "Please specify an integer value for Established In field." 
	var Err_Email = "Valid Email address has to be filled in." 
	var Err_WebSite = "Invalid web site address." 	
	var Err_ShortDescription = "Invalid short description"
	var Err_LongDescription = "Invalid long description"
	var Err_SectionType = "Invalid Section Type."
	var Err_Subject = "Subject has to be filled in." 
	var Err_Comments = "Comments has to be filled in. It can have upto 500 characters." 

	// constants for kids section activity 
	var Err_Heading = "Please provide the correct format of heading."
	var Err_Content = "Please provide the correct format of content."
	
	
	// constants for Topic
	var Err_TopicTitle = "Title has to be filled in."
	var Err_TopicMessage = "Message has to be filled in."

	// constants for questionnaire module
	var Err_QuestionDescription	= "Question description can have upto 1000 characters." 

	// constants for answer module
	var Err_AnswerDescription	= "Answer description can have upto 1000 characters." 

	// constants for servey module
	var Err_UserAddress = "Address has to be filled in. It can have upto 255 characters." 

	// constants for faq module
	var Err_FaqShortDescription = "Faq short description has to be filled in." 
	var Err_FaqFullDescription = "Faq full description has to be filled in. It can have upto 500 characters." 
	var Err_FaqAnswer = "Faq answer has to be filled in. It can have upto 5000 characters." 

	// constants for faq category module
	var Err_FaqCategoryDescription = "Faq category description has to be filled in." 
	
	// constants for catalog module
	Err_CatalogName = "Catalog name has to be filled in." 
	
	// constants for catalog module
	Err_PageDescription = "Catalog page description has to be filled in." 
	Err_PageImage = "Catalog page image has to be filled in." 
	
	// Global constants for the validation petterns
	var vld_JobTitle  = /^[a-zA-Z0-9., ]*$/
	var vld_Name      = /^[a-zA-Z ]*$/
	var vld_CompanyName = /^[a-zA-Z0-9.& ]*$/
	var vld_OtherName = /^[a-zA-Z0-9. ]*$/
	var vld_FirstName = /^[a-zA-Z]*$/
	var vld_MiddleName = /^[a-zA-Z]*$/
	var vld_LastName = /^[a-zA-Z]*$/
	var vld_Description  = /^[\s\S]*$/
	var vld_City =  /^[\s\S]*$/
	var vld_State =  /^[\s\S]*$/
	var vld_Country =  /^[\s\S]*$/
	var vld_Address =  /^[a-zA-Z0-9#.\-\_\s ]*$/
	var vld_BookTitle =  /^[\s\S]*$/
	var vld_Title =  /^[\s\S]*$/
	var vld_Author =  /^[a-zA-Z ]*$/
	var vld_RealNumber =/^([0-9]*(\.[0-9]*)?)?$/
	var vld_Integer =/^[0-9]*$/
	var vld_URL =  /^[\d\D]*$/
	var vld_FilePath =  /^[a-zA-Z]:(\\[a-zA-Z0-9_]+)+$/
	var vld_LoginName =  /^[a-zA-Z0-9_]*$/
	var vld_Password =  /^[a-zA-Z0-9_]*$/
	var vld_ZipCode =  /^[\s\S]*$/
	var vld_Phone =  /^[\s\S]*$/
	var vld_Fax =  /^[\s\S]*$/
	var vld_MobileNumber = 	/^[\s\S]*$/
	var vld_Email =  /^(([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?))?$/
	var vld_WebSite =  /^[\s\S]*$/
	var vld_ShortDescription = /^[\s\S]*$/
	var vld_LongDescription = /^[\s\S]*$/

	var gstrErrMsg = ""
/*
-------------------------------------------------------------------------------------------------------------	
	Description	:	This functions validates a value against a validation pattern. If the pattern does not 
					matches the value it appends an error message to the error message string. This function 
					is to be used for form validation.
	Author		:	Ashu Attri
	Parameters 	:	
					pstrPtn -- validation pattern
					pstrVal -- value to be matched against the pattern 
					pstrMsg -- Constant for the error message 
					pstrErrMsg -- Error message string 
					pblnRqd	-- Required or not 						  
					pintMaxLen -- Maximum Length
-------------------------------------------------------------------------------------------------------------	
*/	
	function ValidateField(pstrPtn, pstrVal, pstrMsg, pstrErrMsg, pblnRqd, pintMaxLen)
	{
		var lblnVldFld = true 

		// check whether thr field is mandatory
		if ( pblnRqd == true && pstrVal == "" )
		{
			lblnVldFld = false
		}
		// maxlength check
		if( pintMaxLen > -1 && pstrVal.length > pintMaxLen)
		{
			lblnVldFld = false	 		
		}
		// validate value against pattern
		if( eval(pstrPtn).test(pstrVal) == false )
		{
			lblnVldFld = false
		}				
		// generate error message if invalid
		if ( lblnVldFld == false )
		{
			pstrErrMsg = pstrErrMsg + "-- " + pstrMsg + "\r"  
		}
		return pstrErrMsg;
	}	

// This function is to select/deselect check boxes
function checkAll(pobjFrm, pobjchkAll, pstrChkBox)
{
	var lintLopCnt
	for ( lintLopCnt = 0; lintLopCnt < pobjFrm.elements.length; lintLopCnt++)
	{
		if(pobjFrm.elements[lintLopCnt].type == "checkbox" && pobjFrm.elements[lintLopCnt].name == pstrChkBox)
		{
			pobjFrm.elements[lintLopCnt].checked = pobjchkAll.checked			
		}
	}
}

// This function checks whether a check box is selected before submitting the form 
function IsChecked(pobjFrm, pstrChkBox)
{
	var lintLopCnt
	var lblnchk
	lblnchk = false
	for ( lintLopCnt = 0; lintLopCnt < pobjFrm.elements.length; lintLopCnt++)
	{
		if(pobjFrm.elements[lintLopCnt].type == "checkbox" && pobjFrm.elements[lintLopCnt].name == pstrChkBox && pobjFrm.elements[lintLopCnt].checked == true )
		{
			lblnchk = true
		}
	}
	return lblnchk
}
	function cancel()
	{
		if(confirm("All changes will be lost. Do you want to continue?"))
		{
			history.back(-1);
		}
	}

