

 
/*
	File Name	: common.js 
	File Date	: Febraury 28, 2008.
	Prepared By	: Mukesh Kumar
	
*/
/*
	
	function js_func_disableDiv(div, disabled)
	function js_func_clearDiv(div)
*/
/*


	(1) Added function js_func_checkTxaMaxLength(objTxa, maxLength, fieldName)


	(1) Added Function js_func_DiffOfDatesInDays(objFormDate,objToDate) return no of days
				This Function Returns Difference of dates in Days
	(2) Added Function js_func_MaxValueAllowed(objCntl,MaxAllowedValue,field_name)
				This Function checks weither the value in object is less then the Max value or not
				CAUTION : The value in the Control is numeric or not should be 
						  checked First then Call this Function
	(3)Added function js_func_RoundDecimal(objCtrl1,rlength)
				Function to round off the value in ammount to n decimals as specified in rlength
				Function to be at (onBlur)
*/
/*


	(1) Added function js_func_DateDiff(Date1, Date2)
	* Modified By Mukesh Kumar on 1st April 2008
	(1) DateFormat function has been modified
	
*/
/*


js_func_checktextboxempty(objname,field_name)
	-To check for mandatory fields (in case of text box)

js_func_checkcomboempty(objname,field_name)		-To check for mandatory fields (in case of combo box)


js_func_Winpopup(url)		-To open window popup


js_func_SetFocus		-To set the focus to the first element in the form


js_func_checkemail(objname)		-To validate email


js_func_checkmaxlength(objname,maxlength,field_name)		-To check for maxlength of a field (text box and text area)



js_func_checkzipcode(zipobjname1,zipobjname2)		-To check for zip codes. It should be either 5 or 9 digits


js_func_makeupper(objname)		-To convert user entered data into upper case-(onblur)

js_func_tabNext(obj,event,len,next_field)			-This is used for cursor to move automatically from one textbox to another like in case of SSN,FEIN and ZIP.
onKeyDown="js_func_tabNext(this,'down',5)" onKeyUp="js_func_tabNext(this,'up',5,this.form.tf_EMPL_ZIP_CDE2)"

js_func_checkssn(ssnobjname1,ssnobjname2,ssnobjname3)		-This is used for validating ssn

js_func_checkfein(feinobjname1,feinobjname2)		-This is used for validating FEIN.


js_func_clearAll(form)		-This is for clearing all the fields in the form

js_func_LimitText(fieldObj,maxChars)		-This is for not allowing user to type more than specified number of characters

js_func_checknumeric(objname,field_name)		-This is for checking whether the field is numeric or not

js_func_checkname(obj,field_name)		-This is for validating names


js_func_checkcitycounty(obj,field_name)		-This is for validating city and county fields. As of now this is same as alphanumeric validations

js_func_Alphanumeric(obj,field_name)		-This is for validating alpha numeric entry

js_func_Alphanumeric_v2(obj,field_name)     --This is for validating alpha numeric entry without popup message

js_func_OnlyNum			-This function will allow user to key in only numeric values. Traps the keys pressed.(onkeypress)
js_func_AllNumbers		-This function will allow user to key in only numeric values. THIS WILL NOT ALLOW DECIMAL
js_func_OnlyChar		-This function will allow user to key in only alphabets. Traps the keys pressed.(onkeypress)

js_func_checkdecimal(objname,field_name,max)		-This is for validating decimal values

js_func_doDateCheck(from,to,from_field_name,to_field_name)		-This is for validating two dates specifically Start Date, End Date

js_func_dateValid(objname)		-This is for validating whether the date is entered properly in MM/DD/YYYY format-(onblur)

js_func_chkyear(objname)			-This is basically for checking year field to validate that it should be greater than 1900 and should not allow year greater than system year

js_func_chkMonthYearCombination(objmonth,objyear)		-This function is for checking whether the month & year combination is less then present date or not.

js_func_GetSysdate		-This returns the system date

js_func_checktelnoextn(Telobjname1,Telobjname2,Telobjname3,Telobjname4)		-This validation is for telephone number with extension

js_func_checktelno(Telobjname1,Telobjname2,Telobjname3)		-This validation is for telephone number with out extension

js_func_trim(str)			-To trim the leading and trailing spaces


js_func_GetCtrl(vForm, objName)- This function returns the required object. The parameter will be

js_func_GetAsciiValue(objval) -  This function returns the sum of asciivalue of charecter
window.document.frmNew, "txtage"


function js_func_checkboxCheck(checkboxId,fieldName) - This function is used to check if more than one check box is selected then give error message.

function js_func_noCheckboxCheckAllowed(checkboxId,fieldName -	This function is used to check if more than one check box is selected then give error message and allows none of the checkbox selection.

function js_func_compareyear(objStartYr,objEndYr)-to validate year so that end year shld be greater than start year.

js_func_checkTxaMaxLength - check max length of textarea on keypress, and prevent user from keying in further

function js_func_DiffOfDatesInDays(objFormDate,objToDate) - This is the function thich Calculate the difference in Days for 2 dates and 
														Return the Difference in days -- to be used at Form level 


function js_func_checkclaimnumber(objname) - This is used for validating Claim Number format.

function ResizeCurrentWindow() - This is used for resizing current window.

function MaximizeCurrentWindow() - This is used for maximizing current window.

function ClosePopUpWindow()  - This is used for closing the pop up image window.

js_func_checkfaxno(Faxobjname1,Faxobjname2,Faxobjname3)		-This validation is for Fax number 

js_func_AllowMultipleCheckboxCheck(checkboxId,fieldName) - This function is used to check multiple check box.

OpenImageView(url, windowName) - This function is called from "View" link of context. This opens the Image in Maximum window size.

function js_func_ViewImage(url, windowName, height, width, left, top)  - This function is used to open the image. 

function js_func_ViewImage_All_Params(url, windowName, height, width, left, top, toolbar, location, directories, status, menubar, scrollbars, resizable, copyhistory) 
- This function is used to open the image. 
	
DefaultValuesSet() - Need to set some default vale on body load

function js_func_DocumentsCheckedOut() - Alerts the user to check-in any checked-out documents before Finalize.

function js_func_DocumentsSaveMode() - Alerts the user to check-in any checked-out documents before Finalize.

//Added by Mukesh K on 29 May 2008
function select_all() - checks or uncheckes all the checkboxes in a grid

function js_func_SetBackColor(obj,colour) - to Change the colour of background of control

function ToDisableLink() - change the href to # (Only specific for pages. in this case works fine for Product information.)
 
function ToEnableLink() - to enable the href with original one . we explicitly set its valus (Only specific to page. product information.)                        

function js_func_BulkEmtyCheckTextBox()- used to check the text box empty value in bulk. just pass array of textbox.

function js_func_BulkCheckedRadio() - used to check the radio buttons is checked for yes and no for same question.

function js_func_checkmaxlengthWithArray() - used to check the length of textbox, It takes the textbox as an array and check it. 
*/

<!-- 

var field_length=0;
var CONST_STATE_GEORGIA = "";
///SApna kansay 6/14/07
//-----------------Added a global ID----
var Element_ID;
//var newwindow ;


/* Added By Sachin A. in order to Format date in MM/DD/YYYY format*/
		//<!-- Begin
		// Check browser version
		var isNav4 = false, isNav5 = false, isIE4 = false
		var strSeperator = "/"; 
		// If you are using any Java validation on the back side you will want to use the / because 
		// Java date validations do not recognize the dash as a valid date separator.
		var vDateType = 3; // Global value for type of date format
		//                1 = mm/dd/yyyy
		//                2 = yyyy/dd/mm  (Unable to do date check at this time)
		//                3 = dd/mm/yyyy
		var vYearType = 4; //Set to 2 or 4 for number of digits in the year for Netscape
		var vYearLength = 2; // Set to 4 if you want to force the user to enter 4 digits for the year before validating.
		var err = 0; // Set the error code to a default of zero
		if(navigator.appName == "Netscape") {
		if (navigator.appVersion < "5") {
		isNav4 = true;
		isNav5 = false;
		}
		else
		if (navigator.appVersion > "4") {
		isNav4 = false;
		isNav5 = true;
		}
		}
		else {
		isIE4 = true;
		}
		
		function js_func_tabNextCtrl(obj,event,len,next_field)
		{
		if (event == "up") {
			field_length=obj.value.length;
			if (field_length == len) {
				next_field.focus();
		}		
		}
		}
		
		//Commented By Mukesh on 31 Aug 2007 as we have applied the new function which is provided by Pradip Kumar.
		//Which works for IE,Mozilla,NetScape
		/*function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) {
		systDate = js_func_GetSysdate();
		
		/*if (vDateName.id=="tbDateOfInjury" || vDateName.id=="tbDOI" && dateCheck) {
		var mySysDate;
		mySysDate=js_func_GetSysdate();
	
		date01 = new Date();
		date02 = new Date();
		diff01  = new Date();
		var totdays;
		totdays = 0;
			 
		date1temp1 = new Date(vDateName.value);
		date01.setTime(date1temp1.getTime());
		
		date2temp1 = new Date(mySysDate);
		date02.setTime(date2temp1.getTime());
	
		diff01.setTime(date02.getTime() - date01.getTime());
		
		timediff1 = diff01.getTime();	

		totdays = Math.floor(timediff1 / (1000 * 60 * 60 * 24)); 
		
		if (totdays > 3660){
		confirm("Please Confirm Date Of Injury ");
		}	
		if(js_func_DateDiff(systDate,vDateName.value) == -1)
			{	
			alert("Please Enter Date Of Injury less than the Current Date");
			vDateName.value="";
			vDateName.focus();
				return false;   
			}
		
		}*/

		/*if (vDateValue=="1111111111" && dateCheck) {
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
		}
		if (vDateValue=="1111111111" && dateCheck==false){
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
		}
		
		if (!( vDateValue=="")&& dateCheck==false )
		{	
		{
		with (document.forms[0]) 
		{
		for (var i = 0; i < elements.length-1; i++) 
		{
		if (elements[i].type == "text" && elements[i]== vDateName )
			 {
			 //var ctrlname=elements[i+1]
			//js_func_tabNextCtrl(vDateName,'up',10,ctrlname);
			j=i;
			i=i+1;	
			
			if(!(elements[i].type=="text" || elements[i].type=="select-one" ||elements[i].type=="radio"||elements[i].type=="password"|| elements[i].type=="checkbox"||elements[i].type=="textarea")|| j==elements.length || elements[i].disabled){
			 elements[i-1].focus();
			}
			else{
			var ctrlname=elements[i]
			js_func_tabNextCtrl(vDateName,'up',10,ctrlname);
			}
		}
		}
		}
		}	
		}
						
		vDateType = dateType;
		// vDateName = object name
		// vDateValue = value in the field being checked
		// e = event
		// dateCheck 
		// True  = Verify that the vDateValue is a valid date
		// False = Format values being entered into vDateValue only
		// vDateType
		// 1 = mm/dd/yyyy
		// 2 = yyyy/mm/dd
		// 3 = dd/mm/yyyy
		//Enter a tilde sign for the first number and you can check the variable information.
		if (vDateValue == "~") {
		alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator);
		vDateName.value = "";
		vDateName.focus();
		return true;
		}
		var whichCode = (window.Event) ? e.which : e.keyCode;
		// Check to see if a seperator is already present.
		// bypass the date if a seperator is present and the length greater than 8
		if (vDateValue.length > 8 && isNav4) {
		if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1))
		return true;
		}
		//Eliminate all the ASCII codes that are not valid
		var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";
		if (alphaCheck.indexOf(vDateValue) >= 1) {
		if (isNav4) {
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
		}
		else {
		vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
		return false;
		}
		}
		if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
		return false;
		else {
		//Create numeric string values for 0123456789/
		//The codes provided include both keyboard and keypad values
		var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
		if (strCheck.indexOf(whichCode) != -1) {
		if (isNav4) {
		if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) {
		alert("Invalid Date\nPlease Re-Enter");
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
		}
		if (vDateValue.length == 6 && dateCheck) {
		var mDay = vDateName.value.substr(2,2);
		var mMonth = vDateName.value.substr(0,2);
		var mYear = vDateName.value.substr(4,4)
		//Turn a two digit year into a 4 digit year
		if (mYear.length == 2 && vYearType == 4) {
		var mToday = new Date();
		//If the year is greater than 30 years from now use 19, otherwise use 20
		var checkYear = mToday.getFullYear() + 30; 
		var mCheckYear = '20' + mYear;
		if (mCheckYear >= checkYear)
		mYear = '19' + mYear;
		else
		mYear = '20' + mYear;
		}
		var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
		if (!dateValid(vDateValueCheck)) {
		alert("Invalid Date\nPlease Re-Enter");
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
		}
		return true;
		}
		else {
		// Reformat the date for validation and set date type to a 1
		if (vDateValue.length >= 8  && dateCheck) {
		if (vDateType == 1) // mmddyyyy
		{
		var mDay = vDateName.value.substr(2,2);
		var mMonth = vDateName.value.substr(0,2);
		var mYear = vDateName.value.substr(4,4)
		vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
		}
		if (vDateType == 2) // yyyymmdd
		{
		var mYear = vDateName.value.substr(0,4)
		var mMonth = vDateName.value.substr(4,2);
		var mDay = vDateName.value.substr(6,2);
		vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay;
		}
		if (vDateType == 3) // ddmmyyyy
		{
		var mMonth = vDateName.value.substr(2,2);
		var mDay = vDateName.value.substr(0,2);
		var mYear = vDateName.value.substr(4,4)
		vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
		}
		//Create a temporary variable for storing the DateType and change
		//the DateType to a 1 for validation.
		var vDateTypeTemp = vDateType;
		vDateType = 1;
		var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
		if (!dateValid(vDateValueCheck)) {
		alert("Invalid Date\nPlease Re-Enter");
		vDateType = vDateTypeTemp;
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
		}
		vDateType = vDateTypeTemp;
		return true;
		}
		else {
		if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
		alert("Invalid Date\nPlease Re-Enter");
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
				}
			}
		}
		}
		else {
		// Non isNav Check
		if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) {
		alert("Invalid Date\nPlease Re-Enter");
		vDateName.value = "";
		vDateName.focus();
		return true;
		}
		// Reformat date to format that can be validated. mm/dd/yyyy
		if (vDateValue.length >= 8 && dateCheck) {
		// Additional date formats can be entered here and parsed out to
		// a valid date format that the validation routine will recognize.
		if (vDateType == 1) // mm/dd/yyyy
		{
		var mMonth = vDateName.value.substr(0,2);
		var mDay = vDateName.value.substr(3,2);
		var mYear = vDateName.value.substr(6,4)
		}
		if (vDateType == 2) // yyyy/mm/dd
		{
		var mYear = vDateName.value.substr(0,4)
		var mMonth = vDateName.value.substr(5,2);
		var mDay = vDateName.value.substr(8,2);
		}
		if (vDateType == 3) // dd/mm/yyyy
		{
		var mDay = vDateName.value.substr(0,2);
		var mMonth = vDateName.value.substr(3,2);
		var mYear = vDateName.value.substr(6,4)
		}
		if (vYearLength == 4) {
		if (mYear.length < 4) {
		alert("Invalid Date\nPlease Re-Enter");
		vDateName.value = "";
		vDateName.focus();
		return true;
		}
		}
		// Create temp. variable for storing the current vDateType
		var vDateTypeTemp = vDateType;
		// Change vDateType to a 1 for standard date format for validation
		// Type will be changed back when validation is completed.
		vDateType = 1;
		// Store reformatted date to new variable for validation.
		var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
		if (mYear.length == 2 && vYearType == 4 && dateCheck) {
		//Turn a two digit year into a 4 digit year
		var mToday = new Date();
		//If the year is greater than 30 years from now use 19, otherwise use 20
		var checkYear = mToday.getFullYear() + 30; 
		var mCheckYear = '20' + mYear;
		if (mCheckYear >= checkYear)
		mYear = '19' + mYear;
		else
		mYear = '20' + mYear;
		vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
		// Store the new value back to the field.  This function will
		// not work with date type of 2 since the year is entered first.
		if (vDateTypeTemp == 1) // mm/dd/yyyy
		vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
		if (vDateTypeTemp == 3) // dd/mm/yyyy
		vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
		} 
		if (!dateValid(vDateValueCheck)) {
		alert("Invalid Date\nPlease Re-Enter");
		vDateType = vDateTypeTemp;
		vDateName.value = "";
		vDateName.focus();
		return true;
		}
		vDateType = vDateTypeTemp;
		return true;
		}
		else {
		if (vDateType == 1) {
		if (vDateValue.length == 2) {
		vDateName.value = vDateValue+strSeperator;
		}
		if (vDateValue.length == 5) {
		vDateName.value = vDateValue+strSeperator;
		}
		}
		if (vDateType == 2) {
		if (vDateValue.length == 4) {
		vDateName.value = vDateValue+strSeperator;
		}
		if (vDateValue.length == 7) {
		vDateName.value = vDateValue+strSeperator;
		}
		} 
		if (vDateType == 3) {
		if (vDateValue.length == 2) {
		vDateName.value = vDateValue+strSeperator;
		}
		if (vDateValue.length == 5) {
		vDateName.value = vDateValue+strSeperator;
		}
		}
		return true;
		}
		}
		if (vDateValue.length == 10&& dateCheck) {
		if (!dateValid(vDateName)) {
		// Un-comment the next line of code for debugging the dateValid() function error messages
		//alert(err);  
		alert("Invalid Date\nPlease Re-Enter");
		vDateName.focus();
		vDateName.select();
		}
		}
		return false;
		}
		else {
		// If the value is not in the string return the string minus the last
		// key entered.
		if (isNav4) {
		vDateName.value = "";
		vDateName.focus();
		vDateName.select();
		return false;
		}
		else
		{
		if (vDateName.value != vDateName.value.substr(0, (vDateValue.length))) {
			vDateName.value = vDateName.value.substr(0, (vDateValue.length));
		}
		return false;
				}
			}
		}
		
		}
		*/ 
		
		//Modified Code of DateFormat has been added by Mukesh k on 1st Oct. 2007
		//This code has been added for IE,Mozilla and NetScape
		function DateFormat(vDateName, vDateValue, e, dateCheck, dateType) 
	{
				systDate = js_func_GetSysdate();
				if (vDateValue=="1111111111" && dateCheck) 
				{
							vDateName.value = "";
							vDateName.focus();
							vDateName.select();
							return false;
				}
				if (vDateValue=="1111111111" && dateCheck==false)
				{
							vDateName.value = "";
							vDateName.focus();
							vDateName.select();
							return false;
				}
		
				if (!( vDateValue=="")&& dateCheck==false )
				{	
					with (document.forms[0]) 
					{
							for (var i = 0; i < elements.length-1; i++) 
							{
									if (elements[i].type == "text" && elements[i]== vDateName )
									{
										 
												j=i;
												i=i+1;	
										
												if(!(elements[i].type=="text" || elements[i].type=="select-one" ||elements[i].type=="radio"||elements[i].type=="password"|| elements[i].type=="checkbox"||elements[i].type=="textarea")|| j==elements.length || elements[i].disabled)
												{
												        elements[i-1].focus();
												}
												else
												{
														var ctrlname=elements[i]
														js_func_tabNextCtrl(vDateName,'up',10,ctrlname);
												}
									}
							}
					}
				
				}
						
				vDateType = dateType;
				//Enter a tilde sign for the first number and you can check the variable information.
				if (vDateValue == "~") 
				{
						alert("AppVersion = "+navigator.appVersion+" \nNav. 4 Version = "+isNav4+" \nNav. 5 Version = "+isNav5+" \nIE Version = "+isIE4+" \nYear Type = "+vYearType+" \nDate Type = "+vDateType+" \nSeparator = "+strSeperator);
						vDateName.value = "";
						vDateName.focus();
						return true;
				}
				var whichCode = (window.Event) ? e.which : e.keyCode;
				if(!whichCode)
				        whichCode = 0;
				// Check to see if a seperator is already present.
				// bypass the date if a seperator is present and the length greater than 8
				if (vDateValue.length > 8 && isNav4) 
				{
						if ((vDateValue.indexOf("-") >= 1) || (vDateValue.indexOf("/") >= 1))
						return true;
				}
				//Eliminate all the ASCII codes that are not valid
				var alphaCheck = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/-";
				if (alphaCheck.indexOf(vDateValue) >= 1) 
				{
						if (isNav4) 
						{
								vDateName.value = "";
								vDateName.focus();
								vDateName.select();
								return false;
				        }
						else 
						{
								vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
								return false;
						}
				}
				if (whichCode == 8) //Ignore the Netscape value for backspace. IE has no value
					return false;
				else 
				{
				//Create numeric string values for 0123456789/
				//The codes provided include both keyboard and keypad values
				var strCheck = '47,48,49,50,51,52,53,54,55,56,57,58,59,95,96,97,98,99,100,101,102,103,104,105';
				if (strCheck.indexOf(whichCode) != -1) 
				{
						if (isNav4) 
						{
								if (((vDateValue.length < 6 && dateCheck) || (vDateValue.length == 7 && dateCheck)) && (vDateValue.length >=1)) 
								{
								alert("Invalid Date\nPlease Re-Enter");
								vDateName.value = "";
								vDateName.focus();
								vDateName.select();
								return false;
								}
								if (vDateValue.length == 6 && dateCheck) 
								{
										var mDay = vDateName.value.substr(2,2);
										var mMonth = vDateName.value.substr(0,2);
										var mYear = vDateName.value.substr(4,4)
										//Turn a two digit year into a 4 digit year
										if (mYear.length == 2 && vYearType == 4) 
										{
												var mToday = new Date();
												//If the year is greater than 30 years from now use 19, otherwise use 20
												var checkYear = mToday.getFullYear() + 30; 
												var mCheckYear = '20' + mYear;
												if (mCheckYear >= checkYear)
															mYear = '19' + mYear;
												else
															mYear = '20' + mYear;
										}
										var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
										if (!dateValid(vDateValueCheck)) 
										{
												alert("Invalid Date\nPlease Re-Enter");
												vDateName.value = "";
												vDateName.focus();
												vDateName.select();
												return false;
										}
										return true;
								}
								else 
								{
												// Reformat the date for validation and set date type to a 1
												if (vDateValue.length >= 8  && dateCheck) 
												{
														if (vDateType == 1) // mmddyyyy
														{
														var mDay = vDateName.value.substr(2,2);
														var mMonth = vDateName.value.substr(0,2);
														var mYear = vDateName.value.substr(4,4)
														vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
														}
														if (vDateType == 2) // yyyymmdd
														{
																var mYear = vDateName.value.substr(0,4)
																var mMonth = vDateName.value.substr(4,2);
																var mDay = vDateName.value.substr(6,2);
																vDateName.value = mYear+strSeperator+mMonth+strSeperator+mDay;
														}
														if (vDateType == 3) // ddmmyyyy
														{
																var mMonth = vDateName.value.substr(2,2);
																var mDay = vDateName.value.substr(0,2);
																var mYear = vDateName.value.substr(4,4)
																vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
														}
														//Create a temporary variable for storing the DateType and change
														//the DateType to a 1 for validation.
														var vDateTypeTemp = vDateType;
														vDateType = 1;
														var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
														if (!dateValid(vDateValueCheck)) 
														{
																alert("Invalid Date\nPlease Re-Enter");
																vDateType = vDateTypeTemp;
																vDateName.value = "";
																vDateName.focus();
																vDateName.select();
																return false;
														}
														vDateType = vDateTypeTemp;
														return true;
												}
												else 
												{
														if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) 
														{
														alert("Invalid Date\nPlease Re-Enter");
														vDateName.value = "";
														vDateName.focus();
														vDateName.select();
														return false;
														}
												}
								}
						}
						else 
						{
								// Non isNav Check
								if (((vDateValue.length < 8 && dateCheck) || (vDateValue.length == 9 && dateCheck)) && (vDateValue.length >=1)) 
								{
										alert("Invalid Date\nPlease Re-Enter");
										vDateName.value = "";
										//Code changed by Pankaj Gupta to set focus in Firefox and Netscape
										//vDateName.focus();
										setTimeout("document.getElementById(\'" +vDateName.id+ "\').focus();",1);
										return true;
								}
								// Reformat date to format that can be validated. mm/dd/yyyy
								if (vDateValue.length >= 8 && dateCheck) 
								{
										// Additional date formats can be entered here and parsed out to
										// a valid date format that the validation routine will recognize.
										if (vDateType == 1) // mm/dd/yyyy
										{
												var mMonth = vDateName.value.substr(0,2);
												var mDay = vDateName.value.substr(3,2);
												var mYear = vDateName.value.substr(6,4)
										}
										if (vDateType == 2) // yyyy/mm/dd
										{
												var mYear = vDateName.value.substr(0,4)
												var mMonth = vDateName.value.substr(5,2);
												var mDay = vDateName.value.substr(8,2);
										}
										if (vDateType == 3) // dd/mm/yyyy
										{
												var mDay = vDateName.value.substr(0,2);
												var mMonth = vDateName.value.substr(3,2);
												var mYear = vDateName.value.substr(6,4)
										}
										if (vYearLength == 4) 
										{
												if (mYear.length < 4) 
												{
														alert("Invalid Date\nPlease Re-Enter");
														vDateName.value = "";
														//Code changed by Pankaj Gupta to set focus in Firefox and Netscape
														//vDateName.focus();
														setTimeout("document.getElementById(\'" +vDateName.id+ "\').focus();",1);
														return true;
												}
										}
										// Create temp. variable for storing the current vDateType
										var vDateTypeTemp = vDateType;
										// Change vDateType to a 1 for standard date format for validation
										// Type will be changed back when validation is completed.
										vDateType = 1;
										// Store reformatted date to new variable for validation.
										var vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
										if (mYear.length == 2 && vYearType == 4 && dateCheck)
										{
												//Turn a two digit year into a 4 digit year
												var mToday = new Date();
												//If the year is greater than 30 years from now use 19, otherwise use 20
												var checkYear = mToday.getFullYear() + 30; 
												var mCheckYear = '20' + mYear;
												if (mCheckYear >= checkYear)
												mYear = '19' + mYear;
												else
												mYear = '20' + mYear;
												vDateValueCheck = mMonth+strSeperator+mDay+strSeperator+mYear;
												// Store the new value back to the field.  This function will
												// not work with date type of 2 since the year is entered first.
												if (vDateTypeTemp == 1) // mm/dd/yyyy
												vDateName.value = mMonth+strSeperator+mDay+strSeperator+mYear;
												if (vDateTypeTemp == 3) // dd/mm/yyyy
												vDateName.value = mDay+strSeperator+mMonth+strSeperator+mYear;
										} 
										if (!dateValid(vDateValueCheck))
										{
												alert("Invalid Date\nPlease Re-Enter");
												vDateType = vDateTypeTemp;
												vDateName.value = "";												
												//Code changed by Pankaj Gupta to set focus in Firefox and Netscape
												//vDateName.focus();
												setTimeout("document.getElementById(\'" +vDateName.id+ "\').focus();",1);
												return true;
										}
										vDateType = vDateTypeTemp;
										return true;
								}
								else 
								{
										if (vDateType == 1) 
										{
												if (vDateValue.length == 2) 
												{
														vDateName.value = vDateValue+strSeperator;
												}
												if (vDateValue.length == 5) 
												{
														vDateName.value = vDateValue+strSeperator;
												}
										}
										if (vDateType == 2) 
										{
												if (vDateValue.length == 4) 
												{
														vDateName.value = vDateValue+strSeperator;
												}
												if (vDateValue.length == 7) 
												{
														vDateName.value = vDateValue+strSeperator;
												}
										} 
										if (vDateType == 3) 
										{
												if (vDateValue.length == 2) 
												{
														vDateName.value = vDateValue+strSeperator;
												}
												if (vDateValue.length == 5) 
												{
														vDateName.value = vDateValue+strSeperator;
												}
										}
										return true;
								}
						}
						if (vDateValue.length == 10 && dateCheck)
						{
								if (!dateValid(vDateName)) 
								{
										// Un-comment the next line of code for debugging the dateValid() function error messages
										//alert(err);  
										alert("Invalid Date\nPlease Re-Enter");
										//Code changed by Pankaj Gupta to set focus in Firefox and Netscape
										//vDateName.focus();
										setTimeout("document.getElementById(\'" +vDateName.id+ "\').focus();",1);										
										vDateName.select();
								}
						}
						return false;
				}
		        else 
		        {
						// If the value is not in the string return the string minus the last
						// key entered.
						if (isNav4)
						{
								vDateName.value = "";
								vDateName.focus();
								vDateName.select();
								return false;
						}
						else
						{
								if (vDateName.value != vDateName.value.substr(0, (vDateValue.length))) 
								{
										vDateName.value = vDateName.value.substr(0, (vDateValue.length));
								}
								return false;
						}
			     }
		  }
		
		}
		
		function dateValid(objName) {
		var strDate;
		var strDateArray;
		var strDay;
		var strMonth;
		var strYear;
		var intday;
		var intMonth;
		var intYear;
		var booFound = false;
		var datefield = objName;
		var strSeparatorArray = new Array("-"," ","/",".");
		var intElementNr;
		// var err = 0;
		var strMonthArray = new Array(12);
		strMonthArray[0] = "Jan";
		strMonthArray[1] = "Feb";
		strMonthArray[2] = "Mar";
		strMonthArray[3] = "Apr";
		strMonthArray[4] = "May";
		strMonthArray[5] = "Jun";
		strMonthArray[6] = "Jul";
		strMonthArray[7] = "Aug";
		strMonthArray[8] = "Sep";
		strMonthArray[9] = "Oct";
		strMonthArray[10] = "Nov";
		strMonthArray[11] = "Dec";
		//strDate = datefield.value;
		strDate = objName;
		if (strDate.length < 1) {
		return true;
		}
		for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
		strDateArray = strDate.split(strSeparatorArray[intElementNr]);
		if (strDateArray.length != 3) {
		err = 1;
		return false;
		}
		else {
		strDay = strDateArray[0];
		strMonth = strDateArray[1];
		strYear = strDateArray[2];
		}
		booFound = true;
		}
		}
		if (booFound == false) {
		if (strDate.length>5) {
		strDay = strDate.substr(0, 2);
		strMonth = strDate.substr(2, 2);
		strYear = strDate.substr(4);
		}
		}
		//Adjustment for short years entered
		if (strYear.length == 2) {
		strYear = '20' + strYear;
		}
		strTemp = strDay;
		strDay = strMonth;
		strMonth = strTemp;
		intday = parseInt(strDay, 10);
		if (isNaN(intday)) {
		err = 2;
		return false;
		}
		intMonth = parseInt(strMonth, 10);
		if (isNaN(intMonth)) {
		for (i = 0;i<12;i++) {
		if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
		intMonth = i+1;
		strMonth = strMonthArray[i];
		i = 12;
		}
		}
		if (isNaN(intMonth)) {
		err = 3;
		return false;
		}
		}
		intYear = parseInt(strYear, 10);
		if (isNaN(intYear)) {
		err = 4;
		return false;
		}
		if (intMonth>12 || intMonth<1) {
		err = 5;
		return false;
		}
		if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
		}
		if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
		}
		if (intMonth == 2) {
		if (intday < 1) {
		err = 8;
		return false;
		}
		if (LeapYear(intYear) == true) {
		if (intday > 29) {
		err = 9;
		return false;
		}
		}
		else {
		if (intday > 28) {
		err = 10;
		return false;
			}
		}
		}
		return true;
		}
		function LeapYear(intYear) {
		if (intYear % 100 == 0) {
		if (intYear % 400 == 0) { return true; }
		}
		else {
		if ((intYear % 4) == 0) { return true; }
		}
		return false;
		}
		//  End -->
/*End*/




/********************************************************************************************************/

/**
 *	This function validates compares the date values passed
 *
 *	@param			:	Date1 ( mm/dd/yyyy format )
 *	@param			:	Date2 ( mm/dd/yyyy format )
 *
 *	@returns		:	0	:	Dates are equal 
 *						+ve :	Date1 > Date2 
 *						-ve :	Date1 < Date2
 *
 *	NOTE			:	It is assumed that Date1 and Date2 are valid
 *						and in the required format 
 *						(Pass values after validating)
 *
 *	@author			:	Vinod Padmanabhan
 *	@date			:	30-AUG-2003
 *	@ver			:	1.0
 */
function js_func_DateDiff(Date1, Date2) {

	//	variable declaration
	var strD1, strD2, arrDate;
	var mm, dd, yyyy;
	var lngDt1Equiv, lngDt1Equiv;
	
	//	form date #1
	arrDate		= Date1.split("/");
	mm			= "" + parseInt(arrDate[0], 10);
	dd			= "" + parseInt(arrDate[1], 10);
	yyyy		= "" + parseInt(arrDate[2], 10);
	strD1		= yyyy + ((mm.length < 2) ? "0" + mm : mm) + ((dd.length < 2) ? "0" + dd : dd);
	lngDt1Equiv	= parseInt(strD1, 10);
	
	//	form date #2
	arrDate		= Date2.split("/");
	mm			= "" + parseInt(arrDate[0], 10);
	dd			= "" + parseInt(arrDate[1], 10);
	yyyy		= "" + parseInt(arrDate[2], 10);
	strD2		= yyyy + ((mm.length < 2) ? "0" + mm : mm) + ((dd.length < 2) ? "0" + dd : dd);
	lngDt2Equiv	= parseInt(strD2, 10);
	
	return ((lngDt1Equiv - lngDt2Equiv) > 0) ? 1 : (((lngDt1Equiv - lngDt2Equiv) < 0) ? -1 : 0);
}

/********************************************************************************************************/

function js_func_checkTxaMaxLength(objTxa, maxLength, fieldName) {
	var obj = objTxa;
	//alert(obj.value.length)
	if (obj.value.length > maxLength) 
	{
		//alert("Maximum length for " + fieldName + " is " + maxLength);
		alert("The maximum length of" + " " + fieldName + " " + "should be" + " " + maxLength);
		event.keyCode = 0;
		objTxa.focus();
		objTxa.select();
		return false;
	}
	//Added by tushar
	return true;
}


//The below function selects Georgia as default state in State dropdown
function setGeorgiaSelected(ddlState) 
{
    for (var i = 0; i < ddlState.length; i++)
     {     
		//Modified by Ajay Seth on 24 Fabruary 2006
		//if (CONST_STATE_GEORGIA == ddlState[i].text)		
		if(CONST_STATE_GEORGIA.toUpperCase() == ddlState[i].text.toUpperCase())
		{
		ddlState.selectedIndex = i;
		break;
		}
    }
}

//The below function returns string value by removing leading and trailing spaces and tabs 
//from the arguments passed.

function js_func_trim(str)
{
	var x;
	var ch;
	
	for(x=0;x<str.length;x++)
	{
		ch=str.substr(x,1);
		if(ch==' ' || ch=='\t')
		{
			str=str.substr(x+1,str.length-1);
		}
		else
			break;
	}
	
	for(x=str.length-1;x>=0;x=x-1)
	{
		ch=str.substr(x,1);
		if(ch==' ' || ch=='\t')
		{
			str=str.substr(0,str.length-1);
		}
		else
			break;
	}
	
	return str;
}

//The below function resets the form and sets the focus
function js_func_resetform(objname)
{
		document.forms[0].reset();
		objname.focus();
		//return false;
		
}

//The below function accepts the object as a parameter and display 
//appropriate error messages if the text box is empty
//modified By Mukesh on 29 March as alert message not required.
//function js_func_checktextboxempty(objname,field_name)
function js_func_checktextboxempty(objname)
{
	if (js_func_trim(objname.value.trim())=="")
	{
		//alert("Please enter" + " " + field_name)
		objname.value = "";
		if(!eval(objname.isDisabled))// To check if the textbox is not disable
			objname.focus(); // else will get javascript error - Added by Amit Agarwal
		return false;
	}
	return true;
}


//The below function accepts combo object as a parameter and display appropriate 
//error messages, if no selection is made

function js_func_checkcomboempty(objname,field_name) {
	if (objname.selectedIndex == 0 ) {
		alert("Please select" + " " + field_name)
		if(!objname.disabled) 
			objname.focus();
		return false
	}
	return true;
}




//The below function is for poping up small window

function js_func_Winpopup(url)
{
       wn=window.open(url,"ICMS","resizable=yes,scrollbars=yes,top=10,left=10,width=300,height=200");
       wn.focus();

}


//The below function sets the cursor on the first element of the form

function js_func_SetFocus()
{
 document.forms[0].elements[0].focus()
}

//Added By Mukesh on 30 April to set BackColour of controls.
function js_func_SetBackColor(obj,colour)
{   
    var count = obj.length;
    var flag = "true";
    var focusControl;
    for(var i=0; i<count; i++) 
    {
      if(obj[i].value == "")
        {
           if(flag == "true")
           {focusControl = obj[i];flag = "false";}
            obj[i].style.backgroundColor = colour;
        }
      else
          obj[i].style.backgroundColor = "White";
    }
   focusControl.focus(); 
}


function js_func_BulkEmtyCheckTextBox(obj,colour)
{   
    var count = obj.length;
    var flag = true;
    var focusControl;
    for(var i=0; i<count; i++) 
    {
      if(obj[i].value == "")
        {
           if(flag == true)
           {focusControl = obj[i];
           focusControl.focus();
            flag = false;}
            obj[i].style.backgroundColor = colour;
        }
      else
          obj[i].style.backgroundColor = "White";
    }
   return flag;
}
function js_func_BulkCheckedRadio(objYes,objNo,colour)
{   
    var count = objYes.length;
    var flag = true;
    var focusControl;
    for(var i=0; i<count; i++) 
    {
      if((objYes[i].checked == false)&&(objNo[i].checked == false))
        {
           if(flag == true)
           {
           focusControl = objYes[i];
           focusControl.focus(); 
           flag = false;
           }
            objYes[i].style.backgroundColor = colour;
        }
      else
          objYes[i].style.backgroundColor = "White";
    }
   return flag;
}

function js_func_checkmaxlengthWithArray(objname,maxlength,colour)
{
    var count = objname.length;
    var flag = true;
    var focusControl;
    for(var i=0; i<count; i++) 
    {
     var str = objname[i].value.trim();
     if (str.length>=maxlength)
        {
           if(flag == true)
           { 
               objname[i].focus();
               flag = false;
           }
            objname[i].style.backgroundColor = colour;
        }
      else
          objname[i].style.backgroundColor = "White";
    }
   return flag;
}

function js_func_RequiredTextFieldValueArray(objname,colour)
{
    var count = objname.length;
    var flag = true;
    var focusControl;
    for(var i=0; i<count; i++) 
    {
     if (objname[i].value.trim()=='')
        {
           if(flag == true)
           { 
               objname[i].focus();
               flag = false;
           }
            objname[i].style.backgroundColor = colour;
        }
      else
          objname[i].style.backgroundColor = "White";
    }
   return flag;
}

function js_func_RequiredLableFieldValueArray(objname,colour)
{
    var count = objname.length;
    var flag = true;
    var focusControl;
    for(var i=0; i<count; i++) 
    {
     if (objname[i].innerHTML=='')
        {
           if(flag == true)
           {   
               flag = false;
           }
            objname[i].style.backgroundColor = colour;
        }
      else
          objname[i].style.backgroundColor = "White";
    }
   return flag;
}

//Added By Mukesh on 16 May to set Clear msg on lables.
function js_func_EmptyLable(obj)
{   
    var count = obj.length;
    var flag = "true";
    var focusControl;
    for(var i=0; i<count; i++) 
    { 
          obj[i].innerText = "";
    }
}


//The below function is for checking valid email
//Modified By Mukesh on 3 Oct 2007 to check for email for all the browser.
function js_func_checkemail(objname) 
{
if(js_func_trim(objname.value)!="")
{
	var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/;
	var check=/@[\w\-]+\./;
	var checkend=/\.[a-zA-Z]{2,4}$/;

	//if(((js_func_trim(objname.value).search(exclude) != -1)||(js_func_trim(objname.value).search(check)) == -1)||(js_func_trim(objname.value).search(checkend) == -1))
	if(((objname.value.search(exclude) != -1)||(objname.value.search(check)) == -1)||(objname.value.search(checkend) == -1))
		{
			//alert("Invalid Email Id");
			//objname.value="";
			objname.focus();
			return false;
		}
	return true;
}
else
{
	return true;
}
}


//The below function checks for maximum length of a form field say textarea

//function js_func_checkmaxlength(objname,maxlength,field_name)
function js_func_checkmaxlength(objname,maxlength)
{
   	var str = objname.value.trim();
	if (str.length>=maxlength)
	{
		//alert("The maximum length of" + " " + field_name + " " + "should be" + " " + maxlength);
		//objname.value = "";
		if(objname.disabled!=true)
		{
		    objname.focus();
		}
		objname.select();
		return false;
	}
	return true;
}

//The below function checks for maximum length of a form field say textarea modified by Sachin.
//This function has been changed as Pankaj Gupta provided updated code which support in
//diff. browser mozilla , netscape and IE on 4 Oct 2007
/*function js_func_chkmaxlength(objname,maxlength,field_name)
{
	try
	{
		var str = objname.value;
		if (str.length>=maxlength && event.keyCode != 46 && event.keyCode != 8 && event.keyCode != 9)
		{
			//alert(field_name + " exceeds the size.");
			//alert("The maximum length of" + " " + field_name + " " + "should be" + " " + maxlength);
			//--skip backspace and delete keys
			event.keyCode=0;
			//objname.value = str.substr(0,str.length-1);
			objname.focus();
			return false;
		}
		return true;
	}
	catch(e){}
}*/
function js_func_chkmaxlength(objname,maxlength,field_name,e)
{
    var whichCode = (window.Event) ? e.which : event.keyCode;
	var str = objname.value;
	if (str.length>=maxlength && whichCode != 46 && whichCode != 8 && whichCode != 9 && whichCode != 0 )
	{
		objname.focus();
		return false;
	}
	return true;
}

//The below function checks for validity of Zip codes. It should be either 5 or 9 numeric
//digits.

function js_func_checkzipcode(zipobjname1,zipobjname2)
{
		var str = js_func_trim(zipobjname1.value)		
		var str1= js_func_trim(zipobjname2.value);
		if (str == "" && str1 == "") return true;
		
		if (str.length <5 && str1.length < 4 )
		{
			alert("Zip code format should be either 5 or 9 digit");
			zipobjname1.value = "";
			zipobjname2.value = "";
			zipobjname1.focus();
			return false;
		}
		else if (str.length <5)
		{
			alert("Zip code format should be either 5 or 9 digit");
			zipobjname1.value = "";
			zipobjname2.value = "";
			zipobjname1.focus();
			return false;
		}
		else if (str1.length >=1 && str1.length <4)
		{
			alert("Zip code format should be either 5 or 9 digit");
			zipobjname2.value = "";
			zipobjname2.focus();
			return false;
		}

		if (js_func_trim(zipobjname1.value)==0)
		{
			alert("Zip code cannot be zero");
			zipobjname1.value="";
			zipobjname2.value = "";
			zipobjname1.focus();
			return false;
		}

		if (isNaN(js_func_trim(zipobjname1.value)))
		{
			alert("Zip code should be numeric");
			zipobjname1.value = "";
			zipobjname2.value = "";
			zipobjname1.focus();
			return false;
		}
	

		if (js_func_trim(zipobjname2.value) !="")
		{
			
			if (isNaN(js_func_trim(zipobjname2.value)))
			{
				alert("Zip code should be numeric");
				zipobjname2.value="";
				zipobjname2.focus();
				return false;
			}

		}

		return true;
}


//The below function converts field entry to upper case

function js_func_makeupper(objname)
{
	var objval

	objval=objname.value
		if(objname.value!="")
		{
			objname.value=objval.toUpperCase();
		}
}


//The below function is for automatically re-locating the cursor position on the next field

function js_func_tabNext(obj,event,len,next_field)
{
	
	if (event == "down") {
		field_length=obj.value.length;
		}
	else if (event == "up") {
		if (obj.value.length != field_length) {
			field_length=obj.value.length;
			if (field_length == len) {
				next_field.focus();
				}
			}
		}
}

//The below function checks for racf id specific to staff

function js_func_checkstaffracf(obj,field_name)
{
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-";
  var checkStr = obj.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
 }
  	if (!allValid)
	{    
		alert( "Invalid " + field_name );
		obj.value = "";
		obj.focus();
		return false;
	}
 
   return true;
}

//The below function validates SSN

function js_func_checkssn(ssnobjname1,ssnobjname2,ssnobjname3)
{
	var str = js_func_trim(ssnobjname1.value) + js_func_trim(ssnobjname2.value) + js_func_trim(ssnobjname3.value);
	var fssn=js_func_trim(ssnobjname1.value)
	var firstssn
	
	//alert(str);
	firstssn=fssn.substring(0,1)

//Commented by Priya on 09-Aug-2005
	/*if(fssn == 0)
		{
			alert("Invalid SSN");
			ssnobjname1.value="";
			ssnobjname2.value="";
			ssnobjname3.value="";
			ssnobjname1.focus();	
			return false;
		}*/
	
			/*for(x=1;x=str.length;x++)
		{
		var myNumber='111111111'
		myNumber= myNumber * x
			
			if (str=myNumber)
			{
				alert("Invalid SSN");
				ssnobjname1.value="";
				ssnobjname2.value="";
				ssnobjname3.value="";
				ssnobjname1.focus();
				return false;
			}
		}*/
		
		
		if(str == "000000000" || str == "111111111" || str == "222222222" || str == "333333333" ||str=="444444444")
		{
			alert("Invalid SSN");
			ssnobjname1.value="";
			ssnobjname2.value="";
			ssnobjname3.value="";
			ssnobjname1.focus();	
			return false;

		}
			
		if(str == "555555555" || str == "666666666" || str == "777777777" ||str=="888888888"||str=="999999999")
		{
			alert("Invalid SSN");
			ssnobjname1.value="";
			ssnobjname2.value="";
			ssnobjname3.value="";
			ssnobjname1.focus();	
			return false;

		}
		
		if(str == "123456789")
		{
			alert("Invalid SSN");
			ssnobjname1.value="";
			ssnobjname2.value="";
			ssnobjname3.value="";
			ssnobjname1.focus();	
			return false;

		}
		
		
		if(str == 0)
		{
			alert("Invalid SSN");
			ssnobjname1.value="";
			ssnobjname2.value="";
			ssnobjname3.value="";
			ssnobjname1.focus();	
			return false;

		}
//End
		
		
	if (str.length < 9)
		{
			alert("Invalid SSN");
			ssnobjname1.value="";
			ssnobjname2.value="";
			ssnobjname3.value="";
			ssnobjname1.focus();
			return false;
		}

	if(isNaN(str))
		{

			alert("Invalid SSN");
			ssnobjname1.value="";
			ssnobjname2.value="";
			ssnobjname3.value="";
			ssnobjname1.focus();
			return false;
		}

		
		for(x=0;x<str.length;x++)
		{
			ch=str.substr(x,1);
			if ((ch < '0' || ch >'9'))
			{
				alert("Invalid SSN");
				ssnobjname1.value="";
				ssnobjname2.value="";
				ssnobjname3.value="";
				ssnobjname1.focus();
				return false;
			}
		}
		
	
	return true;
}


//The below function validates FEIN


function js_func_checkfein(feinobjname1,feinobjname2)
{
	var str = js_func_trim(feinobjname1.value) + js_func_trim(feinobjname2.value);

	var fssn=js_func_trim(feinobjname1.value)
	var firstfein
	firstfein=fssn.substring(0,1)

//Added by Aannd Vithal again as on 3 April 2006
//------------------------------------------------------------------
if (js_func_trim(feinobjname1.value) == '' && js_func_trim(feinobjname2.value) == '')
{
	return true;
}
//------------------------------------------------------------------
//The below changes were made as on 3 May 2006 to allow fein starting with "0"
//if(firstfein == 0)
	if(firstfein.length <= 0)
		{
			alert("Invalid first FEIN");
			feinobjname1.value="";
			feinobjname2.value="";
			feinobjname1.focus();	
			return false;

		}

	if (str.length < 9)
		{
			alert("Invalid FEIN length");
			feinobjname1.value="";
			feinobjname2.value="";
			feinobjname1.focus();
			return false;
		}

	if(isNaN(str))
		{

			alert("Invalid FEIN");
			feinobjname1.value="";
			feinobjname2.value="";
			feinobjname1.focus();
			return false;
		}


	for(x=0;x<str.length;x++)
		{
			ch=str.substr(x,1);
			if ((ch < '0' || ch >'9'))
			{
				alert("Invalid FEIN");
				feinobjname1.value="";
				feinobjname2.value="";
				feinobjname1.focus();
				return false;
			}
		}
	return true;
}



//The below function will clear all the form fields

function js_func_clearAll(objname) 
{
   
		with (document.forms[0]) 
		{
			for (var i = 0; i < elements.length; i++) 
			{
						if (elements[i].type == "text")
						{
							elements[i].value = "";
						} 
						
						if(elements[i].type == "select-one")
   						{
   							elements[i].selectedIndex = 0;
   						}
   						
   						if(elements[i].type == "password")
         				{
         					elements[i].value = "";  
         				}
         				
         				if(elements[i].type == "textarea")
         				{
         					elements[i].value = "";  
         				}
         				if(elements[i].type == "checkbox")
         				{
         					elements[i].checked=false;
         				}
         				if(elements[i].type == "radio")
         				{
         					elements[i].checked=false;
         				}
						
					}
			}	
				//Added by Urvashi On 14 March, 2004
				if (document.getElementById("_ctl1_lblErrorMessage") != null)
				{
					document.getElementById("_ctl1_lblErrorMessage").innerHTML = "";	
				}
				//Added by amit
				if(objname!=null)
				{
					objname.focus();
				}
	
}
//Sapna Kansay 6/11/07 To set the focus to the first enabled visible control on Clear Click.
//-----------------Start -------------------------------------------------
			   function js_SetToFirstControl()
		{
							
					with (document.forms[0]) 
					{
						for (var i = 0; i < elements.length; i++) 
						{
									if (elements[i].type!= "hidden")
									{
											if (elements[i].disabled != true)
										{
									
											try 
											{
												//set the focus to it
												elements[i].focus();
												var bFound = true;
											}
									catch(er)
											{
											
											}
										}
									}
							
							//if found in this form, stop looking
							if (bFound == true)
							break;
						}
					}
		}

//Sapna Kansay 6/11/07 To set the focus to the first enabled visible control on Clear Click.
//-----------------End -------------------------------------------------		

//The below function is to block user from entering more than specified values

function js_func_LimitText(fieldObj,maxChars)
{
  var result = true;
  if (parseInt(fieldObj.value.length) >= parseInt(maxChars))
  {
      result = false;
  }
  
  if (window.event)
    window.event.returnValue = result;
  return result;
}


//The below function checks for numeric entry

//function js_func_checknumeric(objname,field_name)
//Modified By Mukesh on 29 April 2008

function js_func_checknumeric(objname)
{
	if (isNaN(js_func_trim(objname.value.trim())))
	{
		//alert(field_name + " " + "should be numeric");
		//objname.value="";
		objname.focus();
		return false;
	}
	return true;
}


function js_func_checknumericSingleDecimal(objname)
{
	if (isNaN(js_func_trim(objname.value.trim())))
	{
		//alert(field_name + " " + "should be numeric");
		//objname.value="";
		//objname.focus();
		return false;
	}
	return true;
}


function js_func_checkAllNumbers(objname,field_name)
{
	if (js_func_trim(objname.value).indexOf(".") >= 0) {
		alert(field_name + " " + "should be integer");
		//objname.value="";
		objname.focus();
		return false;
	}
	if (isNaN(js_func_trim(objname.value)))
	{
		alert(field_name + " " + "should be integer");
		//objname.value="";
		objname.focus();
		return false;
	}

	return true;
}

function js_func_checknonnegative(objname,field_name)
{
	if (js_func_checknumeric(objname,field_name))
	{
		if (objname.value < 0) {
			alert(field_name + " " + "should be non-negative");
			objname.value="";
			objname.focus();
			return false;
		}
	}
	else
		return false;

	return true;
}



//The below function is for validation of names

function js_func_checkname(obj,field_name)
{
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-.' ";
  var checkStr = obj.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
 }
  	if (!allValid)
	{    
		alert( "Invalid " + field_name );
		obj.value = "";
		obj.focus();
		return false;
	}
 
   return true;
}




//The below function is for validation of cities and counties

function js_func_checkcitycounty(obj,field_name)
{
	
  var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789(,*&:/'#_.-;)\ ";
  var checkStr = obj.value;
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt[i];
    
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt[j])
        break;
    if (j == checkOK.length)
    {
		alert('2');
      allValid = false;
      break;
    }
 }
  	if (!allValid)
	{    
		alert( "Invalid " + field_name );
		obj.value = "";
		obj.focus();
		return false;
	}
 
   return true;
}


//The below function is for alphanumeric validation
function js_func_Alphanumeric(obj,field_name) {
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789(,*&:/'#_.-;)\ ";
	var checkStr = obj.value;
	var allValid = true;
	var ch = "";
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if(j == checkOK.length){
			allValid = false;
			break;
		}
	}
	//Modified By Mukesh K on 25 Aug 2007 , for multiple browser as event.type of event.keyCode 
	//has not been supported by many browser.
	//--if keypress event also check this key
	/*if(event.type == 'keypress') {
		ch = String.fromCharCode(event.keyCode)
		var valid = (checkOK.indexOf(ch) != -1)
		if(!valid) event.keyCode = 0;
		allValid = allValid && valid;
	}*/
	
	if (!allValid) {
		var msg = "";
		msg = "Invalid " + field_name;
		//--563 For the employment details section the Field Job Duties should be wider in length and should be 10 lines allowed in length. Also if the user enters any characters that are not acceptable then the java script message "Invalid Job Duties" is displayed and the value entered is blanked off. This message doesnot tell the user which characters are not allowed. We need to have a message that tells the user which values are incorrect and give them the option to correct it or blank off the values. Also this field should be optional New Rehab Supplier 
		//--confirm clear-off for multiline textboxes.
		if(obj.type=='textarea') {
			msg += "\nCharacter " + ch + " is not allowed in the field " + field_name;
			msg += "\nDo you want to clear the value in this field?"
			var message =confirm(msg);
			if(message==true)
			{obj.focus();
			obj.value="";
			}	
			else
			{obj.focus();
			}
			//Commented by Sachin A. in order to avoid emptying the textbox.
		}
		else {
			alert(msg);
			obj.value="";
		}
		obj.focus();
		return false;
	}
	return true;
}

//The below function is to allow only numeric values and .
//Commented By Mukesh on 1st Oct 2007 , as replacing the this one with new one. 
//Which is provided by Pankaj Gupta. Which will be supported by Mozilla,IE and NetScape.
//We must pass the event in this function, where we want to apply it.
/*function js_func_OnlyNum()
{
	/*if (navigator.appName != 'Netscape') {
		if (!(event.keyCode >= 48 && event.keyCode <= 57))
			event.returnValue = false;
	}else if(e.which) // Netscape/Firefox/Opera
	{
		var keynum
		keynum = e.which
		if (!(keynum >= 48 && keynum <= 57 || keynum == 8))
		{  
			return false;
		}

	}
  if(navigator.appName != 'Netscape')
  {
	  if (event.keyCode == 13)
	return true;

   if ((event.keyCode > 32 && event.keyCode < 46) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)|| (event.keyCode < 45 || event.keyCode > 57) || (event.keyCode == 39)) 
  event.returnValue = false;
  }
}*/
//Modified By Mukesh on 23 Oct 2007 , as implementing Ctrl+V to paste from keyboard.
//Modified By Pankaj Gupta on 14 Nov 2007 , as implementing enter key.
function js_func_OnlyNum(e) 
{        
 //In Netscape 8 means backspace and 0 means delete and arrow keys but in IE,  backspace delete arrow keys has no key code 
    var whichCode = (window.Event) ? e.which : event.keyCode;
    {        
        if (!(whichCode >= 48 && whichCode <= 57 ||whichCode == 46 ||whichCode == 8 || whichCode == 0 ||whichCode == 118 ||whichCode == 13))
        {             
            return false;
        }
    }
}
//Added by Sachin A 14/09/2005 
//Overloaded the above function in order to ignore special characters.
function js_func_OnlyNumbers()
{
//alert(event.keyCode);
  if(navigator.appName != 'Netscape')
  {
   if ((event.keyCode > 32 && event.keyCode <= 47) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)|| (event.keyCode < 45 || event.keyCode > 57) || (event.keyCode == 39)) 
  event.returnValue = false;
  }
}
//Commented By Mukesh on 1st Oct 2007 , and replace this one with new function provided By 
//Pankaj Gupta , it will work for IE,Mozilla and NetScape. One must pass the event where we are 
//calling this funciton.
/*function js_func_AllNumbers() {
	if (navigator.appName != 'Netscape') {
		if (!(event.keyCode >= 48 && event.keyCode <= 57))
			event.returnValue = false;
	}
}*/
//Modified By Pankaj Gupta on 14 Nov 2007 , as implementing enter key.
function js_func_AllNumbers(e) 
{
    //In Netscape 8 means backspace and 0 means delete and arrow keys but in IE,  backspace delete arrow keys has no key code
    var whichCode = (window.Event) ? e.which : event.keyCode;
    {        
        if (!(whichCode >= 48 && whichCode <= 57 || whichCode == 8 || whichCode == 0 || whichCode == 13))
        {                
            return false;
        }
    }	
}


//The below function is to allow only alphabets on key press event.
//Commented By Mukesh on 1st Oct. 2007 with new function which is provided By Pankaj Gupta.
//This will work fine for IE,Mozilla and NetScape. We must pass the event in this function where we are calling this function.
/*function js_func_OnlyChar()
{
	if(navigator.appName != 'Netscape')
	{
		if((event.keyCode >= 65 && event.keyCode<=90) || (event.keyCode>=97 && event.keyCode <=122) ||(event.keyCode==32)||(event.keyCode==160) ||(event.keyCode==46) ||(event.keyCode==183) || (event.keyCode==8) ||(event.keyCode==9)|| (event.keyCode==13)|| (event.keyCode==39)) 
			event.returnValue =  true; 
		else
			event.returnValue =  false;
	}
}*/

function js_func_OnlyChar(e)
{
    var whichCode = (window.Event) ? e.which : event.keyCode;
    if(whichCode == 8 || whichCode == 0 ||(whichCode >= 65 && whichCode<=90) || (whichCode>=97 && whichCode <=122) ||(whichCode==32)||(whichCode==160) ||(whichCode==46) ||(whichCode==183) || (whichCode==8) ||(whichCode==9)|| (whichCode==13)|| (whichCode==39)) 		
        return true;            
    else
        return false;  
}

//The below function is to validate decimal entry

function js_func_checkdecimal(objname,field_name,max)
	{
		var chklength,beforedec;
		var count=0;  
		for(i=0;i<objname.value.length;i++)
		{
        		if(objname.value.charAt(i) == '.')
        		{
           			count++;
        		}  
        	}
  
	if(count==0)
	{

		if(eval(objname.value)==0)
		{
			alert(field_name + " " + "cannot be zero");
			//objname.value="";
			objname.focus();
			return false;
		}


		if(objname.value.length > max)
		{
 			 ///objname.value="";
			 alert(field_name + " " + "cannot be greater than " + max + " " + "digits");
          		 objname.focus();
 			 return false; 
		} 
	}

	if(count==1)
	{
		chklength=objname.value 
		chklength=chklength.split(".")
		beforedec=chklength[0]


		if(beforedec.length > max)
		{
			//objname.value="";
			alert("There can be maximum " + " " + max + " values before decimal");
			objname.focus();
 			return false; 

		}
	}

	if(count > 1)
	{
		//objname.value="";
		alert(field_name + " " + "is not valid");
		objname.focus();
  		return false;        
	}

	if(objname.value.indexOf('.') != -1)
		{
     			if((objname.value.substring(objname.value.indexOf('.')+1).length >2))
     			{
          //  			objname.value="";
				alert("There can be maximum two values after decimal");
       
         
       				objname.focus();
      				return false;
     			}
		}

return true;
} 

//The below function validates two date entries  'Start date' and 'End date'

function js_func_doDateCheck(from,to,from_field_name,to_field_name)
{
  if (from.value == "" && to.value != "")
  {
    alert(to_field_name+" cannot be without a "+from_field_name)
    from.focus();
    return false;
  }  
  else 
  {
	if (from.value != "" && to.value != "")
  	{
		if (!(Date.parse(from.value) <= Date.parse(to.value)))
		{
			alert(to_field_name+" should be greater than "+from_field_name)
			to.value=""
			to.focus();
			return false;
		}
		return true;
  	}
	return true;  
  } 
}

//The below function validates two date entries  'Start date' and 'End date'

function js_func_doDateCheck2(from,to,from_field_name,to_field_name)
{
  if (from.value == "" && to.value != "")
  {
    alert(to_field_name+" cannot be without a "+from_field_name)
    from.focus();
    return false;
  }  
  else 
  {
	if (from.value != "" && to.value != "")
  	{
		if (Date.parse(to.value) < Date.parse(from.value))
		{
			alert(to_field_name+" should be greater than or equal to "+from_field_name)
			to.value=""
			to.focus();
			return false;
		}
		return true;
  	}
	return true;  
  } 
}


//The below function is to validate date entry (MM/DD/YYYY) format

function js_func_dateValid(objname)
{	

   if(!(objname.value == "")) {
	
     if(objname.value.length != 10) {
      
        alert("Please enter the date in MM/DD/YYYY format");
        objname.value = "";
		objname.focus();
		return false; 
		}
     else 
     {
        	
   if(objname.value.charAt(2)== "/" && objname.value.charAt(5)== "/"){
   if(isNaN(objname.value.substring(0,2)) || isNaN(objname.value.substring(3,5)) || isNaN(objname.value.substring(6))){
                      alert("Please enter the date in MM/DD/YYYY format");
                      objname.value = "";
      objname.focus();
      return false; 
                   } 
           }else {
                      alert("Please enter the date in MM/DD/YYYY format");       
                      objname.value = "";
                      objname.focus();
      return false; 
           }
          
         
      }

   } 
   
if(eval(objname.value.substring(6)) < 1900)
{
alert("Year should be greater than 1900");
objname.value="";
objname.focus();
return false;

}
        //Calling js_func_chkdate   function 
        if(js_func_chkdate(objname) == false) {
            alert("The date is invalid");
            objname.value = "";
            objname.focus();
            return false; 
        }            
   return true;   
}


//*************** FUNCTION ADDED *******************************************//
//The below function is to validate date entry (MM/YYYY) format

function js_func_dateValidFormat(objname)
{

   if(!(objname.value == "")) {
     if(objname.value.length != 7) {
        alert("Please enter the date in MM/YYYY format");
        objname.value = "";
objname.focus();
return false; 
     }else {
        
   if(objname.value.charAt(2)== "/"){ //&& objname.value.charAt(5)== "/"){
   if(isNaN(objname.value.substring(0,2)) ||  isNaN(objname.value.substring(3,7))){
                      alert("Please enter the date in MM/YYYY format");
                      objname.value = "";
      objname.focus();
      return false; 
                   } 
           }else {
                      alert("Please enter the date in MM/YYYY format");       
                      objname.value = "";
                      objname.focus();
      return false; 
           }
          
         
      }

   } 
//alert(objname.value.substring(3,7));   
if(eval(objname.value.substring(3,7)) < 1900)
{

alert("Year should be greater than 1900");
objname.value="";
objname.focus();
return false;

}
    //Calling js_func_chkdate   function 
    if(isNaN(objname.value.substring(0,2)))
	{

		alert("Month has to be numeric");
		objname.value="";
		objname.focus();	
		return false;
	}	



	if((objname.value.substring(0,2))!="" && (objname.value.substring(0,2)) <= 0)
	{
		alert("Please enter valid month");
		objname.value="";
		objname.focus();
		return false;   

	}
		
	if((objname.value.substring(0,2)) > 12)
	{
		alert("Please enter valid month");
		objname.value="";
		objname.focus();
		return false;   
	}
	
	//Checking Year
	//Modified by Sampat on 4th Oct 2007 , change getFullYear() with getFullYear() for compatibility with 
	//Mozilla FireFox,NetScape and IE
    var systyear
	var today = new Date();
	systyear = today.getFullYear();
	if(isNaN(objname.value.substring(3,7)))
	{

		alert("Year has to be numeric");
		objname.value="";
		objname.focus();	
		return false;
	}	
	if((objname.value.substring(3,7))!="" && (objname.value.substring(3,7)) <= 1900)
	{
		alert("Year should be greater than 1900");
		objname.value="";
		objname.focus();
		return false;   

	}
	/*if((objname.value.substring(3,7)) > systyear)
	{
		alert("Year cannot be greater than current Year");
		objname.value="";
		objname.focus();
		return false;   
	}  */
        
      //  var monthval=objname.value.substring(0,2);
     /*   if(js_func_chkmonth(eval(objname.value.substring(0,2))) == false && js_func_chkyear(objname)==false) {
            alert("The date is invalid");
            objname.value = "";
            objname.focus();
            return false; 
        }      */      
   return true;   
}

//To Check Current Year in MM/YYYY
//Modified by Sampat on 4th Oct 2007 , change getYear() with getFullYear() for compatibility with 
//Mozilla FireFox,NetScape and IE
function js_func_chkyearmonthFormat(objname,fieldname)
{
	
	
	var systyear
	var sysmonth
	var today = new Date();
	systyear = today.getFullYear();
	sysmonth=today.getMonth();
	if(objname.value.substring(0,2) > sysmonth && objname.value.substring(3,7) > systyear)
	{
		alert(fieldname + " should be less than or equal to current Date");
		objname.value="";
		objname.focus();
		return false;   
	}
/*	else if(objname.value.substring(0,2) > sysmonth)
	{
		alert("Month cannot be greater than current Month");
		objname.value="";
		objname.focus();
		return false;   
	}*/
	else if(objname.value.substring(3,7) > systyear)
	{
		alert("Year cannot be greater than current Year");
		objname.value="";
		objname.focus();
		return false;   
	}
	return true;
}

//End
//*************** END ******************************************************//

// This function is to check month & year with present month & year
//Added by Ajay Seth on 2nd September 2005
function js_func_chkMonthYearCombination(objmonth,objyear)
{
	
	var today = new Date();
	systyear = today.getFullYear();
	systmonth= today.getMonth()+1;
			
	if(objyear.value==systyear)
	{
		if(objmonth.value > systmonth)
		{
			alert("Month and Year combination should be \nless then or equal to Current Date..");
			objmonth.value="";
			objmonth.focus();
			return false;
		}
	}	
	return true;
}
//End 

//This function is internally used along with other validations for date

function js_func_chkdate(objName)
{
var strDatestyle = "US"; //United States date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++)
{
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) 
{
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) 
{
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}

if (booFound == false)
{
if (strDate.length>5)
{
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
  }
}

if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);

if(intYear == 0){ 
err = 11;
return false;
}
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}

if (js_func_LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}

}

return true;
}


//This function is used for validating whether a year is leap year or not

function js_func_LeapYear(intYear) {
	if (intYear % 100 == 0) {
	if (intYear % 400 == 0) { return true; }
	}
	else {
	if ((intYear % 4) == 0) { return true; }
	}
	return false;
}

function js_func_chkmonth(objname)
{
	
	if(isNaN(objname.value))
	{

		alert("Month has to be numeric");
		objname.value="";
		objname.focus();	
		return false;
	}	



	if(eval(objname.value) <= 0)
	{
		alert("Please enter valid month");
		objname.value="";
		objname.focus();
		return false;   

	}
		
	if(eval(objname.value) > 12)
	{
		alert("Please enter valid month");
		objname.value="";
		objname.focus();
		return false;   
	}
	
	//Added by aseth on 16th August 2005 for validating month by checking the occurence of dot ie "." 
	if(objname.value.indexOf(".") != -1)
	{
		alert("Please enter valid month");
		objname.value="";
		objname.focus();
		return false;   
	}
	
	return true;
}
//This function is for validating Year so that it should be greater than 1900 and shouldn't be greater than system year
//Modified by Sampat on 4th Oct 2007 , change getYear() with getFullYear() for compatibility with 
//Mozilla FireFox,NetScape and IE
    
function js_func_chkyear(objname)
{
	
	
	var systyear
	var today = new Date();
	systyear = today.getFullYear();
	if(isNaN(objname.value))
	{

		alert("Year has to be numeric");
		objname.value="";
		objname.focus();	
		return false;
	}	
	if(eval(objname.value) <= 1900)
	{
		alert("Year should be greater than 1900");
		objname.value="";
		objname.focus();
		return false;   

	}
	if(eval(objname.value) > systyear)
	{
		alert("Year should be less or equal to the current Year");
		objname.value="";
		objname.focus();
		return false;   
	}
	return true;
}

//This function is for validating Year so that end year should be greater than start year

function js_func_compareyear(objStartYr,objEndYr)
{	
	if(parseInt(js_func_trim(objStartYr.value)) > parseInt(js_func_trim(objEndYr.value)))
	{
		alert("End year should be greater than Start Year");
		objEndYr.value="";
		objEndYr.focus();
		return false;   

	}
	return true;
}



//Returns System Date(MM/DD/YYYY) format

function js_func_GetSysdate()
	{
		var sysdate;
	var d=new Date();
	sysday = d.getDate();
	sysmon = d.getMonth() + 1;
	sysday = sysday + ''
	if(sysday.length == 1)
	{
	sysday = '0' + sysday;
	}
	sysmon = sysmon + '';
	if(sysmon.length == 1)
	{
	sysmon = '0' + sysmon;
	}
	sysyear = d.getFullYear();
	sysdate= sysmon + "/" + sysday + "/" + sysyear;
	return sysdate;

	}


// The below function validates telephone number with extension


function js_func_checktelnoextn(Telobjname1,Telobjname2,Telobjname3,Telobjname4)
{

var str = js_func_trim(Telobjname1.value) + js_func_trim(Telobjname2.value) + js_func_trim(Telobjname3.value);
var extension=js_func_trim(Telobjname4.value)

var strtelno = str + extension;
//Added By Sachin A.
if (strtelno == "") return true;
//End
    
if(Telobjname1.value=="" || Telobjname2.value=="" || Telobjname3.value=="" && Telobjname4 != "")
{
   alert("Invalid Telephone No. ");
   Telobjname1.value="";
   Telobjname2.value="";
   Telobjname3.value="";
   Telobjname4.value="";
   Telobjname1.focus();
   return false; 
}


if( str.substring(0,1) == "0" )
{
alert("Telephone Number cannot be zero");
Telobjname1.focus();
return false;
} 

if (js_func_trim(Telobjname1.value)==0 && js_func_trim(Telobjname2.value)==0 && js_func_trim(Telobjname3.value)==0)
{
alert("Telephone Number cannot be zero");
Telobjname1.value="";
Telobjname2.value = "";
Telobjname3.value = "";
Telobjname4.value = "";
Telobjname1.focus();
return false;
}

if (str.length < 10)
{
alert("Invalid Telephone No. ");
Telobjname1.value="";
   Telobjname2.value="";
   Telobjname3.value="";
   Telobjname4.value="";
Telobjname1.focus();
return false;
}

if(isNaN(str))
{

alert("Telephone No. has to be numeric");
Telobjname1.value="";
Telobjname2.value="";
   Telobjname3.value="";
   Telobjname4.value="";
Telobjname1.focus();
return false;
}


for(x=0;x<str.length;x++)
{
ch=str.substr(x,1);
if ((ch < '0' || ch >'9'))
{
alert("Invalid Telephone No. ");
Telobjname1.value="";
Telobjname2.value="";
   Telobjname3.value="";
   Telobjname4.value="";
Telobjname1.focus();
return false;
}
}

if(extension!="")
{

if(isNaN(extension))
{

alert("Extension No. has to be numeric");
Telobjname4.value="";
Telobjname4.focus();
return false;
}


for(x=0;x<extension.length;x++)
{
ch=str.substr(x,1);
if ((ch < '0' || ch >'9'))
{
alert("Invalid Extension No.");
Telobjname4.value="";
Telobjname4.focus();
return false;
}
}

}

return true;
}



// The below function validates telephone number with out extension


function js_func_checktelno(Telobjname1,Telobjname2,Telobjname3)
{

var strphone = js_func_trim(Telobjname1.value) + js_func_trim(Telobjname2.value) + js_func_trim(Telobjname3.value);

if (strphone == "") return true;

if( strphone.substring(0,1) == "0" )
{
alert("Telephone Number cannot be zero");
Telobjname1.focus();
return false;
} 
/*
alert("js_func_trim(Telobjname1.value) = " + js_func_trim(Telobjname1.value));
alert("js_func_trim(Telobjname2.value) = " + js_func_trim(Telobjname2.value));
alert("js_func_trim(Telobjname3.value) = " + js_func_trim(Telobjname3.value));
alert("js_func_trim(Telobjname1.value)==0 = " + (parseInt(js_func_trim(Telobjname1.value), 10)==0));
*/

if (parseInt(js_func_trim(Telobjname1.value), 10)==0 && parseInt(js_func_trim(Telobjname2.value), 10)==0 && parseInt(js_func_trim(Telobjname3.value), 10)==0)
{
alert("Telephone Number cannot be zero");
Telobjname1.value="";
Telobjname2.value = "";
Telobjname3.value = "";
Telobjname1.focus();
return false;
}

if (strphone.length < 10)
{
alert("Invalid Telephone No. ");
Telobjname1.value="";
   Telobjname2.value="";
   Telobjname3.value="";
   Telobjname1.focus();
return false;
}

if(isNaN(strphone))
{

alert("Telephone No. has to be numeric");
Telobjname1.value="";
Telobjname2.value="";
Telobjname3.value="";
Telobjname1.focus();
return false;
}


for(x=0;x<strphone.length;x++)
{
ch=strphone.substr(x,1);
if ((ch < '0' || ch >'9'))
{
alert("Invalid Telephone No. ");
Telobjname1.value="";
Telobjname2.value="";
   Telobjname3.value="";
Telobjname1.focus();
return false;
}
}

return true;
}


// The below function validates fax number


function js_func_checkfaxno(Faxobjname1,Faxobjname2,Faxobjname3)
{

var strphone = js_func_trim(Faxobjname1.value) + js_func_trim(Faxobjname2.value) + js_func_trim(Faxobjname3.value);

if (strphone == "") return true;

if( strphone.substring(0,1) == "0" )
{
alert("Fax Number cannot be zero");
Faxobjname1.focus();
return false;
} 

if (parseInt(js_func_trim(Faxobjname1.value), 10)==0 && parseInt(js_func_trim(Faxobjname2.value), 10)==0 && parseInt(js_func_trim(Faxobjname3.value), 10)==0)
{
alert("Fax Number cannot be zero");
Faxobjname1.value="";
Faxobjname2.value = "";
Faxobjname3.value = "";
Faxobjname1.focus();
return false;
}

if (strphone.length < 10)
{
alert("Invalid Fax No. ");
Faxobjname1.value="";
   Faxobjname2.value="";
   Faxobjname3.value="";
   Faxobjname1.focus();
return false;
}

if(isNaN(strphone))
{

alert("Fax No. has to be numeric");
Faxobjname1.value="";
Faxobjname2.value="";
Faxobjname3.value="";
Faxobjname1.focus();
return false;
}


for(x=0;x<strphone.length;x++)
{
ch=strphone.substr(x,1);
if ((ch < '0' || ch >'9'))
{
alert("Invalid Fax No. ");
Faxobjname1.value="";
Faxobjname2.value="";
   Faxobjname3.value="";
Faxobjname1.focus();
return false;
}
}

return true;
}

// This function loops through the form elements and finds the required object
function js_func_GetCtrl(vForm, objName)
{
	var i;
	for (i=0;i<vForm.elements.length;i++)
	{	
		if (vForm.elements[i].name == objName )
		{
			//alert(vForm.elements[i].value);
			return vForm.elements[i];
		}
	}
}


//Added by Urvashi Patil on 30 March, 2005
//This function is used to check if more than one check box is selected then give error message.
function js_func_checkboxCheck(checkboxId,fieldName)
	{
		var j=0
		for (i = 0; i < document.forms[0].elements.length; i++)
				 {
					if (document.forms[0].elements[i].type == "checkbox") 
					{
						
						if (document.forms[0].elements[i].name.lastIndexOf(checkboxId) > 1  && document.forms[0].elements[i].checked) 
						{
							//alert(frmApplicantInfo.elements[i].name);
							bRetFlag = true;
							j = j +1
							
						}
					}
				}
		
		if (j>1 || j==0)
		{			
			alert("Please select one " + fieldName +".");
			return false;
		}
		//Added by Urvashi on 27 May, 2005
		return true;
	}


//********************************
//Added By Priya on 27-Feb-06
//This function is used to check if more than one check box is selected then give error message and allowing none of the CheckBox is selection.
function js_func_noCheckboxCheckAllowed(checkboxId,fieldName)
	{
		var j=0
		for (i = 0; i < document.forms[0].elements.length; i++)
				 {
					if (document.forms[0].elements[i].type == "checkbox") 
					{
						
						if (document.forms[0].elements[i].name.lastIndexOf(checkboxId) > 1  && document.forms[0].elements[i].checked && (!document.forms[0].elements[i].disabled))
						{
							//alert(frmApplicantInfo.elements[i].name);
							bRetFlag = true;
							j = j +1
							
						}
					}
				}
		
		if (j>1)
		{			
			alert("Please select one " + fieldName +".");
			return false;
		}
	
		return true;
	}

//End
//********************************

//Added by Tushar Khandelwal on 20 April, 2005
//This is the function which Calculate the difference in Days for 2 dates 
// and Return the Difference in days -- to be used at Form level 
//returns -+(to date - from date)
	function js_func_DiffOfDatesInDays(objFormDate,objToDate) 
	{
	
		date1 = new Date();
		date2 = new Date();
		diff  = new Date();
		var days;
		days = 0;
		
		if (!(js_func_dateValid(objFormDate)))  	// Validates first date 
			{ return false; }				// otherwise exits
		if (!(js_func_dateValid(objToDate))) 		// Validates second date 
			{ return false; }				// otherwise exits
		// sets difference date to difference of first date and second date
		 
		date1temp = new Date(objFormDate.value);
		date1.setTime(date1temp.getTime());
		
		date2temp = new Date(objToDate.value);
		date2.setTime(date2temp.getTime());
	
		diff.setTime(date2.getTime() - date1.getTime());
		
		timediff = diff.getTime();	//This time is in miliseconds

		days = Math.floor(timediff / (1000 * 60 * 60 * 24)); 
		return days;	// this returns the difference in days
	}	
//Added by Tushar Khandelwal on 20 April, 2005
//this Function checks wether the value in object is less then the Max value or not
//CAUTION : the value in the Control is numeric or not should be checked First then Call this Function 	----- OK
function js_func_MaxValueAllowed(objCntl,MaxAllowedValue,field_name)
{
	
	if(objCntl.value != "") {
		if(parseFloat(objCntl.value) > parseFloat(MaxAllowedValue))
		{
			alert("The maximum allowed value in " + field_name + " is " + MaxAllowedValue);
			objCntl.value = "";
			objCntl.focus();
			return false;
		}
	}
	return true;
}


//Added by Tushar Khandelwal on 20 April, 2005
//Function to round off the value in ammount to 2 decimals----ok
//Function to be at (onBlur)
//Modified and commented By Mukesh Kumar on 3 Oct 2007
function js_func_RoundDecimal(objCtrl1,rlength)
{
	if (js_func_trim(objCtrl1.value)!= "")
	{
		objCtrl1.value = js_func_trim(objCtrl1.value);
		var newnumber = Math.round(js_func_trim(objCtrl1.value)*Math.pow(10,rlength))/Math.pow(10,rlength);
		//var newnumber = Math.round((objCtrl1.value)*Math.pow(10,rlength))/Math.pow(10,rlength);
		objCtrl1.value=newnumber;
	}
}	


//Added by Arun Puthran on 22-Apr-2005; function for enabling/disabling	all controls in a <DIV> tag
function js_func_disableDiv(div, disabled) {
	// -- get the input elements within div & disable them
	var inputs=div.getElementsByTagName('input')			
	for (i=0; i<inputs.length;i++) {
		inputs[i].disabled=disabled;
	}

	// -- get the textarea elements within div & disable them
	var textareas=div.getElementsByTagName('textarea')			
	for (i=0; i<textareas.length;i++) {
		textareas[i].disabled=disabled;
	}

	// -- get the select elements within div & disable them
	var selects=div.getElementsByTagName('select')			
	for (i=0; i<selects.length;i++) {
		selects[i].disabled=disabled;
	}
	// -- get the <a> elements within div & disable them
	var links=div.getElementsByTagName('a')			
	for (i=0; i<links.length;i++) {
			links[i].disabled = disabled
			//links[i].style.display=disabled ? "none" : "";
	}
}


//Added by Arun Puthran on 22-Apr-2005; function for clearing all controls in a <DIV> tag
function js_func_clearDiv(div) {
	// -- get the input elements within div & disable them
	var inputs=div.getElementsByTagName('input')			
	for (i=0; i<inputs.length;i++) {
		inputs[i].value="";
		if(inputs[i].type=='checkbox')
			inputs[i].checked=false;
	}

	// -- get the textarea elements within div & disable them
	var textareas=div.getElementsByTagName('textarea')			
	for (i=0; i<textareas.length;i++) {
		textareas[i].value="";
	}

	// -- get the select elements within div & disable them
	var selects=div.getElementsByTagName('select')			
	for (i=0; i<selects.length;i++) {
		selects[i].value="";
	}
	
	// -- get the textarea elements within div & disable them
	var labels=div.getElementsByTagName('span')		
	for (i=0; i<labels.length;i++) {
		labels[i].innerText="";
	}
}

//Added by Shalini on 30-Apr-2005; function for validating Claim Number format.
function js_func_checkclaimnumber(objname)
{

  var checkOK = "0123456789-";
  var checkStr = objname.value;

  if (checkStr.length < 11)
  {

		alert("Format of  Claim Number is 9999-999999");
		//added by mohini in order to clear the object value
		objname.value="";
		objname.focus();
		return false;


  } 

 		 var allValid = true;
 		 for (i = 0;  i < checkStr.length;  i++)
  		{
   			 ch = checkStr.charAt(i);
    			for (j = 0;  j < checkOK.length;  j++)
      				if (ch == checkOK.charAt(j))
        			break;
    			if (j == checkOK.length)
    			{
      				allValid = false;
      				break;
    			}
 		}
  		if (!allValid)
		{    
			alert("Invalid Claim Number");
			objname.value="";
			objname.focus();
			return false;
		}
 

		var count=0;  
		for(i=0;i<objname.value.length;i++)
		{
		        if(objname.value.charAt(i) == '-')
		        {
		           count++;
		        }  
      		  }

		if(count==0)
		{
			alert("Format of  Claim Number is 9999-999999");
			objname.focus();	
			return false;
		}


		if(count > 1)
		{
			alert("Format of  Claim Number is 9999-999999");
			objname.focus();	
			return false;    
		}


		if(count==1)
		{
			

			var chkclaimlength,clmfrstpart,clmscndpart;
			chkclaimlength=objname.value	
			chkclaimlength=chkclaimlength.split("-")
			clmfrstpart=chkclaimlength[0]
			clmscndpart=chkclaimlength[1]


						
			if(clmfrstpart.length < 4 || clmfrstpart.length >=5)
			{
				
				alert("Format of  Claim Number is 9999-999999");
				objname.focus();	
				return false;
					
			}
		}

   return true;

}

//Added by Urvashi  on 12-May-2005; function for resizing current window.
function ResizeCurrentWindow()
{
	
	/*self.moveTo(426,0);
	window.resizeTo(600,745)*/
	
	//	Changes made by Anand Vithal as on 20 June 2005 as per desktop configuration 1200 * 1024
	
	//The code below changed by Anand Vithal as on 8 August 2005 for resoultion independent split screen
	/*self.moveTo(620,0);
	window.resizeTo(660,995)*/
    //--------------------------------------------------------------------------------------------------
	javascript:self.moveTo((screen.availWidth)/2,0);
	self.resizeTo((screen.availWidth)/2,(screen.availHeight));
	//--------------------------------------------------------------------------------------------------
}

//Added by Urvashi  on 13-May-2005; function for maximizing current window.
function MaximizeCurrentWindow()
{
	javascript:self.moveTo(0,0);
	self.resizeTo((screen.availWidth),(screen.availHeight));
}


//Added by Urvashi  on 24-May-2005; function for closing the pop up image window.
function ClosePopUpWindow()
{	
	try
	{	
			//alert("hi");					
		//if (newwindow != null) 
		//{	
				//alert("hi");			
				newwindow=window.open('test.html','name','toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no,height=710,width=420,left=0,top=0');
				newwindow.close();				
		//}
	}
	catch (e)
	{
	}
	
}
// Added by Dhaval on 21/May/2005
// This method checks if the key entered is numeric without decimals
/*function js_func_OnlyNumNoDecimal()
{
  if(navigator.appName != 'Netscape')
  {
   if ((event.keyCode > 32 && event.keyCode < 46) || (event.keyCode > 57 && event.keyCode < 65) || (event.keyCode > 90 && event.keyCode < 97)|| (event.keyCode < 45 || event.keyCode > 57) || (event.keyCode == 39) || (event.keyCode == 47) || (event.keyCode == 46)||(event.keyCode == 47)) 
  event.returnValue = false;
  }
}*/
function js_func_OnlyNumNoDecimal(e)
{
     var whichCode = (window.Event) ? e.which : event.keyCode;
     if ((whichCode > 32 && whichCode < 46) || (whichCode > 57 && whichCode < 65) || (whichCode > 90 && whichCode < 97)|| (whichCode < 45 || whichCode > 57) || (whichCode == 39) || (whichCode == 47) || (whichCode == 46)||(whichCode == 47)) 
     {
       if(window.event)
          event.returnValue = false;
       else
          e.preventDefault();
          
     }
  
}

function js_func_SaveBeforeProceed()
{	
	if (window.confirm('If data is entered and not saved then the data would be lost. Would you like to continue?')) 
	{
		return true;
	} 
	else 
	{
		if (document.getElementById("ibtnSave") != null)
		{
			document.getElementById("ibtnSave").focus();
		}
		return false;
	}
}

//Added by Urvashi Patil on 27 June, 2005
//This function is used to allow multiple check box checked.
function js_func_AllowMultipleCheckboxCheck(checkboxId,fieldName)
	{		
		var j=0
		for (i = 0; i < document.forms[0].elements.length; i++)
				 {
					if (document.forms[0].elements[i].type == "checkbox") 
					{
						
						if (document.forms[0].elements[i].name.lastIndexOf(checkboxId) > 1  && document.forms[0].elements[i].checked) 
						{
							//alert(frmApplicantInfo.elements[i].name);
							bRetFlag = true;
							j = j +1
							
						}
					}
				}
		
		if (j==0)
		{			
			alert("Please select atleast one " + fieldName +".");
			return false;
		}
		//Added by Urvashi on 27 June, 2005
		return true;
	}

//Added by Urvashi on 1 July, 2005
//This is used to hide/show the form context.
function expanOrCollapseFormContext(arrowId, spanId, imageHierarchy)
{
	//arrowId = "ucFormContext" + "_" + arrowId;
	//spanId = "ucFormContext" + "_" + spanId;
	
	var controls = document.getElementsByName(arrowId)
	for (i=0; i<controls.length; i++)
	{
		//alert(controls[i].id);
		
		if(controls[i].id.indexOf("_" + arrowId) != -1)
		{
				arrowId= controls[i].id;
				break;
		}					
	}
	
	controls = document.getElementsByTagName("span")
	//alert(controls.length);
	for (i=0; i<controls.length; i++)
	{				
		if(controls[i].id.indexOf("_" + spanId) != -1)
		{
				//alert(controls[i].id);
				spanId= controls[i].id;
				break;
		}					
	}
	//document.getElementsByTagName(
	//alert(arrowId);
	if (document.getElementById(spanId) != null)
	{
		//document.getElementById(arrowId).src = "../images/arrowRight_big.gif";
		if (document.getElementById(spanId).style.display == "")
		{
			document.getElementById(spanId).style.display = "none";
			if (document.getElementById(arrowId) != null)
			{							
				document.getElementById(arrowId).src = imageHierarchy + "images/arrow_down.gif";
			}
		}
		else if (document.getElementById(spanId).style.display == "none")
		{
			document.getElementById(spanId).style.display = "";
			if (document.getElementById(arrowId) != null)
			{							
				document.getElementById(arrowId).src = imageHierarchy + "images/arrow_side.gif";
			}
		}
	}
}


//This function is called for datagrid Columns.
function OpenImage(url, windowName) {
	//newwindow=window.open(url , windowName ,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no,height=550,width=720,left=0,top=0'); 
	newwindow=window.open(url , windowName ,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no,height=' + screen.availHeight + ',width=' + (parseInt(screen.availWidth,10)-10) + ',left=0,top=0'); 
	if (window.focus) {
		if (newwindow != null) {
				//newwindow.focus()
		}
	}
}


//This function is called from "View" link of context.
function OpenImageView(url, windowName) {
	newwindow=window.open(url , windowName ,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no,height=' + screen.availHeight + ',width=' + screen.availWidth + ',left=0,top=0'); 
	if (window.focus) {
		if (newwindow != null) {
				newwindow.focus()
		}
	}
}


//This function is called from "View" link of context.
function js_func_ViewImage(url, windowName, height, width, left, top) 
{
	
	if (height.length == 0)
		height = screen.availHeight
		
	if (width.length == 0)
		width = screen.availWidth
		
	if (left.length == 0)
		left = 0
		
	if (top.length == 0)
		top = 0
			
	newwindow=window.open(url , windowName ,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no,height=' + height + ',width=' + width + ',left=' + left + ',top=' + top ); 
	if (window.focus) {
		if (newwindow != null) {
				newwindow.focus()
		}
	}
}

//This function is used to open the image.
function js_func_ViewImage_All_Params(url, windowName, height, width, left, top, toolbar, location, directories, status, menubar, scrollbars, resizable, copyhistory) 
{
	
	if (height.length == 0)
		height = screen.availHeight
		
	if (width.length == 0)
		width = screen.availWidth
		
	if (left.length == 0)
		left = 0
		
	if (top.length == 0)
		top = 0
			
	newwindow=window.open(url , windowName ,'toolbar=' + toolbar + ', location=' + location + ', directories=' + directories + ', status=' + status + ', menubar=' + menubar + ', scrollbars=' + scrollbars + ', resizable=' + resizable + ', copyhistory=' + copyhistory + ',height=' + height + ',width=' + width + ',left=' + left + ',top=' + top ); 
	if (window.focus) {
		if (newwindow != null) {
				newwindow.focus()
		}
	}
}

//-----------------------------------------------------
// function to CHANGE THE TEXT IN SMALL LETTERS TO CAPITAL LETTER
// Note : this function can be used at Following events
//	onKeyPress, onKeyUp, onKeyDown, onBlur and at submit of the page
//-----------------------------------------------------		

function js_func_AllTextInCaps(objname)
{

	if ((event.type == 'keypress') || (event.type == 'keyup') || (event.type == 'keydown'))
	{
		if((event.keyCode >= 97 && event.keyCode<=122)) 
			event.keyCode = event.keyCode - 32
	}
	else
	{
			objname.value = objname.value.toUpperCase();
	}
}

//-----------------------------------------------------
// function to Check that only one Checkbox is checked of 2
//to be used is we want Check box to be as Radio button group    --- OK
//-----------------------------------------------------		
function js_func_OneFromTwoCheckBox(idChkBox1,idChkBox2)
{ 
//var objCtrl1 = document.getElementById(idChkBox1);
//var objCtrl2 = document.getElementById(idChkBox2);
	if (idChkBox1.checked)
	{
		idChkBox2.checked = false;
	}		
}	

function js_func_OnlyDate()
{
	if(navigator.appName != 'Netscape')
	{
		if (event.keyCode > 46 && event.keyCode < 58)
			event.returnValue = true;
		else
			event.returnValue = false;
	}
}
//	==================================================================

//	to prevent browser back
//history.forward();
//	End changes on 20/OCT/2005
//	==================================================================

//	==================================================================
//	Added by Vinod Padmanabhan on 07/NOV/2005
//	to disable controls on submit
function js_func_disableCtrlsOnSubmit() {
	//	*********** NOTE NOTE NOTE NOTE NOTE NOTE ********************
	//	uncomment the 'return' statement below, if the functionality
	//	is not required in production.
	//return;
	//	**************************************************************
	try {
		var strInps = "";
		var inputs = document.getElementsByTagName('input');
		var hdnCtrl;
		for (var i=0; i < inputs.length; i++) {
			if (inputs[i].type.toLowerCase() == "image") {
				strInps += "[Index] " + inputs[i].id.indexOf("_dsb") + " [Type] " + inputs[i].type + " [ID] " + inputs[i].id + " [Name] " + inputs[i].name + "\n";
				if (inputs[i].id.indexOf("_dsb") < 1) {
					//dvSaveEnable
					//inputs[i].parentNode.style.display = "none";
					//inputs[i].style.display = "none";
					//inputs[i].style.visibility = "hidden";
					//Code added by Pankaj Gupta as on Oct 24 to fix spacing and moving button problem					
					/*if (navigator.appName == "Netscape")
						inputs[i].style.display = "none";
					else
						inputs[i].style.display = "";*/	
					//inputs[i].style.height='1px';				
					inputs[i].style.visibility = "hidden";
					//hdnCtrl = eval("document.all.dv" + inputs[i].id.substring(4));
					hdnCtrl = document.getElementById('dv' + inputs[i].id.substring(4));
					if (hdnCtrl != null) 
					{	
                         hdnCtrl.style.display = "block";
					     hdnCtrl.style.visibility = "visible";
					}
				}
			}
		}
		//alert(strInps);
		return true;
	} catch(e){}
}
//	End changes on 07/NOV/2005
//	==================================================================
function DefaultValuesSet()
{
	if (document.getElementById("tbStartMin") != null)
	{
		if (document.getElementById("tbStartMin").value == "")
			document.getElementById("tbStartMin").value = "00";
	}
	if (document.getElementById("tbEndMin") != null)
	{
		if (document.getElementById("tbEndMin").value == "")
			document.getElementById("tbEndMin").value = "00";
	}
}
function js_func_SaveBeforeFinalize()
{	
	if (window.confirm("Are you sure you want to finalize the Order / Award?")) 
	{
		return true;
	} 
	else 
	{
		return false;
	}
}
function js_func_readOnlyDiv(div, readOnly) {
	// -- get the input elements within div & disable them
	var inputs=div.getElementsByTagName('input')			
	for (i=0; i<inputs.length;i++) {
		inputs[i].readOnly=readOnly;
	}

	// -- get the textarea elements within div & disable them
	var textareas=div.getElementsByTagName('textarea')			
	for (i=0; i<textareas.length;i++) {
		textareas[i].readOnly=readOnly;
	}

	// -- get the select elements within div & disable them
	var selects=div.getElementsByTagName('select')			
	for (i=0; i<selects.length;i++) {
		selects[i].readonly=readOnly;
	}
	// -- get the <a> elements within div & disable them
	var links=div.getElementsByTagName('a')			
	for (i=0; i<links.length;i++) {
			links[i].readOnly = readOnly			
	}
}
function js_func_DocumentsCheckedOut()
{
    alert('Some documents are checked-out.\nPlease check-in all the documents before finalize/approval.');
    return false;
}

function js_func_DocumentsSaveMode()
{
	alert('Some documents are in Save mode.\nPlease generate all the documents before finalize/approval.');
    return false;
}

function select_all(checkName,checkBoxId)
{	
	var num=document.forms[0].elements.length;
	for (var i=0;i<num;i++)
	{	
		if (document.forms[0].elements[i].name.indexOf(checkName)>-1)
		{
			document.forms[0].elements[i].checked = document.getElementById(checkBoxId).checked;
		}
	}
}

function fnChkDocumentDeletion()
{
	if (window.confirm("Are you sure you want to delete the document?"))
	{
		return true;
	}
	else
	{
		return false;
	}
}

//Added by priya on 23-feb-06
function fnChkRehabDeletion()
{
	if (window.confirm("Are you sure you want to remove the rehab supplier?"))
	{
		return true;
	}
	else
	{
		return false;
	}
}
//End

 function fnChkDocumentCheckOut()
{
	
	if (window.confirm("Are you sure you want to check out the document?"))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function fnChkDocumentCancelCheckOut()
{
	
	if (window.confirm("Are you sure you want to cancel the checked out document?"))
	{
		return true;
	}
	else
	{
		return false;
	}
}

//--added by arun puthran on 20-aug; old documents alert
function js_oldDocumentAlert(docType) {
	if(docType == 'WC-102D' || docType == 'WC-200B' || docType == 'WC-108A') {
		alert('This is a Pre-Phase2 document. No preview available.' );
		return false;
	}
	return true;
}
			
			
function expanOrCollapseEDIContext(arrowId, spanId, imageHierarchy)
{
	//arrowId = "ucFormContext" + "_" + arrowId;
	//spanId = "ucFormContext" + "_" + spanId;
	
	var controls = document.getElementsByName(arrowId)
	for (i=1; i<controls.length; i++)
	{
		
		
		if(controls[i].id.indexOf("_" + arrowId) != -1)
		{
				arrowId= controls[i].id;
				break;
		}					
	}
	
	controls = document.getElementsByTagName("span")
	//alert(controls.length);
	for (i=1; i<controls.length; i++)
	{				
		if(controls[i].id.indexOf("_" + spanId) != -1)
		{
				//alert(controls[i].id);
				spanId= controls[i].id;
				break;
		}					
	}
	//document.getElementsByTagName(
	//alert(arrowId);
	if (document.getElementById(spanId) != null)
	{
		//document.getElementById(arrowId).src = "../images/arrowRight_big.gif";
		if (document.getElementById(spanId).style.display == "")
		{
			document.getElementById(spanId).style.display = "none";
			if (document.getElementById(arrowId) != null)
			{							
				document.getElementById(arrowId).src = imageHierarchy + "images/arrow_down.gif";
			}
		}
		else if (document.getElementById(spanId).style.display == "none")
		{
			document.getElementById(spanId).style.display = "";
			if (document.getElementById(arrowId) != null)
			{							
				document.getElementById(arrowId).src = imageHierarchy + "images/arrow_side.gif";
			}
		}
	}
}
//Added by Pradip on 12/07/2007 at HCLT,GGN for not allowing special characters without popup message
//============================Start==============================================================
function js_func_Alphanumeric_v2(obj,field_name) {
	var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789(,*&:/'#_.-;)\ ";
	var checkStr = obj.value;
	var allValid = true;
	var ch = "";
	for (i = 0;  i < checkStr.length;  i++) {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if(j == checkOK.length){
			allValid = false;
			break;
		}
	}
	//--if keypress event also check this key
	if(event.type == 'keypress') {
		ch = String.fromCharCode(event.keyCode)
		var valid = (checkOK.indexOf(ch) != -1)
		if(!valid) event.keyCode = 0;
		allValid = allValid && valid;
	}
	
	if (!allValid) {
		var msg = "";
		msg = "Invalid " + field_name;
		//--563 For the employment details section the Field Job Duties should be wider in length and should be 10 lines allowed in length. Also if the user enters any characters that are not acceptable then the java script message "Invalid Job Duties" is displayed and the value entered is blanked off. This message doesnot tell the user which characters are not allowed. We need to have a message that tells the user which values are incorrect and give them the option to correct it or blank off the values. Also this field should be optional New Rehab Supplier 
		//--confirm clear-off for multiline textboxes.
		if(obj.type=='textarea') {
			msg += "\nCharacter " + ch + " is not allowed in the field " + field_name;
			msg += "\nDo you want to clear the value in this field?"
			var message =confirm(msg);
			if(message==true)
			{obj.focus();
			obj.value="";
			}	
			else
			{obj.focus();
			}
			//Commented by Sachin A. in order to avoid emptying the textbox.
		}
		else {
			//alert(msg);
			//obj.value="";
		}
		event.returnValue =  false;
		obj.focus();
		//return false;
	}
	//return true;
	event.returnValue =  true; 
}
//===================================End===============================================================

//Added by Pradip on 04/10/2007 at HCLT,GGN to give border to checkbox controls
//============================Start==============================================================
function borderingCheckbox()
{
   var divTbl;
   var _Form1 = document.getElementsByTagName("form").item(0);
   var inputsArr = _Form1.getElementsByTagName("input");
   var length = inputsArr.length;
   var _checkbox;
   var _checkboxClone;
   var table;
   var tbody;
   var tr;
   var tdDiv;
   var tdText;
   var space1;
   for(var i = 0;i< length; ++i)
   {
     if(inputsArr[i].getAttribute('type') == 'checkbox' || inputsArr[i].getAttribute('type') == 'radio')
     {
       divTbl =   document.createElement("div");
       divTbl.className = 'checkboxborder';
       _checkbox = inputsArr[i];
              
       _checkboxClone = _checkbox.cloneNode(true);
       _checkboxClone.className = 'checkbox';
        divTbl.appendChild(_checkboxClone);
      
       table = document.createElement('table');
       table.setAttribute('cellpadding','0');
       table.setAttribute('cellspacing','0');
       table.setAttribute('border','0');
       tbody = document.createElement('tbody');
       tr = document.createElement('tr');
       tr.setAttribute('style','valign:top;');
       
       tdDiv = document.createElement('td');
       tdText = document.createElement('td');
       space1 = document.createTextNode("\u00a0")
       tdText.className = 'font_label';
	   tdText.style.fontWeight = 'normal'; 
       
       tdDiv.appendChild(divTbl);
       if(_checkbox.nextSibling)
	  {
            tdText.appendChild(_checkbox.nextSibling.cloneNode(true));
      }
       tr.appendChild(tdDiv); 
       tr.appendChild(space1); 
       tr.appendChild(tdText); 
       tbody.appendChild(tr); 
       table.appendChild(tbody); 
             
       _checkbox.parentNode.insertBefore(table,_checkbox);
       if(_checkbox.nextSibling)
       _checkbox.parentNode.removeChild(_checkbox.nextSibling);
       _checkbox.parentNode.removeChild(_checkbox);
       
     }
   } 
   ManageBottomImageButtons();
     
 }

 function ManageBottomImageButtons()
		{
		    try {
		//var strInps = "";
		var inputs = document.getElementsByTagName('input');
		var hdnCtrl;
		var parentNodeNextSiblingNextSibling;
		var parentNodeNextSiblingNextSiblingTmp;
		var flag = 0;
		for (var i=0; i < inputs.length; i++) {
			if (inputs[i].type.toLowerCase() == "image") {
				//strInps += "[Index] " + inputs[i].id.indexOf("_dsb") + " [Type] " + inputs[i].type + " [ID] " + inputs[i].id + " [Name] " + inputs[i].name + "\n";
				if (inputs[i].id.indexOf("_dsb") > -1) 
				{
				    if(flag == 0)
					{
					   inputs[i].parentNode.parentNode.parentNode.setAttribute('valign','top');
					   flag = 1;
					}
					//dvSaveEnable
					inputs[i].parentNode.setAttribute('style','VISIBILITY:hidden;display:none');
					parentNodeNextSiblingNextSiblingTmp = inputs[i].parentNode.nextSibling.nextSibling;
					while(parentNodeNextSiblingNextSiblingTmp)
					{
					      // if(inputs[i].parentNode.nextSibling.nextSibling)
					      //{
						      parentNodeNextSiblingNextSibling = parentNodeNextSiblingNextSiblingTmp;

						      parentNodeNextSiblingNextSiblingTmp = parentNodeNextSiblingNextSiblingTmp.nextSibling;

					          if(parentNodeNextSiblingNextSibling.nodeType == Node.TEXT_NODE)
					          {
                                  //alert(inputs[i].parentNode.nextSibling.nextSibling);
					              

                                  inputs[i].parentNode.parentNode.removeChild(parentNodeNextSiblingNextSibling);
					          }
							  
					     //}
					}
					
					
				}
			}
		}
		//alert(strInps);
		return true;
	} catch(e){}
	      
}
function ToDisableLink()
{
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{
		if(x[i].getAttribute("href")=="" || x[i].getAttribute("href")==null )
		{	
			x[i].style.color="gray";
			x[i].style.textDecoration="none";
		}
	}
}
//Added By mukesh on 29 April 2008
function js_func_GetAsciiValue(objval)
    {

        var Values = 0;	
        var n = 0;
        n=objval.value.length;
        var i = 0;
        for(i=0;i<n;i++)
        {
         Values += objval.value.charCodeAt(i);
        }
        return Values;
    }


//Added by Urvashi on 22 Oct, 2007
function HideURL()
{ //window.status="ICMS";
	//return true;
}

//Added by Mukesh as per desigener. 26 May 2008

//===================================End===============================================================


// JavaScript Document
// JavaScript Document
// JavaScript Document
var prevPageHeight = 0;
function toggleColumn(id)
{

	var obj = document.getElementById(id);
	if(obj.disabled == true)
	{
		obj.disabled = false;	
	}
	else
	{
		obj.disabled = true;	
	}
}
function updateTreeHeight()
{

	var objContainer = document.getElementById('pageContent');
	var objTree = document.getElementById('treeContainer');
	if((objTree.offsetHeight) < objContainer.offsetHeight){
		objTree.style.height = (objContainer.offsetHeight-1) + "px";
	}
	else if((objTree.offsetHeight) > prevPageHeight && prevPageHeight != 0 )
	{
		objTree.style.height = (objContainer.offsetHeight-1) + "px";
	}
	prevPageHeight = objContainer.offsetHeight;
	//alert(objTree.style.height);
}
function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
function expandCollapse(objAnchor,panel){
	var _panel = document.getElementById(panel);
	if(	objAnchor )
	{
		if(objAnchor.className != "" && objAnchor.className == "heading-minus")
		{
			objAnchor.className = "heading-plus";
			_panel.style.display="none";
		}
		else if(objAnchor.className != "" && objAnchor.className == "heading-plus")
		{
			objAnchor.className = "heading-minus";
			_panel.style.display="block";
		}
	}
	updateTreeHeight();
}
/*  Only for Product Information Page */
function ToDisableLink()
{
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{	
		if(x[i].getAttribute("class")!="" || x[i].getAttribute("class")!=null )
		{	
		    var value = x[i].innerHTML;
		    switch (value) 
		    {
                case "Target Audience":
                    x[i].href="#";
                break;
                case "Financial Data":
                    x[i].href="#";
                break;
                case "Volume Projections":
                    x[i].href="#";
                break;
                case "Marketing Support Proposal":
                    x[i].href="#";
                break;
                case "Partnership Proposal":
                    x[i].href="#";
                break;
                case "Application Recap":
                    x[i].href="#";
                break;
                
            }
		}
	}
}

    
function ToEnableLink()
{
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{	
		if(x[i].getAttribute("class")!="" || x[i].getAttribute("class")!=null )
		{	
		    var value = x[i].innerHTML;
		    switch (value) 
		    {
                case "Target Audience":
                    x[i].href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$Menu1','TA')";
                break;
                case "Financial Data":
                    x[i].href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$Menu1','FD')";
                break;
                case "Volume Projections":
                    x[i].href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$Menu1','VP')";
                break;
                case "Marketing Support Proposal":
                    x[i].href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$Menu1','MSA')";
                break;
                case "Partnership Proposal":
                    x[i].href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$Menu1','PP')";
                break;
                case "Application Recap":
                    x[i].href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$Menu1','AR')";
                break;
                
            }
		}
	}
}


