//This file contains all the Javascript functions used throughout the website//
/***********************************************************************
//STEPS FOR USAGE
1) Please fill-in the date & your name b4 writing any line of code in this file
2) Comment the purpose of the function b4 starting up with it
3) Comment every condition b4 writing it
4) End up the function with "Function funcname ends here" comment

************************************************************************/
//*************************************************************************************************

//*************************************************************************************************
		//Sample functions used most commonly on all forms are below. Please copy & alter them as necessary
		//*************************************************************************************
		
		//Coded by Padma on 26-2-2004 
		//function to validate for null values in the form
		function checkform(form)
		{
			var i;
			//loop through the form elements
			for(i=0;i< form.elements.length - 1;i++)
			{
				//check if any of the elements is null
				if(form.elements[i].value=="" || !form.elements[i].value)
				{
					alert("Please enter the value in the required field")
					form.elements[i].focus();
					return false;
				}
			}
		return true;
		}

		//************************************************************************************
		
		
		//Coded by Padma on 26-2-2004 
		//function to check for values during login
		function loginform(form)
		{
			var i;
			//to check for null values in the username field
			if(form.txtuser.value=="" || !form.txtuser.value)
			{
				alert("Please enter the Username to login");
				form.txtuser.focus();
				return false;
			}
		
			//to check for null values in the Password field
			if(form.txtpass.value=="" || !form.txtpass.value)
			{
				alert("Please enter the Password to login");
				form.txtpass.focus();
				return false;
			}
			
		//for non-null entries
		return true;
		}
		
		//*****************************************************************************
		//coded on 10/3/2004
		//validation of the social security number
function chkssn(objname)
{	
	//objname = objfrm.txtssn;
	obj = objname.value;

	olen = obj.length;

	if(olen == 11)
	{
		for(i=0;i<olen;i++)
		{
			val = obj.charAt(i);
			//alert("val = " + val + "And i = " + i);
			if(i != 3 && i != 6)
			{
				//check if the character is not a number
				if(isNaN(val)  || obj.valueOf()<0)
				{
					alert("SSN should be a numeric value");
					
					objname.focus();
					return false;
				}
			}
			if(i == 3 || i == 6)
			{
				//check if the character is not a number
				if(val != "-")
				{
					alert("Enter a valid SSN");
					objname.focus();
					return false;
				}
			}
		}
	}
	else if(olen == 9)
	{
		if(isNaN(obj) || obj.valueOf()<0)
		{
			alert("SSN should be a numeric value");
			objname.focus();
			return false;
		}
		
		//insert the "-" in between
		newval = obj.substr(0,3) + "-" + obj.substr(3,2) + "-" + obj.substr(5,4);
		//alert("newval = " + newval);
			objname.value = newval;
		
	}
	else
	{
		alert("SSN should be a numeric value of 9 digits only");
		objname.focus();
		return false;
	}

return true;
}
		
		//*************************************************************************************
				//*****************************************************************************
		//coded on 10/3/2004
		//validation of the social security number
function chkssn1(objname)
{	
	//objname = objfrm.txtssn;
	obj = objname.value;
	if(obj != "")
	{

	olen = obj.length;

	if(olen == 11)
	{
		for(i=0;i<olen;i++)
		{
			val = obj.charAt(i);
			//alert("val = " + val + "And i = " + i);
			if(i != 3 && i != 6)
			{
				//check if the character is not a number
				if(isNaN(val)  || obj.valueOf()<0)
				{
					alert("SSN should be a numeric value");
					
					objname.focus();
					return false;
				}
			}
			if(i == 3 || i == 6)
			{
				//check if the character is not a number
				if(val != "-")
				{
					alert("Enter a valid SSN");
					objname.focus();
					return false;
				}
			}
		}
	}
	else if(olen == 9)
	{
		if(isNaN(obj) || obj.valueOf()<0)
		{
			alert("SSN should be a numeric value");
			objname.focus();
			return false;
		}
			
		//insert the "-" in between
		newval = obj.substr(0,3) + "-" + obj.substr(3,2) + "-" + obj.substr(5,4);
		//alert("newval = " + newval);
			objname.value = newval;
		}
	else
	{
		alert("SSN should be a numeric value of 9 digits only");
		objname.focus();
		return false;
	}	
	}

return true;
}
		
		//**********************************************
		
		//*****************************************************************************
		//coded on 10/3/2004
		//validation of the social security number
function chkph1(objname)
{	
	//objname = objfrm.txtssn;
	obj = objname.value;

	olen = obj.length;
	 if(olen == "")
		{
			return true;
		}
	else
	{

	if(olen == 12)
	{
		for(i=0;i<olen;i++)
		{
			val = obj.charAt(i);
			//alert("val = " + val + "And i = " + i);
			if(i != 3 && i != 7)
			{
				//check if the character is not a number
				if(isNaN(val)  || obj.valueOf()<0)
				{
					alert("Phno should be a numeric value");
					
					objname.focus();
					return false;
				}
			}
			if(i == 3 || i == 7)
			{
				//check if the character is not a number
				if(val != "-")
				{
					alert("Enter a valid Phno");
					objname.focus();
					return false;
				}
			}
		}
	}
	else if(olen == 10)
	{
		if(isNaN(obj) || obj.valueOf()<0)
		{
			alert("Phno should be a numeric value");
			objname.focus();
			return false;
		}
		
		//insert the "-" in between
		newval = obj.substr(0,3) + "-" + obj.substr(3,3) + "-" + obj.substr(6,4);
		//alert("newval = " + newval);
			objname.value = newval;
		
		
	}
	
	else 
		{
		alert("Telephone number should be a numeric value of 10 digits only");
		objname.focus();
		return false;
		}
	}

return true;
}
		
		//*************************************************************************************
		
		//*****************************************************************************
		//coded on 10/3/2004
		//validation of the social security number
function chkph(objname)
{	
	//objname = objfrm.txtssn;
	obj = objname.value;

	olen = obj.length;

	if(olen == 12)
	{
		for(i=0;i<olen;i++)
		{
			val = obj.charAt(i);
			//alert("val = " + val + "And i = " + i);
			if(i != 3 && i != 7)
			{
				//check if the character is not a number
				if(isNaN(val)  || obj.valueOf()<0)
				{
					alert("Phno should be a numeric value");
					
					objname.focus();
					return false;
				}
			}
			if(i == 3 || i == 7)
			{
				//check if the character is not a number
				if(val != "-")
				{
					alert("Enter a valid Phno");
					objname.focus();
					return false;
				}
			}
		}
	}
	else if(olen == 10)
	{
		if(isNaN(obj) || obj.valueOf()<0)
		{
			alert("Phno should be a numeric value");
			objname.focus();
			return false;
		}
		
		//insert the "-" in between
		newval = obj.substr(0,3) + "-" + obj.substr(3,3) + "-" + obj.substr(6,4);
		//alert("newval = " + newval);
			objname.value = newval;
		
		
	}
	else
	{
		alert("Telephone number should be a numeric value of 10 digits only");
		objname.focus();
		return false;
	}

return true;
}
		
		//*************************************************************************************

		//Coded by Deepa on 26-2-2004 
		//function to check weather agreed for useragreement
		function agreeform(form)
		{		
			//to see weather agreed for agreement
			if(form.agree[0].checked == false)
			{
				alert("Please agree for useragreement to proceed");
				form.agree[0].focus();
				return false;
			}
			
		//for agreeing
		return true;
		}
		
		//*************************************************************************************
		//*************************************************************************************

		//Coded by Deepa on 3/4/2004 
		//function to check weather wish to get information from the previous year
		function previous(form)
		{		
			//to see weather agreed for agreement
			if(form.agree[0].checked == false)
			{
				alert("Please agree to get information from the previous year to proceed");
				form.agree[0].focus();
				return false;
			}
			
			//to check weather entered previous year
			if(form.txtyear.value == "" || !form.txtyear.value)
				{
					alert("Please enter your previous Taxfiled Year");
					form.txtyear.focus();
					return false;
				}
				yearlen = form.txtyear.value;
			if(isNaN(form.txtyear.value) || yearlen.length != 4)
				{
					alert("Year should be a Numeric Value");
					form.txtyear.focus();
					return false;
				}
			
		//for agreeing
		return true;
		}
		
		//*************************************************************************************
		//*************************************************************************************
		//*************************************************************************************

		//Coded by Deepa on 3/4/2004 
		//function to check weather wish to get information from the previous year
		function pasyr(form)
		{		
			
			//to check weather entered previous year
			if(form.txtyear.value == "" || !form.txtyear.value)
				{
					alert("Please enter your previous Taxfiled Year");
					form.txtyear.focus();
					return false;
				}
				yearlen = form.txtyear.value;
			if(isNaN(form.txtyear.value) || yearlen.length != 4)
				{
					alert("Year should be a Numeric Value");
					form.txtyear.focus();
					return false;
				}
				if(form.txtyear.value <1900 || form.txtyear.value >2005)
				{
					dateobj = new Date()
					fyear=dateobj.getFullYear()
					//alert("fyear"+fyear);
					alert("Taxfiling Year should be between 1900 A.D. and "+fyear+" A.D.");
					form.txtyear.value="";
					form.txtyear.focus();
					return false;
				}
			
		//for agreeing
		return true;
		}
		
		//*************************************************************************************		
		
		// coded by deepa on 27/2/2004
		//function to check for userregistration details
		function chkuserreg(form)
		{
		  
		  //check for null values in the first name field
				if(form.txtemail.value=="" || !form.txtemail.value)
				{
					alert("Please enter your Email address");
					form.txtemail.focus();
					return false;
				}
		  
			 //for email validation
				if(form.txtemail.value !="" || form.txtemail.value)
				{
					var str, str1, str2, str3, pos1, pos2;
					str = form.txtemail.value;
					pos1 = str.indexOf("@");
					pos2 = str.indexOf(".");
					if(pos1==-1 || pos2 == -1)
					{
						alert("Please enter a valid Email Address");
						form.txtemail.focus();
						return false
					}
				}
				
				//check for null values in the password field
				if(form.txtpass.value=="" || !form.txtpass.value)
				{
					alert("Please enter the Password");
					form.txtpass.focus();
					return false;
				}
				
				//check for null values in the Confirm password field
				if(form.txtconpass.value=="" || !form.txtconpass.value)
				{
					alert("Please enter the Confirm Password");
					form.txtconpass.focus();
					return false;
				}
				
				//check for confirmpassword value
				if(form.txtconpass.value != form.txtpass.value)
				{
					alert("Confirm Password must be same as Password");
					form.txtconpass.focus();
					return false;
				}
				
				//check for null values in the first name field
				if(form.txtfname.value=="" || !form.txtfname.value)
				{
					alert("Please enter the First Name");
					form.txtfname.focus();
					return false;
				}
				
				//check for null values in the last name field
				if(form.txtlname.value=="" || !form.txtlname.value)
				{
					alert("Please enter the Last Name");
					form.txtlname.focus();
					return false;
				}
				
				//check for null values in the Referredby field
				if(form.txtref.value=="" || !form.txtref.value)
				{
					alert("Please enter the Reffered By");
					form.txtref.focus();
					return false;
				}
				
				//check if a valid referral Email is entered
			/*	if(chkmail(form.txtref) == false)
				{
					alert("Please enter the a valid Referral Email");
					form.txtref.focus();
					return false;
				}
		*/
				//check for null values in the Contact1 value field
				if(form.txtph.value=="" || !form.txtph.value)
				{
					alert("Please enter  your Contact Number");
					form.txtph.focus();
					return false;
				}
				
				//check for valid contact number
			/*	phone = form.txtph.value
				if(phone.length != 10)
				{
					alert("Please enter  your valid Contact Number");
					form.txtph.focus();
					return false;
				}
				*/
				
				//check for null values in the Contact1 value field
				if(form.txtadd.value=="" || !form.txtadd.value)
				{
					alert("Please enter  your Address");
					form.txtadd.focus();
					return false;
				}
				
				//checking for null value in the city field
				
				if(form.txtcity.value=="" || !form.txtcity.value)
				{
					alert("Please enter city name")
					form.txtcity.focus();
					return false;	
				}	
				
				//checking for valid state values
				
				if(form.txtstate.value=="" || !form.txtstate.value)
				{
					alert("Please enter State ")
					form.txtstate.focus();
					return false;	
				}
						
				//checking for null value in the country field
				
				if(form.txtcountry.value=="" || !form.txtcountry.value)
				{
					alert("Please enter country name")
					form.txtcountry.focus();
					return false;	
				}
				//checking for null value in the zip field
				
				if(form.txtzip.value=="" || !form.txtzip.value)
				{
					alert("Please enter zipcode")
					form.txtzip.focus();
					return false;	
				}
				
				//check for valid zip number
				zip= form.txtzip.value;
				if(zip.length != 5)
				{
					alert("Please enter a valid Zipcode");
					form.txtzip.focus();
					return false;
				}
				if(chkph(form.txtph) == false)
					{
						form.txtph.focus();						
						return false;
					}
				
				 return true;
		}
		
		//*************************************************************************************
		// coded by deepa on 28/2/2004
		//changed by Padma on 2/3/2004
		//function to check for personalinformation entering Client details	
		
		function chkperinfo(form,objval)
		{
				//alert("obj=" +objval);
		//check for null values in the first name field
				if(form.txtfname.value=="" || !form.txtfname.value)
				{
					alert("Please enter your First Name");
					form.txtfname.focus();
					return false;
				}			
				
				//check for null values in the last name field
				if(form.txtlname.value=="" || !form.txtlname.value)
				{
					alert("Please enter your Last Name.");
					form.txtlname.focus();
					return false;
				}
				//check for null values in the ssno field
				if(form.txtssno.value=="" || !form.txtssno.value)
				{
					alert("Please enter your SocialSecurity number.");
					form.txtssno.focus();
					return false;
				}
				//check for null values in the dob field
				if(form.txtdob.value=="" || !form.txtdob.value)
				{
					alert("Please enter your date of Birth.");
					form.txtdob.focus();
					return false;
				}	
				//to see weather entered marital status or not
				if(form.marital[0].checked == false && form.marital[1].checked == false)
				{
					alert("Please select your Marital Status");
					form.marital[0].focus();
					return false;
				}
					
			if(objval=="save")
					{
						
						form.btntype.value = objval;						
					}
					
					
				//check for null values in the Contact1 value field
				if(form.txtadd.value=="" || !form.txtadd.value)
				{
					alert("Please enter  your Address");
					form.txtadd.focus();
					return false;
				}
				
				//checking for null value in the city field
				
				if(form.txtcity.value=="" || !form.txtcity.value)
				{
					alert("Please enter city name")
					form.txtcity.focus();
					return false;	
				}	
				
				//checking for valid state values
				
				if(form.txtstate.value=="" || !form.txtstate.value)
				{
					alert("Please enter State ")
					form.txtstate.focus();
					return false;	
				}
				
				//checking for null value in the country field
				
				
				//checking for null value in the zip field
				
				if(form.txtzip.value=="" || !form.txtzip.value)
				{
					alert("Please enter zipcode")
					form.txtzip.focus();
					return false;	
				}
				
				//check if zipcode is a valid one
				ziplen = form.txtzip.value;
				if(isNaN(form.txtzip.value) || ziplen.length !=5)
				{
					alert("Please enter a valid zipcode");
					form.txtzip.focus();
					return false;						
				}
				//check for null values in the Contact1 value field
				if(form.txtoadd.value=="" || !form.txtoadd.value)
				{
					alert("Please enter  your Outside Address");
					form.txtoadd.focus();
					return false;
				}
				
				//checking for null value in the city field
				
				if(form.txtocity.value=="" || !form.txtocity.value)
				{
					alert("Please enter city name")
					form.txtocity.focus();
					return false;	
				}	
				
				//checking for valid state values
				
				if(form.txtostate.value=="" || !form.txtostate.value)
				{
					alert("Please enter State ")
					form.txtostate.focus();
					return false;	
				}
				
				//checking for null value in the country field
				
				
				//checking for null value in the zip field
				
				if(form.txtozip.value=="" || !form.txtozip.value)
				{
					alert("Please enter zipcode")
					form.txtozip.focus();
					return false;	
				}
				
				//check if zipcode is a valid one
				zipleno = form.txtozip.value;
				if(isNaN(form.txtozip.value))
				{
					alert("Please enter a valid zipcode");
					form.txtozip.focus();
					return false;						
				}
		
				//check for null values in the occupation field
		/*		if(form.txtocc.value=="" || !form.txtocc.value)
				{
					alert("Please enter your Occupation.");
					form.txtocc.focus();
					return false;
				}
		*/		
				//check for the validity of the SSN
				ssn = form.txtssno.value;
				ssnlen = ssn.length;
		/*		if(ssnlen != 9)
					{
						alert("Your Social Security number should be a 9-digit numeric value");
						form.txtssno.focus();
						return false;
					}
					
				
				//check if the entered value is numeric
				if(isNaN(ssn) || ssn.valueOf()<0)
					{
						alert("Your Social Security number should be a 9-digit numeric value");
						form.txtssno.focus();
						return false;
					}
			*/		
				//check for valididty of ssn
				if(chkssn(form.txtssno)	==	false)
					return false;
					
				//check for a valid date for date of birth			
				if(checkdate(form.txtdob) == false)
					return false;
					
					
				//check  if the home phone is entered
			//if(form.txthph.value == "" || !form.txthph.value )
			//{	
			//	alert("Please enter your Home Phone");
				//form.txthph.focus();
				//return false;
			//}
			
			//check if email is entered
			if(form.txtusername.value == "" || !form.txtusername.value )
			{	
				alert("Please enter your Email Address");
				form.txtusername.focus();
				return false;
			}
			if(form.cship.value=="" || !form.cship.value)
				{
					alert("Please enter your Citizenship");
					form.cship.focus();
					return false;
				}			
				
			
			//check if phone number is numeric
		/*	phlen = form.txthph.value;
			if(phlen.length != 10)
			{
				alert("Please enter a valid Telephone number");
				form.txthph.focus();
				return false;
			}
			*/
			if(chkph1(form.txthph)	==	false)
				{
				form.txthph.focus()
				return false;
				}
			//check for the validity of the email
			if(chkmail(form.txtusername) == false)
				return false;
				
			if(objval=="save")
					{
						
						form.btntype.value = objval;						
					}
			if(form.txtsemail.value !="")
				{
					var str, str1, str2, str3, pos1, pos2;
					str = form.txtsemail.value;
					pos1 = str.indexOf("@");
					pos2 = str.indexOf(".");
					if(pos1==-1 || pos2 == -1)
					{
						alert("Please enter a valid Email Address");
						form.txtsemail.focus();
						return false
					}
				}
							
					
				if(form.txtsfname.value!= "" || form.txtslname.value!= "" || form.txtsssno.value!="" || 
form.txtsdob.value!="" || form.txtsoccp.value!="")
			{
				//alert("enterin");
				if(form.txtsfname.value=="" || !form.txtsfname.value)
				{
					alert("Please enter your Spouse First Name");
					form.txtsfname.focus();
					return false;
				}
				
			
				//check for null values in the last name field
				if(form.txtslname.value=="" || !form.txtslname.value)
				{
					alert("Please enter your Spouse Last Name.");
					form.txtslname.focus();
					return false;
				}
		
				//check for null values in the ssno field
				if(form.txtsssno.value=="" || !form.txtsssno.value)
				{
					alert("Please enter your Spouse' Social Security number or Tax Identification number.");
					form.txtsssno.focus();
					return false;
				}
				//check for null values in the dob field
				if(form.txtsdob.value=="" || !form.txtsdob.value)
				{
					alert("Please enter your Spouse' date of Birth.");
					form.txtsdob.focus();
					return false;
				}
				
				//check for null values in the occupation field
			/*	if(form.txtocc.value=="" || !form.txtocc.value)
				{
					alert("Please enter your Occupation.");
					form.txtocc.focus();
					return false;
				}
			*/
			
			//check if the entered value is numeric
			ssn = form.txtssno.value;
			/*	if(isNaN(ssn) || ssn.length != 9 || ssn<0)
					{
						alert("Social Security number/Tax Identification number should be a 9-digit numeric value");
						form.txtssno.focus();
						return false;
					}
				*/
				
				//check for valididty of ssn
				//if(chkssn(form.txtsssno)	==	false)
					//return false;
	
				//check for a valid date for date of birth			
				if(checkdate(form.txtsdob) == false)
					return false;
				
			}
				else
					
					return true;
		}
		
		
		//*********************************To check date validity****************************************************
			//check for validity of the date entered in a textbox to be in the mm/dd/yyyy format
			function checkdate(obj)
			{
					//obtaining the server-date
					//alert("obj = " + obj.name + " enteredd date = " + obj.value);
					if(obj.value == "" || !obj.value)
					{
						alert("Please enter a valid Date here");
						obj.focus();
						return false;
					}
					
					//check the number of characters b4 the slash for the month value
					mdate = obj.value;
					pos1 = mdate.indexOf("/");
					//alert("pos1 = " + pos1);
					if(pos1 <=0)
					{
						alert("Please enter a valid date\n\n 'Slash after month is missing'")
						obj.focus();
						return false
					}
					
					//check for the slash after the day value
					
					newdate = mdate.substr(pos1+1);
					//alert("Newdate = " + newdate);
					pos2 = newdate.indexOf("/");
					//alert("Pos2 = " + pos2);
					if(pos2 <=0)
					{
						alert("Please enter a valid date\n\n 'Slash after date is missing'")
						obj.focus();
						return false
					}
					
					//obtain the entered values for month,date & year
					mval1 = mdate.substr(0,pos1);
					dval1 = newdate.substr(0,pos2);
					yval1 = newdate.substr(pos2+1);
					
					if(isNaN(mval1) || isNaN(dval1) ||isNaN(yval1) )
					{
						alert("Please enter a valid Date");
						obj.focus();
						return false;
					}
					
					if(mval1 >12)
					{
						alert("Enter a valid month\n Values should be between 1 - 12")
						obj.focus();
						return false
					}
					if(mval1 == 1 || mval1 == 3 || mval1 == 5 || mval1 == 7 || mval1 == 8 || mval1 == 10 || mval1 == 12)
					{
						if(dval1>31)
							{
								alert("Enter a valid date\n Values should be between 1 - 31");
								obj.focus();
								return false;
							}
					}
					else
					{
							if(dval1>30)
								{
									alert("Enter a valid date\n Values should be between 1 - 30");
									obj.focus();
									return false;
								}
					}
					
					//check for valid year entry & leap years
					if((mval1 == 2) && (dval1 > 28) && (yval1%4 != 0))
					{
						alert("Enter a valid date");
						obj.focus();
						return false;
					}
			
					if((mval1 == 2) && (dval1 > 29) && (yval1%4)==0)
					{
						alert("Enter a valid date");
						obj.focus();
						return false;
					}
					
					//check for the year
					if(yval1.length != 4)
					{
						alert("Enter a valid Year");
						obj.focus();
						return false;
					}
			}

		/*************************************************************************************/
		// coded by deepa on 28/2/2004
		//function to check for residentialinformation entering Client details	
		function chkresinfo(form,objval)
		{
			
				if(objval=="save")
					{						
						form.btntype.value = objval;						
					}
			
				//check for null values in the Contact1 value field
				if(form.txtadd.value=="" || !form.txtadd.value)
				{
					alert("Please enter  your Address");
					form.txtadd.focus();
					return false;
				}
				
				//checking for null value in the city field
				
				if(form.txtcity.value=="" || !form.txtcity.value)
				{
					alert("Please enter city name")
					form.txtcity.focus();
					return false;	
				}	
				
				//checking for valid state values
				
				if(form.txtstate.value=="" || !form.txtstate.value)
				{
					alert("Please enter State ")
					form.txtstate.focus();
					return false;	
				}
				
				//checking for null value in the country field
				
				if(form.txtcountry.value=="" || !form.txtcountry.value)
				{
					alert("Please enter country name")
					form.txtcountry.focus();
					return false;	
				}
				//checking for null value in the zip field
				
				if(form.txtzip.value=="" || !form.txtzip.value)
				{
					alert("Please enter zipcode")
					form.txtzip.focus();
					return false;	
				}
				
				//check if zipcode is a valid one
				ziplen = form.txtzip.value;
				if(isNaN(form.txtzip.value) || ziplen.length !=5)
				{
					alert("Please enter a valid zipcode");
					form.txtzip.focus();
					return false;						
				}
			return true;
		}		
			
			
		//****************************Selectmenu function***********************************
		//function used to highlight an option in a Combo
		function selectmenu(frm,val)
		{
			frm.value = val;
		}

		
		//*************************************************************************************
		//Coded by Deepa on 1/3/2004 
		//function to check weather entered marital status or not
		function maritalform(form,objval)
		{
				//to see weather entered marital status or not
				if(form.marital[0].checked == false && form.marital[1].checked == false && form.marital[2].checked == false)
				{
					alert("Please select your Marital Status");
					form.marital[0].focus();
					return false;
				}
					
			if(objval=="save")
					{
						
						form.btntype.value = objval;						
					}
						
				
				//to see weather entered supported information or not
				//if(form.support[0].checked == false && form.support[1].checked == false && form.support[2].checked == false)
				//{
				//	alert("Please select your Support Status");
				//	form.support[0].focus();
				//	return false;
				//
				//}
				
			//for agreeing
			return true;
		}

		
		//*************************************************************************************
		// coded by deepa on 1/3/2004
		//function to check for spouse information			
		function chkspouseinfo(form)
		{
		//check for null values in the first name field
			if(form.txtsfname.value!= "" || form.txtslname.value!= "" || form.txtsssno.value!="" || 
form.txtsdob.value!="" || form.txtsocc.value!="")
			{
				//alert("enterin");
				if(form.txtsfname.value=="" || !form.txtsfname.value)
				{
					alert("Please enter your First Name");
					form.txtsfname.focus();
					return false;
				}
				
			
				//check for null values in the last name field
				if(form.txtslname.value=="" || !form.txtslname.value)
				{
					alert("Please enter your Last Name.");
					form.txtslname.focus();
					return false;
				}
		
				//check for null values in the ssno field
				if(form.txtsssno.value=="" || !form.txtsssno.value)
				{
					alert("Please enter your Spouse' Social Security number or Tax Identification number.");
					form.txtsssno.focus();
					return false;
				}
				//check for null values in the dob field
				if(form.txtsdob.value=="" || !form.txtsdob.value)
				{
					alert("Please enter your Spouse' date of Birth.");
					form.txtsdob.focus();
					return false;
				}
				
				//check for null values in the occupation field
			/*	if(form.txtocc.value=="" || !form.txtocc.value)
				{
					alert("Please enter your Occupation.");
					form.txtocc.focus();
					return false;
				}
			*/
			
			//check if the entered value is numeric
			ssn = form.txtssno.value;
			/*	if(isNaN(ssn) || ssn.length != 9 || ssn<0)
					{
						alert("Social Security number/Tax Identification number should be a 9-digit numeric value");
						form.txtssno.focus();
						return false;
					}
				*/
				
				//check for valididty of ssn
				//if(chkssn(form.txtsssno)	==	false)
					//return false;
	
				//check for a valid date for date of birth			
				if(checkdate(form.txtsdob) == false)
					return false;
				
			}
			else	
					return true;
		}

		
		//****************************************************************************************************
		// coded by Padma on 2/3/2004
		//function to check for contact information			
		
		
		//*************************************************************************************
		//**************** by Padma on 3-3-2004****************
		//function to validate an email field
		function chkmail(obj)
		{
			var str, str1, str2, str3, pos1, pos2;
			str = obj.value;
			pos1 = str.indexOf("@");
			pos2 = str.indexOf(".");
			if(pos1==-1 || pos2 == -1)
			{
				alert("Please enter a valid Email Address");
				obj.select();
				obj.focus();
				return false;
			}
			else
				return true;
		}
	
		//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to redirect based on the selected dependent entry type
		function chkdependent(form)
		{
				//to see weather entered marital status or not
				if(form.depname[0].checked == true)
					url = "dependentinfo.php";
				else
					url = "w2formpromt.php";

				//redirect to the appropriate location
				form.action = url;
		}
		//*************************************************************************************
		//*************************************************************************************
		//Coded by deepa on 14/3/2004 
		//Code changed by Vimala on 07/12/2004 [To add one more question]
		//function to redirect based on the selected meals information entry type
		function chkmeals(form)
		{
				//to see weather entered mealsinfo or not
				if(form.bsname[0].checked == true)
					url = "multiplemealsinfo_b.php";
				else
					url = "multiplecharityinfo.php";

				//redirect to the appropriate location
				form.action = url;
		}
		//*************************************************************************************
		
		//*************************************************************************************
		//Coded by vimala on 07/12/2004
		//function to redirect based on the selected meals information entry type question b
		function chkmeals_b(form)
		{
				//to see weather entered mealsinfo or not
				if(form.bsname_b[0].checked == true)
					url = "mealsinfo.php";
				else
					url = "mealsinfo.php";

				//redirect to the appropriate location
				form.action = url;
		}
		//*************************************************************************************
		
		//*************************************************************************************
		//Coded by Deepa on 10/3/2004 
		//function to redirect based on the selected dependent entry type
		function chkw2(form)
		{
				//to see weather entered marital status or not
				if(form.deposit[0].checked == true)
					url = "w2forminfo.php";
				else
					url = "1099formpromt.php";

				//redirect to the appropriate location
				form.action = url;
		}
		//*************************************************************************************
		//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to redirect based on the selected dependent entry type
		function chk1099(form)
		{
				//to see weather entered marital status or not
				if(form.deposit[0].checked == true)
					url = "1099info.php";
				else
					url = "schformpromt.php";

				//redirect to the appropriate location
				form.action = url;
		}
		//*************************************************************************************
		//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to redirect based on the selected dependent entry type
		function chksch(form)
		{
				//to see weather entered marital status or not
				if(form.deposit[0].checked == true)
					url = "scheduledform1.php";
				else
					url = "scheduled.php";

				//redirect to the appropriate location
				form.action = url;
		}
		//*************************************************************************************
	
		//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to redirect based on the selected deposit type
		function chkdeposit(form)
		{
				//to see weather entered marital status or not
				if(form.deposit[0].checked == false)
					url = "multipleotherdetails.php";
				else
					url = "bankdetail.php";
				
				//redirect to the appropriate location
				form.action = url;
				
			return true;
		}
		//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to check the proper entry of socialsecurity number
		function chkdep(form)
		{
			val = form.txtfname.value;
			
					//alert("high" + val);
					if(form.txtdfname.value == "" || !form.txtdfname.value)
					{
						alert("Please enter your Dependent First Name");
						form.txtdfname.focus();
						return false;
					}
					
				
					//check for null values in the last name field
					if(form.txtdlname.value=="" || !form.txtdlname.value)
					{
						alert("Please enter your Dependent Last Name.");
						form.txtdlname.focus();
						return false;
					}
				
					
					//check for null values in the ssno field
					if(form.txtdssno.value=="" || !form.txtdssno.value)
						{
							alert("Please enter your Dependent' Social Security number or Tax Identification number.");
							form.txtdssno.focus();
							return false;
						}
					
					ssn = form.txtssno.value;
					
			/*		if(isNaN(ssn) || ssn.length != 9 || ssn<0)
						{
							alert("Social Security number/Tax Identification number should be a 9-digit numeric value");
							form.txtssno.focus();
							return false;
						}
				*/
				
				//check for valididty of ssn
					if(chkssn(form.txtdssno)	==	false)
						return false;
			
						//check for null values in the dob field
					if(form.txtddob.value=="" || !form.txtddob.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txtddob.focus();
						return false;
					}
					
						if(form.txtsemail.value !="")
				{
					var str, str1, str2, str3, pos1, pos2;
					str = form.txtsemail.value;
					pos1 = str.indexOf("@");
					pos2 = str.indexOf(".");
					if(pos1==-1 || pos2 == -1)
					{
						alert("Please enter a valid Email Address");
						form.txtsemail.focus();
						return false
					}
				}
					if(form.cship.value=="" || !form.cship.value)
				{
					alert("Please enter your Citizenship");
					form.cship.focus();
					return false;
				}
					
					if(checkdate(form.txtddob) == false)
						return false;
						
						form.cmdadd.value = "Add";
						form.dep.value = "dep";
				
				return true;
			}
			
		//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to check the proper entry of date in the otherdetails form
		function chkotherdetails(form)
			{
				//check for null values in the txtarrv field
				if(form.txtarrv.value=="" || !form.txtarrv.value)
					{
						alert("Please enter your date of Arrival into US");
						form.txtarrv.focus();
						return false;
					}
					
			//check for null values in the txtfswork field
				if(form.txtfswork.value=="" || !form.txtfswork.value)
					{
						alert("Please enter your Start date of work in US");
						form.txtfswork.focus();
						return false;
					}
					
				//check for null values in the txtcit field
	/*			if(form.txtcit.value=="" || !form.txtcit.value)
					{
						alert("Please enter your Citizenship Country name");
						form.txtcit.focus();
						return false;
					}	
	*/
										
				//check for correct date values in the txtarrv field
				if(form.txtarrv.value!="")
					{
						//check if valid date is entered
						if(checkdate(form.txtarrv) == false)
							return false;
					}
					
			//check for correct date values in the txtfswork field
				if(form.txtfswork.value!="")
					{
						//check if valid date is entered
						if(checkdate(form.txtfswork) == false)
							return false;
					}
					//form.rdpage.value = "";					
				return true;
			}

		//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to redirect based on the selected otherdetails
		function chkwork(form)
		{
				//to see weather entered marital status or not
				if(form.workname[0].checked == true)
					url = "otherdetails.php";
				else
					url = "multipleemployeedetails.php";

				//redirect to the appropriate location
				form.action = url;
		}

//*************************************************************************************
		//Coded by Padma on 3/3/2004 
		//function to check the form for Employment information
		function chkemployeedetails(form)
			{
				form.edetail.value = "edetail";
				//check for null values in the txtename field
				if(form.txtename.value=="" || !form.txtename.value)
					{
						alert("Please enter the Employer name");
						form.txtename.focus();
						return false;
					}


				//check for null values in the txtcity field
				if(form.txtcity.value=="" || !form.txtcity.value)
					{
						alert("Please enter the Work City");
						form.txtcity.focus();
						return false;
					}


				//check for null values in the txtstate field
				if(form.txtstate.value=="" || !form.txtstate.value)
					{
						alert("Please enter the Work state");
						form.txtstate.focus();
						return false;
					}

				//check for null values in the txtrcity field
				if(form.txtrcity.value=="" || !form.txtrcity.value)
					{
						alert("Please enter the Residential City");
						form.txtrcity.focus();
						return false;
					}

				//check for null values in the txtrstate field
				if(form.txtrstate.value=="" || !form.txtrstate.value)
					{
						alert("Please enter the Residential State");
						form.txtrstate.focus();
						return false;
					}

				//check for null values in the txtfdate field
				if(form.txtfdate.value=="" || !form.txtfdate.value)
					{
						alert("Please enter the From Date");
						form.txtfdate.focus();
						return false;
					}

				//check for null values in the txttodate field
				if(form.txttodate.value=="" || !form.txttodate.value)
					{
						alert("Please enter the To Date");
						form.txttodate.focus();
						return false;
					}

				//check for the validity of the dates
				if(checkdate(form.txtfdate) ==false)
					return false;

				//check for the validity of the dates
				if(checkdate(form.txttodate) ==false)
					return false;
				else
				{
					form.optionval.value = "Employeedetails";
					return true;
				}
			}
			
		//*************************************************************************************
		//Coded by deepa on 13/5/2004 
		//function to check the form for Employment information
		function chkexp(form)
			{
			    //check for null values in the txtstate field
				if(form.txtstate.value=="" || !form.txtstate.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate.focus();
						return false;
					}				
				form.oexp.value = "oexp";
				//check for null values in the txtapart field
				if(form.txtapart.value=="" || !form.txtapart.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart.focus();
						return false;
					}
					obj =form.txtapart.value;
					
					//check if it is a valid price
				if(isNaN(form.txtapart.value) || obj.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart.focus();
						return false;
					}
					
					if(form.txtfdate.value=="" || !form.txtfdate.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txtfdate.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate) == false)
						return false;
						
					if(form.txttodate.value=="" || !form.txttodate.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txttodate.focus();
						return false;
					}
					
					if(checkdate(form.txttodate) == false)
						return false;
					
				
			
				//check for null values in the txtbed field
				if(form.txtbed.value=="" || !form.txtbed.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed.focus();
						return false;
					}
					obj1 = form.txtbed.value;

				//check if it is a valid price
				if(isNaN(form.txtbed.value) || obj1.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl.value=="" || !form.txtutl.value)
					{
						alert("Please enter the utilities available in the apartment");
						form.txtutl.focus();
						return false;
					}
					
				
					
					//check for null values in the txtph field
				if(form.txtph.value=="" || !form.txtph.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins.value=="" || !form.txtins.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins.focus();
						return false;
					}
					
				//check if it is a valid price
				ins = form.txtins.value;
				if(isNaN(form.txtins.value) || ins.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins.focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur.value=="" || !form.txtfur.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur.focus();
						return false;
					}
					
				//check if it is a valid price
				fur = form.txtfur.value;
				if(isNaN(form.txtfur.value) || fur.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov.value=="" || !form.txtmov.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov.focus();
						return false;
					}
					
				//check if it is a valid price
				mov = form.txtmov.value;
				if(isNaN(form.txtmov.value) || mov.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur.value=="" || !form.txtrentfur.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr = form.txtrentfur.value;
				if(isNaN(form.txtrentfur.value) || ftr.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry.value=="" || !form.txtdry.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln = form.txtdry.value;
				if(isNaN(form.txtdry.value) || dcln.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty.value=="" || !form.txtcounty.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity.value=="" || !form.txtcity.value)
					{
						alert("Please enter the City & Telephone number");
						form.txtcity.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse = form.reimburse.value;
				if(isNaN(form.reimburse.value) || reimburse.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse.focus();
						return false;
					}
					//check if it is a valid price
				charity = form.charity.value;
				if(isNaN(form.charity.value) || charity.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity.focus();
						return false;
					}
					
					//check if it is a valid price
						//check for null values in the txtcity field
						if(form.expense.value=="" || !form.expense.value)
							{
								alert("Please enter Nature of Expense");
								form.expense.focus();
								return false;
							}
					
						//check for null values in the txtcity field
						if(form.expamt.value=="" || !form.expamt.value)
							{
								alert("Please enter the Amount");
								form.expamt.focus();
								return false;
							}
				amt = form.expamt.value
				if(isNaN(form.expamt.value) || amt.valueOf()<0)
					{
						alert("Expense Amount should be numeric");
						form.expamt.focus();
						return false;
					}
					
						form.optionval.value = "naturexp";
						return true;							
			}
			
		

			
		//*************************************************************************************
		//*************************************************************************************
		//Coded by deepa on 13/5/2004 
		//function to check the form for Employment information
		function chkexp1(form)
			{
					//check for null values in the txtstate field
				if(form.txtstate1.value=="" || !form.txtstate1.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate1.focus();
						return false;
					}
						form.oexp.value = "oexp";
						//check for null values in the txtapart field
				if(form.txtapart1.value=="" || !form.txtapart1.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart1.focus();
						return false;
					}
					obj11 =form.txtapart1.value;
					
					if(form.txtfdate1.value=="" || !form.txtfdate1.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txtfdate1.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate1) == false)
						return false;
						
						if(form.txttodate1.value=="" || !form.txttodate1.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txttodate1.focus();
						return false;
					}
					
					if(checkdate(form.txttodate1) == false)
						return false;
					
				//check if it is a valid price
				if(isNaN(form.txtapart1.value) || obj11.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart1.focus();
						return false;
					}
			
				//check for null values in the txtbed field
				if(form.txtbed1.value=="" || !form.txtbed1.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed1.focus();
						return false;
					}
					obj12 = form.txtbed1.value;

				//check if it is a valid price
				if(isNaN(form.txtbed1.value) || obj11.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed1.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl1.value=="" || !form.txtutl1.value)
					{
						alert("Please enter the utilities available in the apartment");
						form.txtutl1.focus();
						return false;
					}
					
				
					
					//check for null values in the txtph field
				if(form.txtph1.value=="" || !form.txtph1.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph1.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph1.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph1.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins1.value=="" || !form.txtins1.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins1.focus();
						return false;
					}
					
				//check if it is a valid price
				ins1 = form.txtins1.value;
				if(isNaN(form.txtins1.value) || ins1.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins1focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur1.value=="" || !form.txtfur1.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				fur1 = form.txtfur1.value;
				if(isNaN(form.txtfur1.value) || fur1.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur1.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov1.value=="" || !form.txtmov1.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov1.focus();
						return false;
					}
					
				//check if it is a valid price
				mov1 = form.txtmov1.value;
				if(isNaN(form.txtmov1.value) || mov1.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov1.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur1.value=="" || !form.txtrentfur1.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr1 = form.txtrentfur1.value;
				if(isNaN(form.txtrentfur1.value) || ftr1.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur1.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry1.value=="" || !form.txtdry1.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry1.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln1 = form.txtdry1.value;
				if(isNaN(form.txtdry1.value) || dcln1.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry1.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty1.value=="" || !form.txtcounty1.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty1.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity1.value=="" || !form.txtcity1.value)
					{
						alert("Please enter the City & Telephone number");
						form.txtcity1.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse1 = form.reimburse1.value;
				if(isNaN(form.reimburse1.value) || reimburse1.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse1.focus();
						return false;
					}
					//check if it is a valid price
				charity1 = form.charity1.value;
				if(isNaN(form.charity1.value) || charity1.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity1.focus();
						return false;
					}
					
					//check if it is a valid price
						//check for null values in the txtcity field
						if(form.expamt1.value=="" || !form.expamt1.value)
							{
								alert("Please enter the Amount");
								form.expamt1.focus();
								return false;
							}
						//check for null values in the txtcity field
						if(form.expense1.value=="" || !form.expense1.value)
							{
								alert("Please enter the Nature of Expense");
								form.expense1.focus();
								return false;
							}
				amt = form.expamt1.value
				if(isNaN(form.expamt1.value) || amt.valueOf()<0)
					{
						alert("Expense Amount should be numeric");
						form.expamt1.focus();
						return false;
					}
					
						form.optionval.value = "naturexp1";
						return true;							
			}
			
		

			
		//*************************************************************************************
		//*************************************************************************************
		//*************************************************************************************
		//Coded by deepa on 13/5/2004 
		//function to check the form for living information
		function chkninc1(form)
			{
					//check for null values in the txtstate field
				if(form.txtstate1.value=="" || !form.txtstate1.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate1.focus();
						return false;
					}
					
						form.oc.value = "oinc";
						//check for null values in the txtapart field
				if(form.txtapart1.value=="" || !form.txtapart1.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart1.focus();
						return false;
					}
					obj11 =form.txtapart1.value;
					
					if(form.txtfdate1.value=="" || !form.txtfdate1.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txtfdate1.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate1) == false)
						return false;
						
						if(form.txttodate1.value=="" || !form.txttodate1.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txttodate1.focus();
						return false;
					}
					
					if(checkdate(form.txttodate1) == false)
						return false;
					
				//check if it is a valid price
				if(isNaN(form.txtapart1.value) || obj11.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart1.focus();
						return false;
					}
			
				//check for null values in the txtbed field
				if(form.txtbed1.value=="" || !form.txtbed1.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed1.focus();
						return false;
					}
					obj12 = form.txtbed1.value;

				//check if it is a valid price
				if(isNaN(form.txtbed1.value) || obj11.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed1.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl1.value=="" || !form.txtutl1.value)
					{
						alert("Please enter the utilities value in the apartment");
						form.txtutl1.focus();
						return false;
					}
					
				
					
					//check for null values in the txtph field
				if(form.txtph1.value=="" || !form.txtph1.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph1.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph1.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph1.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins1.value=="" || !form.txtins1.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins1.focus();
						return false;
					}
					
				//check if it is a valid price
				ins1 = form.txtins1.value;
				if(isNaN(form.txtins1.value) || ins1.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins1focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur1.value=="" || !form.txtfur1.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				fur1 = form.txtfur1.value;
				if(isNaN(form.txtfur1.value) || fur1.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur1.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov1.value=="" || !form.txtmov1.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov1.focus();
						return false;
					}
					
				//check if it is a valid price
				mov1 = form.txtmov1.value;
				if(isNaN(form.txtmov1.value) || mov1.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov1.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur1.value=="" || !form.txtrentfur1.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr1 = form.txtrentfur1.value;
				if(isNaN(form.txtrentfur1.value) || ftr1.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur1.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry1.value=="" || !form.txtdry1.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry1.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln1 = form.txtdry1.value;
				if(isNaN(form.txtdry1.value) || dcln1.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry1.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty1.value=="" || !form.txtcounty1.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty1.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity1.value=="" || !form.txtcity1.value)
					{
						alert("Please enter the City & Telephone number");
						form.txtcity1.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse1 = form.reimburse1.value;
				if(isNaN(form.reimburse1.value) || reimburse1.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse1.focus();
						return false;
					}
					//check if it is a valid price
				charity1 = form.charity1.value;
				if(isNaN(form.charity1.value) || charity1.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity1.focus();
						return false;
					}
					
					//check if it is a valid price
						//check for null values in the txtcity field
						if(form.incamt1.value=="" || !form.incamt1.value)
							{
								alert("Please enter the Amount");
								form.incamt1.focus();
								return false;
							}
						//check for null values in the txtcity field
						if(form.income1.value=="" || !form.income1.value)
							{
								alert("Please enter the Nature of Income");
								form.income1.focus();
								return false;
							}
				amt = form.incamt1.value
				if(isNaN(form.incamt1.value) || amt.valueOf()<0)
					{
						alert("Expense Amount should be numeric");
						form.incamt1.focus();
						return false;
					}
					
						form.optionval.value = "otherexp1";
						return true;							
			}
//*************************************************************************************
		//*************************************************************************************
		//Coded by deepa on 13/5/2004 
		//function to check the form for Employment information
		function chkninc(form)
			{
				//check for null values in the txtstate field
				if(form.txtstate.value=="" || !form.txtstate.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate.focus();
						return false;
					}				
				
				//check for null values in the txtapart field
				if(form.txtapart.value=="" || !form.txtapart.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart.focus();
						return false;
					}
					obj =form.txtapart.value;
					
					//check if it is a valid price
				if(isNaN(form.txtapart.value) || obj.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart.focus();
						return false;
					}
					
					if(form.txtfdate.value=="" || !form.txtfdate.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txtfdate.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate) == false)
						return false;
						
					if(form.txttodate.value=="" || !form.txttodate.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txttodate.focus();
						return false;
					}
					
					if(checkdate(form.txttodate) == false)
						return false;
					
				
			
				//check for null values in the txtbed field
				if(form.txtbed.value=="" || !form.txtbed.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed.focus();
						return false;
					}
					obj1 = form.txtbed.value;

				//check if it is a valid price
				if(isNaN(form.txtbed.value) || obj1.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl.value=="" || !form.txtutl.value)
					{
						alert("Please enter the utilities available in the apartment");
						form.txtutl.focus();
						return false;
					}
					
				
					
					//check for null values in the txtph field
				if(form.txtph.value=="" || !form.txtph.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins.value=="" || !form.txtins.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins.focus();
						return false;
					}
					
				//check if it is a valid price
				ins = form.txtins.value;
				if(isNaN(form.txtins.value) || ins.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins.focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur.value=="" || !form.txtfur.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur.focus();
						return false;
					}
					
				//check if it is a valid price
				fur = form.txtfur.value;
				if(isNaN(form.txtfur.value) || fur.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov.value=="" || !form.txtmov.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov.focus();
						return false;
					}
					
				//check if it is a valid price
				mov = form.txtmov.value;
				if(isNaN(form.txtmov.value) || mov.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur.value=="" || !form.txtrentfur.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr = form.txtrentfur.value;
				if(isNaN(form.txtrentfur.value) || ftr.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry.value=="" || !form.txtdry.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln = form.txtdry.value;
				if(isNaN(form.txtdry.value) || dcln.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty.value=="" || !form.txtcounty.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity.value=="" || !form.txtcity.value)
					{
						alert("Please enter the City & Telephone number");
						form.txtcity.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse = form.reimburse.value;
				if(isNaN(form.reimburse.value) || reimburse.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse.focus();
						return false;
					}
					//check if it is a valid price
				charity = form.charity.value;
				if(isNaN(form.charity.value) || charity.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity.focus();
						return false;
					}
					
					//check if it is a valid price
						//check for null values in the txtcity field
						if(form.incamt.value=="" || !form.incamt.value)
							{
								alert("Please enter the Amount");
								form.incamt.focus();
								return false;
							}
						//check for null values in the txtcity field
						if(form.income.value=="" || !form.income.value)
							{
								alert("Please enter the Nature of Income");
								form.income.focus();
								return false;
							}
				amt = form.incamt.value
				if(isNaN(form.incamt.value) || amt.valueOf()<0)
					{
						alert("Expense Amount should be numeric");
						form.expamt1.focus();
						return false;
					}
					
						form.optionval.value = "otherexp";
						form.oc.value = "oinc";
						return true;							
			}
			
		

			
		//*************************************************************************************			
		

			
		//*************************************************************************************
		//Coded by Padma on 4/3/2004 
		//function to redirect based on the selected employeedetails
		function chkemp(form)
		{
				//to see weather entered marital status or not
				if(form.empname[0].checked == true)
					url = "employeedetails.php";
				else
					url = "multiplecountrydetails.php";

				//redirect to the appropriate location
				form.action = url;
		}
		
		
//*************************************************************************************
		//Coded by Padma on 4/3/2004 
		//function to check the form for Employment information
		function chkcountrydetails(form)
			{
				
				form.edetail1.value = "edetail1";
				//check for null values in the txtfdate field
				if(form.txtfdate1.value=="" || !form.txtfdate1.value)
					{
						alert("Please enter the From Date");
						form.txtfdate1.focus();
						return false;
					}

				//check for null values in the txttodate field
				if(form.txttodate1.value=="" || !form.txttodate1.value)
					{
						alert("Please enter the To Date");
						form.txttodate1.focus();
						return false;
					}
					
				//check for null values in the txtcountry field
				if(form.txtcountry1.value=="" || !form.txtcountry1.value)
					{
						alert("Please enter the Country you visited");
						form.txtcountry1.focus();
						return false;
					}


				//check for null values in the txtpurpose field
				if(form.txtpurpose.value=="" || !form.txtpurpose.value)
					{
						alert("Please enter the Purpose of your Visit");
						form.txtpurpose.focus();
						return false;
					}
					

				//check for the validity of the dates
				if(checkdate(form.txtfdate1) ==false)
					return false;

				//check for the validity of the dates
				if(checkdate(form.txttodate1) ==false)
					{
					return false;
					}
				else
					{
					form.optionval.value = "Countrydetails";
					form.rdpage.value = "Save";
					return true;	
					}
			}		
			
			
//*************************************************************************************
		//Coded by Padma on 4/3/2004 
		//function to redirect based on the selected employeedetails
		function chktravel(form)
		{
				//to see weather entered marital status or not
				if(form.travelname[0].checked == true)
					url = "countrydetails.php";
				else
					url = "multiplevisadetails.php";

				//redirect to the appropriate location
				form.action = url;
		}
		
		
//*************************************************************************************
		//Coded by Padma on 4/3/2004 
		//function to check the form for Visa information
		function chkvisadetails(form)
			{
				
	/*			if(form.txtarr.value!= "" || form.txtfswork.value!= "" || form.txtcit.value!="")
					{
						//check for null values in the txtarrv field
				if(form.txtarr.value=="" || !form.txtarr.value)
					{
						alert("Please enter your date of Arrival into US");
						form.txtarr.focus();
						return false;
					}
					
			//check for null values in the txtfswork field
				if(form.txtfswork.value=="" || !form.txtfswork.value)
					{
						alert("Please enter your Start date of work in US");
						form.txtfswork.focus();
						return false;
					}
					
				//check for null values in the txtcit field
				if(form.txtcit.value=="" || !form.txtcit.value)
					{
						alert("Please enter your Citizenship Country name");
						form.txtcit.focus();
						return false;
					}	
										
				//check for correct date values in the txtarrv field
				if(form.txtarrv.value!="")
					{
						//check if valid date is entered
						if(checkdate(form.txtarrv) == false)
							return false;
					}
					
			//check for correct date values in the txtfswork field
				if(form.txtfswork.value!="")
					{
						//check if valid date is entered
						if(checkdate(form.txtfswork) == false)
							return false;
					}

					}
			if(form.txtename.value!= "" || form.txtcity.value!= "" || form.txtstate.value!="" || 
form.txtrcity.value!="" || form.txtrstate.value!="" || form.txtfdate.value!="" || form.txttodate.value!="")
					{
						//check for null values in the txtename field
				if(form.txtename.value=="" || !form.txtename.value)
					{
						alert("Please enter the Employer name");
						form.txtename.focus();
						return false;
					}


				//check for null values in the txtcity field
				if(form.txtcity.value=="" || !form.txtcity.value)
					{
						alert("Please enter the Work City");
						form.txtcity.focus();
						return false;
					}


				//check for null values in the txtstate field
				if(form.txtstate.value=="" || !form.txtstate.value)
					{
						alert("Please enter the Work state");
						form.txtstate.focus();
						return false;
					}

				//check for null values in the txtrcity field
				if(form.txtrcity.value=="" || !form.txtrcity.value)
					{
						alert("Please enter the Residential City");
						form.txtrcity.focus();
						return false;
					}

				//check for null values in the txtrstate field
				if(form.txtrstate.value=="" || !form.txtrstate.value)
					{
						alert("Please enter the Residential State");
						form.txtrstate.focus();
						return false;
					}

				//check for null values in the txtfdate field
				if(form.txtfdate.value=="" || !form.txtfdate.value)
					{
						alert("Please enter the From Date");
						form.txtfdate.focus();
						return false;
					}

				//check for null values in the txttodate field
				if(form.txttodate.value=="" || !form.txttodate.value)
					{
						alert("Please enter the To Date");
						form.txttodate.focus();
						return false;
					}

				//check for the validity of the dates
				if(checkdate(form.txtfdate) ==false)
					return false;

				//check for the validity of the dates
				if(checkdate(form.txttodate) ==false)
					return false;
					}
				if(form.txtdate.value!= "" || form.txtcountry.value!= "" || form.txttype.value!="" || 
form.txtcnum.value!="")
					{
		*/
				
						form.edetail2.value = "edetail2";
						//check for null values in the txtdate field
						if(form.txtvdate.value=="" || !form.txtvdate.value)
							{
								alert("Please enter the Date Of Issue");
								form.txtvdate.focus();
								return false;
							}
					
						//check for null values in the txtcountry field
						if(form.txtvcountry.value=="" || !form.txtvcountry.value)
							{
								alert("Please enter the Place of Issue");
								form.txtvcountry.focus();
								return false;
							}
		
		
						//check for null values in the txttype field
						if(form.txttype.value=="" || !form.txttype.value)
							{
								alert("Please enter the Type Of Visa obtained");
								form.txttype.focus();
								return false;
							}
		
						//check for null values in the txtcnum field
						if(form.txtcnum.value=="" || !form.txtcnum.value)
							{
								alert("Please enter the Control Number");
								form.txtcnum.focus();
								return false;
							}
		
						//check for the validity of the dates
						if(checkdate(form.txtvdate) ==false)
							return false;
						else
						{
						form.optionval.value = "Visadetails";
						return true;
						}	
			}		
			
			
//*************************************************************************************
		//Coded by Padma on 4/3/2004 
		//function to redirect based on the selected visadetails
		function chkvisa(form)
		{
				//to see weather entered marital status or not
				if(form.visaname[0].checked == true)
					url = "visadetails.php";
				else
					url = "multipleapartmentdetails.php";

				//redirect to the appropriate location
				form.action = url;
		}					
//*************************************************************************************
		//Coded by Padma on 4/3/2004 
		//function to redirect based on the selected employeedetails
		function chkapart(form)
		{
				//to see weather another apartment info is to be entered or not
				if(form.apartname[0].checked == true)
					url = "livingexpenses.php";
				else
					url = "multipleliving.php";

				//redirect to the appropriate location
				form.action = url;
		}
		
//*************************************************************************************
		//Coded by Deepa on 11/5/2004 
		//function to check the form for living expenses
		function chklivingapt(form)
			{
				//check for null values in the txtstate field
				if(form.txtstate.value=="" || !form.txtstate.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate.focus();
						return false;
					}				
				
				//check for null values in the txtapart field
				if(form.txtapart.value=="" || !form.txtapart.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart.focus();
						return false;
					}
					obj =form.txtapart.value;
					
					//check if it is a valid price
				if(isNaN(form.txtapart.value) || obj.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart.focus();
						return false;
					}
					
					
								
					
					if(form.txtfdate.value=="" || !form.txtfdate.value)
					{
						alert("Please enter From date.");
						form.txtfdate.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate) == false)
						return false;
						
					if(form.txttodate.value=="" || !form.txttodate.value)
					{
						alert("Please enter To date.");
						form.txttodate.focus();
						return false;
					}
					
					if(checkdate(form.txttodate) == false)
						return false;
					
				
			
				//check for null values in the txtbed field
				if(form.txtbed.value=="" || !form.txtbed.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed.focus();
						return false;
					}
					obj1 = form.txtbed.value;

				//check if it is a valid price
				if(isNaN(form.txtbed.value) || obj1.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl.value=="" || !form.txtutl.value)
					{
						alert("Please enter the utilities value in the apartment");
						form.txtutl.focus();
						return false;
					}
					
					obju =form.txtutl.value;
					
					//check if it is a valid price
				if(isNaN(form.txtutl.value) || obju.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Utility");
						form.txtutl.focus();
						return false;
					}
					
					//check for null values in the txtph field
				if(form.txtph.value=="" || !form.txtph.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins.value=="" || !form.txtins.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins.focus();
						return false;
					}
					
				//check if it is a valid price
				ins = form.txtins.value;
				if(isNaN(form.txtins.value) || ins.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins.focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur.value=="" || !form.txtfur.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur.focus();
						return false;
					}
					
				//check if it is a valid price
				fur = form.txtfur.value;
				if(isNaN(form.txtfur.value) || fur.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov.value=="" || !form.txtmov.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov.focus();
						return false;
					}
					
				//check if it is a valid price
				mov = form.txtmov.value;
				if(isNaN(form.txtmov.value) || mov.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur.value=="" || !form.txtrentfur.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr = form.txtrentfur.value;
				if(isNaN(form.txtrentfur.value) || ftr.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry.value=="" || !form.txtdry.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln = form.txtdry.value;
				if(isNaN(form.txtdry.value) || dcln.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty.value=="" || !form.txtcounty.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity.value=="" || !form.txtcity.value)
					{
						alert("Please enter the City");
						form.txtcity.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse = form.reimburse.value;
				if(isNaN(form.reimburse.value) || reimburse.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse.focus();
						return false;
					}
					//check if it is a valid price
				charity = form.charity.value;
				if(isNaN(form.charity.value) || charity.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity.focus();
						return false;
					}
					
					//check if it is a valid price
				expamt = form.expamt.value;
				if(isNaN(form.expamt.value) || expamt.valueOf()<0)
					{
						alert("Other Expenses charges should be numeric");
						form.expamt.focus();
						return false;
					}
					
					//check if it is a valid price
				incamt = form.incamt.value;
				if(isNaN(form.incamt.value) || incamt.valueOf()<0)
					{
						alert("Other income charges should be numeric");
						form.incamt.focus();
						return false;
					}
					
					//check if it is a valid price
				pprice = form.pprice.value;
				if(isNaN(form.pprice.value) || pprice.valueOf()<0)
					{
						alert("Purchase Price should be numeric");
						form.pprice.focus();
						return false;
					}
					//check if it is a valid price
				finamt = form.finamt.value;
				if(isNaN(form.finamt.value) || finamt.valueOf()<0)
					{
						alert("Finance Amount should be numeric");
						form.finamt.focus();
						return false;
					}
					
				//check if it is a valid price
				fincharges = form.fincharges.value;
				if(isNaN(form.fincharges.value) || fincharges.valueOf()<0)
					{
						alert("Finance charges should be numeric");
						form.fincharges.focus();
						return false;
					}
					
					//check if it is a valid price
				retax = form.rtax.value;
				if(isNaN(form.rtax.value) || retax.valueOf()<0)
					{
						alert("Real estate tax charges should be numeric");
						form.rtax.focus();
						return false;
					}
					
					//check if it is a valid price
				namt = form.namt.value;
				if(isNaN(form.namt.value) || namt.valueOf()<0)
					{
						alert("Other expenses charges should be numeric");
						form.namt.focus();
						return false;
					}
					
			if(form.txtapart1.value!= "" || form.txtbed1.value!= "" || form.txtutl1.value!="" || 
form.txtstate1.value!="" || form.txtph1.value!=""|| form.txtins1.value!= "" || form.txtfur1.value!="" || 
form.txtmov1.value!="" || form.txtrentfur1.value!=""|| form.txtdry1.value!= "" || form.txtcounty1.value!="" || 
form.txtcity1.value!="" || form.reimburse1.value!=""|| form.charity1.value!= "" || form.expamt1.value!="" || 
form.incamt1.value!="" || form.pprice1.value!=""|| form.finamt1.value!= "" || form.fincharges1.value!="" || 
form.retax1.value!="" || form.namt1.value!="")
			{
			
					//check for null values in the txtstate field
				if(form.txtstate1.value=="" || !form.txtstate1.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate1.focus();
						return false;
					}
					
						//check for null values in the txtapart field
				if(form.txtapart1.value=="" || !form.txtapart1.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart1.focus();
						return false;
					}
					obj11 =form.txtapart1.value;
					
					if(form.txtfdate1.value=="" || !form.txtfdate1.value)
					{
						alert("Please enter From date.");
						form.txtfdate1.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate1) == false)
						return false;
						
						if(form.txttodate1.value=="" || !form.txttodate1.value)
					{
						alert("Please enter To date.");
						form.txttodate1.focus();
						return false;
					}
					
					if(checkdate(form.txttodate1) == false)
						return false;
					
				//check if it is a valid price
				if(isNaN(form.txtapart1.value) || obj11.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart1.focus();
						return false;
					}
			
				//check for null values in the txtbed field
				if(form.txtbed1.value=="" || !form.txtbed1.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed1.focus();
						return false;
					}
					obj12 = form.txtbed1.value;

				//check if it is a valid price
				if(isNaN(form.txtbed1.value) || obj11.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed1.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl1.value=="" || !form.txtutl1.value)
					{
						alert("Please enter the utilities available in the apartment");
						form.txtutl1.focus();
						return false;
					}
				
					obju1 =form.txtutl1.value;
					
					//check if it is a valid price
				if(isNaN(form.txtutl1.value) || obju1.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Utility");
						form.txtutl1.focus();
						return false;
					}
					
					
				
					
					//check for null values in the txtph field
				if(form.txtph1.value=="" || !form.txtph1.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph1.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph1.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph1.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins1.value=="" || !form.txtins1.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins1.focus();
						return false;
					}
					
				//check if it is a valid price
				ins1 = form.txtins1.value;
				if(isNaN(form.txtins1.value) || ins1.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins1focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur1.value=="" || !form.txtfur1.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				fur1 = form.txtfur1.value;
				if(isNaN(form.txtfur1.value) || fur1.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur1.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov1.value=="" || !form.txtmov1.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov1.focus();
						return false;
					}
					
				//check if it is a valid price
				mov1 = form.txtmov1.value;
				if(isNaN(form.txtmov1.value) || mov1.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov1.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur1.value=="" || !form.txtrentfur1.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr1 = form.txtrentfur1.value;
				if(isNaN(form.txtrentfur1.value) || ftr1.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur1.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry1.value=="" || !form.txtdry1.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry1.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln1 = form.txtdry1.value;
				if(isNaN(form.txtdry1.value) || dcln1.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry1.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty1.value=="" || !form.txtcounty1.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty1.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity1.value=="" || !form.txtcity1.value)
					{
						alert("Please enter the City");
						form.txtcity1.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse1 = form.reimburse1.value;
				if(isNaN(form.reimburse1.value) || reimburse1.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse1.focus();
						return false;
					}
					//check if it is a valid price
				charity1 = form.charity1.value;
				if(isNaN(form.charity1.value) || charity1.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity1.focus();
						return false;
					}
					
					//check if it is a valid price
				expamt1 = form.expamt1.value;
				if(isNaN(form.expamt1.value) || expamt1.valueOf()<0)
					{
						alert("Other Expenses charges should be numeric");
						form.expamt1.focus();
						return false;
					}
					
					//check if it is a valid price
				incamt1 = form.incamt1.value;
				if(isNaN(form.incamt1.value) || incamt1.valueOf()<0)
					{
						alert("Other income charges should be numeric");
						form.incamt1.focus();
						return false;
					}
					
					//check if it is a valid price
				pprice1 = form.pprice1.value;
				if(isNaN(form.pprice1.value) || pprice1.valueOf()<0)
					{
						alert("Purchase Price should be numeric");
						form.pprice1.focus();
						return false;
					}
					//check if it is a valid price
				finamt1 = form.finamt1.value;
				if(isNaN(form.finamt1.value) || finamt1.valueOf()<0)
					{
						alert("Finance Amount should be numeric");
						form.finamt1.focus();
						return false;
					}
					
				//check if it is a valid price
				fincharges1 = form.fincharges1.value;
				if(isNaN(form.fincharges1.value) || fincharges1.valueOf()<0)
					{
						alert("Finance charges should be numeric");
						form.fincharges1.focus();
						return false;
					}
					
					//check if it is a valid price
				retax1 = form.retax1.value;
				if(isNaN(form.retax1.value) || retax1.valueOf()<0)
					{
						alert("Real estate tax charges should be numeric");
						form.retax1.focus();
						return false;
					}
					
					//check if it is a valid price
				namt1 = form.namt1.value;
				if(isNaN(form.namt1.value) || namt1.valueOf()<0)
					{
						alert("Other expenses charges should be numeric");
						form.namt1.focus();
						return false;
					}
				}								
			return true;
			}	
			
//*************************************************************************************
		/*
		//function to give alert for Livingexpenses if state 2 is not entered.
		function chklivingstate(livingid)
		{
				//to see weather entered marital status or not
				//if(form.livingname[0].checked == true)
					//url = "livingexpenses2.php?newstate=true";
				//else
					//url = "businessexp.php";
				if(livingid == "0")
				{
					url = "livingexp.php?newformval=true&livid=0";
					
				}
				else
				{
					alert("First fill state2 details");
					url = "livingexp.php";
					//return false;
				}
				//redirect to the appropriate location
				return true;
				form.action = url;
		}*/

		//Coded by Padma on 4/3/2004 
		//function to redirect based on the selected option
		function chkliving(form)
		{
				//to see weather entered marital status or not
				if(form.livingname[0].checked == true)
					url = "livingexpenses2.php?newstate=true";
				else
					url = "businessexp.php";

				//redirect to the appropriate location
				form.action = url;
		}	

//*************************************************************************************
				//Coded by deepa on 6/4/2004 
		//function to redirect based on the selected option
		function chkliving1(form)
		{
				//to see weather entered marital status or not
				if(form.livingname[0].checked == true)
					url = "livingexp.php?newstate=true";
				else
					url = "businessexp.php";

				//redirect to the appropriate location
				form.action = url;
		}
//*************************************************************************************
		//Coded by deepa on 14/3/2004 
		//function to redirect based on the selected option
		function chkcharity(form)
		{
				
					url = "accbusinessexp.php";

				//redirect to the appropriate location
				form.action = url;
		}	

//*************************************************************************************
					

//*************************************************************************************
		//Coded by Deepa on 4/3/2004 
		//function to check for the field values in schedule form
		
		function chkscheduled(form)
		{
			if(form.txtod.value == "" || !form.txtod.value)
				{
					alert("Please enter your Total ordinary dividends");
					form.txtod.focus();
					return false;
				}
			//check if the entered value is numeric
			obj = form.txtod.value;
			ordiv = form.txtod.value;
				if(isNaN(ordiv) || obj.valueOf()<0)
					{
						alert("Your Total ordinary dividends should be a numeric value");
						form.txtod.focus();
						return false;
					}
			if(form.txtqdiv.value == "" || !form.txtqdiv.value)
				{
					alert("Please enter your Qualified dividends");
					form.txtqdiv.focus();
					return false;
				}
			qdiv = form.txtqdiv.value;
			
			if(isNaN(qdiv) || qdiv<0)
				{
					alert("Your Qualified dividends should be a numeric value");
					form.txtqdiv.focus();
					return false;
				}
			if(form.txtfid.value == "" || !form.txtfid.value)
				{
					alert("Please enter your Federal ID No");
					form.txtfid.focus();
					return false;
				}
			if(form.txtcapgain.value == "" || !form.txtcapgain.value)
				{
					alert("Please enter your capital gain distribution");
					form.txtcapgain.focus();
					return false;
				}
				capgain = form.txtcapgain.value;
			if(isNaN(capgain) || capgain.valueOf()<0)
				{
					alert("Your capital gain distribution should be a numeric value");
					form.txtcapgain.focus();
					return false;
				}
			if(form.txt5cap.value == "" || !form.txt5cap.value)
				{
					alert("Please enter your 5-Yr qualified gain");
					form.txt5cap.focus();
					return false;
				}
				capgain1 = form.txt5cap.value;
			if(isNaN(capgain1) || capgain1.valueOf()<0)
				{
					alert("Your capital gain distribution should be a numeric value");
					form.txt5cap.focus();
					return false;
				}
				
				
			if(form.txt5yr.value == "" || !form.txt5yr.value)
				{
					alert("Please enter your 5-Yr qualified gain");
					form.txt5yr.focus();
					return false;
				}
			fyr = form.txt5yr.value;
			if(isNaN(fyr) || fyr.valueOf()<0)
				{
					alert("Your capital post gain distribution should be a numeric value");
					form.txt5yr.focus();
					return false;
				}
			if(form.txtsec1250.value == "" || !form.txtsec1250.value)
				{
					alert("Please enter your qualified 5-yr gain");
					form.txtsec1250.focus();
					return false;
				}
				sec1250 = form.txtsec1250.value;
			if(isNaN(sec1250) || sec1250.valueOf()<0)
				{
					alert("Your Section 1250 gain should be a numeric value");
					form.txtsec1250.focus();
					return false;
				}
			if(form.txtrname.value == "" || !form.txtrname.value)
				{
					alert("Please enter your Recipients name");
					form.txtrname.focus();
					return false;
				}
			if(form.txtsec.value == "" || !form.txtsec.value)
				{
					alert("Please enter your Section 1202 gain");
					form.txtsec.focus();
					return false;
				}
				sec = form.txtsec.value;
			if(isNaN(sec) || sec.valueOf()<0)
				{
					alert("Your Section 1202 gain should be a numeric value");
					form.txtsec.focus();
					return false;
				}
			if(form.txtcoll.value == "" || !form.txtcoll.value)
				{
					alert("Please enter your Collectibles name");
					form.txtcoll.focus();
					return false;
				}
				coll = form.txtcoll.value;
			if(isNaN(coll) || coll.valueOf()<0)
				{
					alert("Your collectibles gain distribution should be a numeric value");
					form.txtcoll.focus();
					return false;
				}
			if(form.txtnontax.value == "" || !form.txtnontax.value)
				{
					alert("Please enter your Nontaxable distributions");
					form.txtnontax.focus();
					return false;
				}
				nontax = form.txtnontax.value;
			if(isNaN(nontax) || nontax.valueOf()<0)
				{
					alert("Your Nontax distribution should be a numeric value");
					form.txtnontax.focus();
					return false;
				}
			if(form.txtfedtax.value == "" || !form.txtfedtax.value)
				{
					alert("Please enter your Federal income tax withheld");
					form.txtfedtax.focus();
					return false;
				}
				fedtax = form.txtfedtax.value;
			if(isNaN(fedtax) || fedtax.valueOf()<0)
				{
					alert("Your Fedral income tax withheld amount should be a numeric value");
					form.txtfedtax.focus();
					return false;
				}
			if(form.txtadd.value == "" || !form.txtadd.value)
				{
					alert("Please enter your Address");
					form.txtadd.focus();
					return false;
				}
			if(form.txtinvexp.value == "" || !form.txtinvexp.value)
				{
					alert("Please enter your investment expenses");
					form.txtinvexp.focus();
					return false;
				}
				invexp = form.txtinvexp.value;
			if(isNaN(invexp) || invexp.valueOf()<0)
				{
					alert("Your Investment Expenses should be a numeric value");
					form.txtinvexp.focus();
					return false;
				}
			if(form.txtcity.value == "" || !form.txtcity.value)
				{
					alert("Please enter your City name");
					form.txtcity.focus();
					return false;
				}
			
			if(form.txtftax.value == "" || !form.txtftax.value)
				{
					alert("Please enter your Foriegn tax paid");
					form.txtftax.focus();
					return false;
				}
				ftax = form.txtftax.value;
			if(isNaN(ftax) || ftax.valueOf()<0)
				{
					alert("Your Foriegn Tax paid should be a numeric value");
					form.txtftax.focus();
					return false;
				}
			if(form.txtforcoun.value == "" || !form.txtforcoun.value)
				{
					alert("Please enter your Foriegn country or U.S. possession");
					form.txtforcoun.focus();
					return false;
				}
				forcount = form.txtforcoun.value;
			if(isNaN(forcount) || forcount.valueOf()<0)
				{
					alert("Your U.S. possession distribution should be a numeric value");
					form.txtforcoun.focus();
					return false;
				}
			if(form.txtstate.value == "" || !form.txtstate.value)
				{
					alert("Please enter your State name");
					form.txtstate.focus();
					return false;
				}
			if(form.txtzip.value == "" || !form.txtzip.value)
				{
					alert("Please enter Zipcode");
					form.txtzip.focus();
					return false;
				}
				zip = form.txtzip.value
			if(isNaN(form.txtzip.value) || zip.valueOf()<0)
				{
					alert("Zipcode must be numeric");
					form.txtzip.focus();
					return false;
				}
			
			
			if(form.txtcash.value == "" || !form.txtcash.value)
				{
					alert("Please enter your cash liquidation distributions");
					form.txtcash.focus();
					return false;
				}
				cash = form.txtcash.value;
			if(isNaN(cash) || cash.valueOf()<0)
				{
					alert("Your cash Liquidation distribution should be a numeric value");
					form.txtcash.focus();
					return false;
				}
				
			if(form.txtnoncash.value == "" || !form.txtnoncash.value)
				{
					alert("Please enter your Noncash liquidation distributions");
					form.txtnoncash.focus();
					return false;
				}
				noncash = form.txtnoncash.value;
			if(isNaN(noncash) || noncash.valueOf()<0)
				{
					alert("Your Noncash Liquidation distribution should be a numeric value");
					form.txtnoncash.focus();
					return false;
				}
					
			return true;	
		}
//**************************************to check 1099info page**********************************************************
//					          coded by deepa on 4/3/2004
//					function to check for the null values in the form field

			function chk1099info(form)
				{	
					if(form.txtfid.value == "" || !form.txtfid.value)
						{
							alert("Please enter your Federal ID No");
							form.txtfid.focus();
							return false;
						}
					if(form.txtrname.value == "" || !form.txtrname.value)
						{
							alert("Please enter your Recipients name");
							form.txtrname.focus();
							return false;
						}
					if(form.txtrid.value == "" || !form.txtrid.value)
						{
							alert("Please enter your Resipients ID No");
							form.txtrid.focus();
							return false;
						}
					if(form.txtacno.value == "" || !form.txtacno.value)
						{
							alert("Please enter your Account number");
							form.txtacno.focus();
							return false;
						}
					if(form.txtadd.value == "" || !form.txtadd.value)
						{
							alert("Please enter your Address");
							form.txtadd.focus();
							return false;
						}
					if(form.txtcity.value == "" || !form.txtcity.value)
						{
							alert("Please enter your City name");
							form.txtcity.focus();
							return false;
						}
					if(form.txtstate.value == "" || !form.txtstate.value)
						{
							alert("Please enter your State name");
							form.txtstate.focus();
							return false;
						}
					if(form.txtzip.value == "" || !form.txtzip.value)
						{
							alert("Please enter your city Zipcode");
							form.txtzip.focus();
							return false;
						}
						zip = form.txtzip.value;
					if(isNaN(form.txtzip.value) || zip.valueOf()<0)
						{
							alert("Zipcode must be numeric");
							form.txtzip.focus();
							return false;
						}
			
					
						rent =  form.txtrent.value;
						if(isNaN(form.txtrent.value) || rent.valueOf()<0)
							{
								alert("Your income from rent must be Numeric");
								form.txtrent.focus();
								return false;
							}
			
					
					
						royalty = form.txtroyalty.value;
						if(isNaN(form.txtroyalty.value) || royalty.valueOf()<0)
							{
								alert("Your Income from Royalty must be in Numeric value");
								form.txtroyalty.focus();
								return false;
							}
			
						inc = form.txtincome.value;
						if(isNaN(form.txtincome.value) || inc.valueOf()<0)
							{
								alert("Your Income from Other's must be in Numeric value");
								form.txtincome.focus();
								return false;
							}
					
					
						ftax = form.txtfedtax.value;
						if(isNaN(form.txtfedtax.value) || ftax.valueOf()<0)
							{
								alert("Your Income from Federal tax withheld must be in Numeric value");
								form.txtfedtax.focus();
								return false;
							}
					
						med = form.txtmed.value;
						if(isNaN(form.txtmed.value) || med.valueOf()<0)
							{
								alert("Your Income from Medicalcarepayment must be in Numeric value");
								form.txtmed.focus();
								return false;
							}
							boat = form.txtboat.value;
							if(isNaN(form.txtboat.value) || boat.valueOf()<0)
							{
								alert("Your Income from Boat Proceeds must be in Numeric value");
								form.txtboat.focus();
								return false;
							}
						
					
						comp = form.txtcomp.value;
						if(isNaN(form.txtcomp.value) || comp.valueOf()<0)
							{
								alert("Your Income from Compensation must be in Numeric value");
								form.txtcomp.focus();
								return false;
							}
					
						pmt = form.txtpmt.value;
						if(isNaN(form.txtpmt.value) || pmt.valueOf()<0)
							{
								alert("Your Income from Dividend must be in Numeric value");
								form.txtpmt.focus();
								return false;
							}
					
					
					
						att = form.txtattorney.value;
						if(isNaN(form.txtattorney.value) || att.valueOf()<0)
							{
								alert("Your Attorney Pay must be in Numeric value");
								form.txtattorney.focus();
								return false;
							}
							crop = form.txtcrop.value;
							if(isNaN(form.txtcrop.value) || crop.valueOf()<0)
							{
								alert("The amount of Your Crop Insurance must be in Numeric value");
								form.txtcrop.focus();
								return false;
							}
							gold = form.txtgold.value;
							if(isNaN(form.txtgold.value) || gold.valueOf()<0)
							{
								alert("Your Golden Payments must be in Numeric value");
								form.txtgold.focus();
								return false;
							}
							oth = form.txtother.value;
							if(isNaN(form.txtother.value) || oth.valueOf()<0)
							{
								alert("Your Income from Other's must be in Numeric value");
								form.txtother.focus();
								return false;
							}
				
						stax = form.txtstax.value;
						if(isNaN(form.txtstax.value) || stax.valueOf()<0)
							{
								alert("Your State tax withheld withheld must be in Numeric value");
								form.txtstax.focus();
								return false;
							}
				
				
						sinc = form.txtsincome.value;
						if(isNaN(form.txtsincome.value) || sinc.valueOf()<0 )
							{
								alert("Your  State Income must be in Numeric value");
								form.txtsincome.focus();
								return false;
							}					
					return true;
				}
	//**************************function to w2form information*************************
	//*******************coded by deepa on 5/3/2004****************************
	
	function chkw2info(form)
	{
	
	/*
		
		if(form.txtid.value == "" || !form.txtid.value)
						{
							alert("Please enter your Employee ID No");
							form.txtid.focus();
							return false;
						}
						*/
						eid = form.txtid.value;
						if(isNaN(form.txtid.value) || eid.valueOf()<0)
							{
								alert("Your  EmployeeId must be in Numeric value");
								form.txtid.focus();
								return false;
							}
						
		if(form.txtwage.value == "" || !form.txtwage.value)
						{
							alert("Please enter your Wages,tips & other compensation");
							form.txtwage.focus();
							return false;
						}
						wage =  form.txtwage.value;
						if(isNaN(form.txtwage.value) || wage.valueOf()<0)
							{
								alert("Your  Wages,tips and other compensation must be in Numeric value");
								form.txtwage.focus();
								return false;
							}
		
	/*	if(form.txtftax.value == "" || !form.txtftax.value)
				{
					alert("Please enter your Foriegn tax paid");
					form.txtftax.focus();
					return false;
				}
				*/
				ftax = form.txtftax.value;
				if(isNaN(form.txtftax.value) || ftax.valueOf()<0)
							{
								alert("Your  Foreign Tax Paid Numeric value");
								form.txtftax.focus();
								return false;
							}
		if(form.txtname.value == "" || !form.txtname.value)
						{
							alert("Please enter your Employer Name");
							form.txtname.focus();
							return false;
						}
		if(form.txtsswage.value=="" || !form.txtsswage.value)
				{
					alert("Please enter your Social Security Wages.");
					form.txtsswage.focus();
					return false;
				}
				sswage = form.txtsswage.value;
				if(isNaN(form.txtsswage.value) || sswage.valueOf()<0)
							{
								alert("Your  income from socialsecurity wages must be in Numeric value");
								form.txtsswage.focus();
								return false;
							}
		if(form.txtsstax.value=="" || !form.txtsstax.value)
				{
					alert("Please enter your Social Security Tax withheld");
					form.txtsstax.focus();
					return false;
				}
				sstax = form.txtsstax.value;
				if(isNaN(form.txtsstax.value) || sstax.valueOf()<0 )
							{
								alert("Your  SocialSecurity tax withheld must be in Numeric value");
								form.txtsstax.focus();
								return false;
							}
							
	/*	if(form.txtadd.value == "" || !form.txtadd.value)
						{
							alert("Please enter your Employer's Address");
							form.txtadd.focus();
							return false;
						} */
		if(form.txtmed.value=="" || !form.txtmed.value)
				{
					alert("Please enter your Medical Wages and tips");
					form.txtmed.focus();
					return false;
				}
				md = form.txtmed.value;
				if(isNaN(form.txtmed.value) || md.valueOf()<0)
							{
								alert("Your  income from Medical wages must be in Numeric value");
								form.txtmed.focus();
								return false;
							}
		if(form.txtmedtax.value=="" || !form.txtmedtax.value)
				{
					alert("Please enter your Medical Tax withheld.");
					form.txtmedtax.focus();
					return false;
				}
				medtax = form.txtmedtax.value;
				if(isNaN(form.txtmedtax.value) || medtax.valueOf()<0)
							{
								alert("Your  Medical Tax must be in Numeric");
								form.txtmedtax.focus();
								return false;
							}
							/*
		if(form.txtzip.value == "" || !form.txtzip.value)
						{
							alert("Please enter your Employer's Zipcode");
							form.txtzip.focus();
							return false;
						}
						*/
						zip =form.txtzip.value;
						if(isNaN(form.txtzip.value) || zip.valueOf()<0)
							{
								alert("Employers  Zipcode must be in Numeric");
								form.txtzip.focus();
								return false;
							}
	/*	if(form.txtsst.value=="" || !form.txtsst.value)
				{
					alert("Please enter your Social Security Tips");
					form.txtsst.focus();
					return false;
				}
				*/
				sst = form.txtsst.value;
				if(isNaN(form.txtsst.value) || sst.valueOf()<0)
							{
								alert("Your  Social Security tips must be in Numeric ");
								form.txtsincome.focus();
								return false;
							}
	/*	if(form.txtalltips.value=="" || !form.txtalltips.value)
				{
					alert("Please enter your Allocated Tips");
					form.txtalltips.focus();
					return false;
				}
				*/
				atips = form.txtalltips.value;
				if(isNaN(form.txtalltips.value) || atips.valueOf()<0)
							{
								alert("Your  Allocated Tips Income must be in Numeric");
								form.txtalltips.focus();
								return false;
							}
		
		
		if(form.txtssn.value=="" || !form.txtssn.value)
				{
					alert("Please enter your Social Security number or Tax Identification number.");
					form.txtssn.focus();
					return false;
				}
				//check for valididty of ssn
				if(chkssn(form.txtssn)	==	false)
					return false;
					
		/* if(form.txteic.value=="" || !form.txteic.value)
				{
					alert("Please enter your Advanced EIC payment.");
					form.txteic.focus();
					return false;
				}
				*/
				eic = form.txteic.value;
				if(isNaN(form.txteic.value) || eic.valueOf()<0)
							{
								alert("Your  EIC Payment must be in Numeric ");
								form.txteic.focus();
								return false;
							}
	/*	if(form.txtdep.value=="" || !form.txtdep.value)
				{
					alert("Please enter your Dependent care benefits.");
					form.txtdep.focus();
					return false;
				}
				*/
				dep = form.txtdep.value;
				if(isNaN(form.txtdep.value) || dep.valueOf()<0)
							{
								alert("Your  Dependent care benefits must be in Numeric value");
								form.txtdep.focus();
								return false;
							}
		if(form.txtfname.value=="" || !form.txtfname.value)
				{
					alert("Please enter your First Name.");
					form.txtfname.focus();
					return false;
				}
				/*
		if(form.txtnonqual.value=="" || !form.txtnonqual.value)
				{
					alert("Please enter your Nonqualified Plans.");
					form.txtnonqual.focus();
					return false;				
				}
				*/
				if(isNaN(form.txtnonqual.value) || form.txtnonqual.value<0)
							{
								alert("Your  Nonqualified plans must be in Numeric");
								form.txtnonqual.focus();
								return false;
							}
		
		if(form.txtlname.value=="" || !form.txtlname.value)
				{
					alert("Please enter your Last name.");
					form.txtlname.focus();
					return false;
				
				}
		if(form.txtempadd.value=="" || !form.txtempadd.value)
				{
					alert("Please enter your Address.");
					form.txtempadd.focus();
					return false;
				
				}
		if(form.txtezip.value=="" || !form.txtezip.value)
				{
					alert("Please enter your Zipcode.");
					form.txtezip.focus();
					return false;
				
				}
				ezip = form.txtezip.value;
				if(isNaN(form.txtezip.value) || ezip.valueOf()<0)
							{
								alert("Your  Zip code must be  Numeric ");
								form.txtezip.focus();
								return false;
							}
		
		return true;
	}
	//*************************coded by Deepa on 1/4/2004************************
//***************function to check w2subform information**********************
function chkw2sub1(form)
	{
		if(form.txtstate.value=="" || !form.txtstate.value)
				{
					alert("Please enter your State");
					form.txtstate.focus();
					return false;				
				}
		return true;
	}

//**********************************************************************		
//*************************coded by Deepa on 5/3/2004************************
//***************function to check w2subform information**********************

	function chkw2sub(form)
	{
		if(form.txtstate.value=="" || !form.txtstate.value)
				{
					alert("Please enter your State");
					form.txtstate.focus();
					return false;				
				}
		if(form.txtid.value=="" || !form.txtid.value)
				{
					alert("Please enter your Employer's State ID No");
					form.txtid.focus();
					return false;				
				}
				sid = form.txtid.value;
		if(isNaN(form.txtid.value) || sid.valueOf()<0)
				{
					alert("Your Employee State ID No must be Numeric");
					form.txtid.focus();
					return false;
				}
				
		if(form.txtwages.value=="" || !form.txtwages.value)
				{
					alert("Please enter your State Wages and Tips");
					form.txtwages.focus();
					return false;				
				}
				wg = form.txtwages.value;
				if(isNaN(form.txtwages.value) || wg.valueOf()<0)
				{
					alert("Your State Wages,Tips,etc must be Numeric");
					form.txtwages.focus();
					return false;
				}
		if(form.txtstax.value=="" || !form.txtstax.value)
				{
					alert("Please enter your state Income Tax");
					form.txtstax.focus();
					return false;				
				}
				stax = form.txtstax.value;
				if(isNaN(form.txtstax.value) || stax.valueOf()<0)
				{
					alert("Your State Income Tax must be Numeric");
					form.txtstax.focus();
					return false;
				}
		if(form.txtlocalwage.value=="" || !form.txtlocalwage.value)
				{
					alert("Please enter your Local wages and tips");
					form.txtlocalwage.focus();
					return false;				
				}
				lwg = form.txtlocalwage.value;
				if(isNaN(form.txtlocalwage.value) || lwg.valueOf()<0)
				{
					alert("Your Income from Local Wages,tips,etc must be Numeric");
					form.txtlocalwage.focus();
					return false;
				}
		if(form.txtltax.value=="" || !form.txtltax.value)
				{
					alert("Please enter your Local Income Tax");
					form.txtltax.focus();
					return false;				
				}
				ltax =form.txtltax.value;
				if(isNaN(form.txtltax.value) || ltax.valueOf()<0)
				{
					alert("Your Local Income Tax must be Numeric");
					form.txtltax.focus();
					return false;
				}
		if(form.txtlname.value=="" || !form.txtlname.value)
				{
					alert("Please enter your Local Name");
					form.txtlname.focus();
					return false;
				
				}				
	return true;
	}
//*****************************************************************************
//function to prompt for deletion
function deletesch(id,page,pn)
{
		$chkval = confirm("Do you want to delete the selected record permanently");
		if($chkval == true)
		{
				//check for the page
				//if(page == "scheduled")
					url= "deldependentpro.php?id=" + id + "&page=" + page + "&pgval=" +pn;
				window.location.href=url;
		}
}

//*******************************************************************************
//*****************************************************************************
//function to prompt for deletion
function deleteconfirm(id,page,pn,pmp)
{
		$chkval = confirm("Do you want to delete the selected record permanently");
		if($chkval == true)
		{
				//check for the page
				//if(page == "Dependent")
					url= "deldependentpro.php?id=" + id + "&page=" + page + "&pgval=" +pn+ "&bfp=" +pmp;
				window.location.href=url;
		}
}

//*************************************************************************************
//*****************************************************************************
//function to prompt for deletion
function deletepersonalconfirm(id,page,de)
{
		$chkval = confirm("Do you want to delete the selected record permanently");
		if($chkval == true)
		{
				//check for the page
				//if(page == "Dependent")
					//form.dep.value = de;
					url= "deldependentpro.php?id=" + id + "&page=" + page+ "&bfp=" + de;
				window.location.href=url;
		}
}

//*************************************************************************************
//*****************************************************************************
//function to prompt for deletion
function deleteconfirm1(id,id1,page)
{
		$chkval = confirm("Do you want to delete the selected record permanently");
		if($chkval == true)
		{
				//check for the page
				//if(page == "1099info")
					url= "deldependentpro1.php?id=" + id +"&id1=" + id1 +"&page=" + page;
				window.location.href=url;
		}
}
//*************************************************************************************
//Coded by Vimala on 08/12/2004 - To Delete the selected Meals Information
//function to prompt for deletion
function deletemeals(id,page,pn)
{
		$chkval = confirm("Do you want to delete the selected record permanently");
		if($chkval == true)
		{
				//check for the page
				//if(page == "scheduled")
					url= "deldependentpro.php?id=" + id + "&page=" + page + "&pgval=" +pn;
				window.location.href=url;
		}
}

//*************************************************************************************
		//Coded by Padma on 4/3/2004 
		//function to check the form for apartmentinfo
		function chklivingexp(form)
			{
				//check for null values in the txtph field
				if(form.txtph.value=="" || !form.txtph.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins.value=="" || !form.txtins.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins.focus();
						return false;
					}
					
				//check if it is a valid price
				ins = form.txtins.value;
				if(isNaN(form.txtins.value) || ins.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins.focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur.value=="" || !form.txtfur.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur.focus();
						return false;
					}
					
				//check if it is a valid price
				fur = form.txtfur.value;
				if(isNaN(form.txtfur.value) || fur.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov.value=="" || !form.txtmov.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov.focus();
						return false;
					}
					
				//check if it is a valid price
				mov = form.txtmov.value;
				if(isNaN(form.txtmov.value) || mov.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur.value=="" || !form.txtrentfur.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr = form.txtrentfur.value;
				if(isNaN(form.txtrentfur.value) || ftr.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdryclean.value=="" || !form.txtdryclean.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdryclean.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln = form.txtdryclean.value;
				if(isNaN(form.txtdryclean.value) || dcln.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdryclean.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty.value=="" || !form.txtcounty.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity.value=="" || !form.txtcity.value)
					{
						alert("Please enter the City & Telephone number");
						form.txtcity.focus();
						return false;
					}

				//check for null values in the txtstate field
				if(form.txtstate.value=="" || !form.txtstate.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate.focus();
						return false;
					}

			return true;
			}
			//***************************************************************************
			
		function chkpassword(form)
		{
			//to check for null values in the olpassword field
			if(form.oldpass.value=="" || !form.oldpass.value)
			{
				alert("Please enter your Old Password");
				form.oldpass.focus();
				return false;
			}
		
			//to check for null values in the Password field
			if(form.newpass.value=="" || !form.newpass.value)
			{
				alert("Please enter your Old Password");
				form.newpass.focus();
				return false;
			}
			
			//to check for null values in the Password field
			if(form.newconpass.value=="" || !form.newconpass.value)
			{
				alert("Please retype your Old Password");
				form.newconpass.focus();
				return false;
			}			
			
			//check if passwords match
			if(form.newpass.value != form.newconpass.value)
			{
				alert("Your new Password and Retype Password should be the same");
				form.newconpass.focus();
				return false;
			}
			
		//for non-null entries
		return true;
		}
		//*************************************************************************************
		//Coded by Padma on 5/3/2004 
		//function to redirect based on the selected option
		function chkstate(form,sname)
		{
				//to see weather entered marital status or not
				if(form.autoname[0].checked == true)
					url = "w2state.php";
				else
					{
					if(sname == "")
					url = "1099formpromt.php";
					else
					url = "multiplew2s.php";
					}
					

				//redirect to the appropriate location
				form.action = url;
		}	

//***************************************************************************

	//*************************************************************************************
		//Coded by Padma on 5/3/2004 
		//function to redirect based on the selected option
		function chkstate1(form)
		{
				//to see weather entered marital status or not
				if(form.autoname[0].checked == true)
					url = "w2spousestate.php";
				else
					{					
					url = "1099formpromt.php";					
					}
					

				//redirect to the appropriate location
				form.action = url;
		}	

//***************************************************************************

//********************Custom function for date validations***********************************
<!-- 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 DateFormat(vDateName, vDateValue, e, dateCheck, dateType) {
		vDateType = dateType;
		// DateFormat(variablename,variablevalue,event,true or false,typeofdate)
		// vDateName = object name (i)
		// 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
			{
			//vDateName.value = vDateName.value.substr(0, (vDateValue.length-1));
			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 -->

//***************************************************************************
//function to traverse to the appropriate back page
function backpage(frompage)
{
	//check for the from page variable & send accordingly
	if(frompage == 'save')
		url = "edittaxreturn.php";
	if(frompage == 'home')
		url = "userhome.php";
	if(frompage == 'Residential')
		url = "personalinfo.php";
	else if(frompage == 'Maritalinfo')
		url = "residentialinfo.php";
	else if(frompage == 'Contact')
		url = "maritalinfo.php";
	else if(frompage == 'Outside')
		url = "contact.php";
	else if(frompage == 'Multidep')
		url = "outsideaddress.php";
	else if(frompage == 'Dependent')
		url = "multidependent.php";
	else if(frompage == 'Multiplew2')
		url = "multiplew2sub.php";
	else if(frompage == 'multiw21')
		url = "multiplew2sub.php";
	else if(frompage == 'w2')
		url = "w2state.php";
	else if(frompage == 'Multiplew12')
		url = "maritalinfo.php";
	else if(frompage == '1099prompt')
		url = "multiplew2s.php";
	else if(frompage == '1099info')
		url = "w2state.php";
	else if(frompage == 'schprompt')
		url = "1099formpromt.php";
	else if(frompage == 'schedule')
		url = "1099info.php";
	else if(frompage == 'schedule1')
		url = "refunddeposit.php";
	else if(frompage == 'schedule1i')
		url = "scheduledform1.php?pageval=8.01";
	else if(frompage == 'Refund')
		url = "scheduled.php";
	else if(frompage == 'Bank')
		url = "refunddeposit.php";
	else if(frompage == 'Multipleother')
		url = "refunddeposit.php";
	else if(frompage == 'Other')
		url = "multipleotherdetails.php";
	else if(frompage == 'Multiemp')
		url = "multipleotherdetails.php";
	else if(frompage == 'Emp')
		url = "multipleemployeedetails.php";
	else if(frompage == 'Multicountry')
		url = "multipleemployeedetails.php";
	else if(frompage == 'Country')
		url = "multiplecountrydetails.php";
	else if(frompage == 'Multiplevisa')
		url = "automobileusage.php";
	else if(frompage == 'Multiapart')
		url = "personalinfo.php";
	else if(frompage == 'Multiapart11')
		url = "multiplevisadetails.php";
	else if(frompage == 'Multiliving')
		url = "livingexp.php?pageval=2.01";
	else if(frompage == 'Business')
		url = "businessexp.php";
	else if(frompage == 'businessexp')
		url = "businessexp.php";
	else if(frompage == 'otherbusiness')
		url = "multiplebusinessexp.php";
	else if(frompage == 'Auto')
		url = "businessexp.php";
	else if(frompage == 'multiplemployedetail')
		url = "multipleotherdetails.php"
	else if(frompage == 'thankyou' )
		url = "thankyou.php";
	else if(frompage == 'employee')
		url = "employeedetails.php";
	if(url != "")
		window.location.href = url;
		
}
	
//***************************************************************************
//function to traverse to the appropriate back page
function backpage1(frompage)
{

//alert("Entry")
	//check for the from page variable & send accordingly
	//if(frompage == 'Residential')
		//url = "personalinfo.php";
	//else if(frompage == 'Maritalinfo')
		//url = "residentialinfo.php";
	//else if(frompage == 'contact')
	//	url = "maritalinfo.php";
	//else if(frompage == 'spouse')
	//	url = "contact.php";	
	//else if(frompage == 'Outside')
	//	url = "spouseinfo.php";
	//else if(frompage == 'Multidep')
	//	url = "outsideaddress.php";
	//else if(frompage == 'Dependent')
	//	url = "multidepinfo.php";
	if(frompage == 'personal')
		url = "personalinfo.php";
	else if(frompage == 'multiw2')
		url = "maritalinfo.php";
	else if(frompage == 'w2spform')
		url = "multiw2form.php";
	else if(frompage == 'w2')
		//url = "multiw2form.php";
		url = "w2state.php"
	else if(frompage == 'Multiplew2')
		url = "maritalinfo.php";
	else if(frompage == '1099prompt')
		url = "multiplew2sub.php";
	else if(frompage == '1099info')
		url = "multispw2form.php";
	else if(frompage == '1099div')
		url = "1099divform.php?pageval=8.01";
	else if(frompage == 'multi1099form')
		url = "w2state.php";
	else if(frompage == 'schinfo')
		url = "multi1099form.php";
	else if(frompage == 'scheduled')
	url = "1099divform.php";	
	else if(frompage == 'schedule')
	url = "scheduledfrm.php";	
	else if(frompage == 'Multiempl')
		url = "multiplemployedetail.php";
	else if(frompage == 'Refund')
		url = "schformpromt.php";
	else if(frompage == 'Bank')
		url = "scheduledfrm.php";
	else if(frompage == 'Multipleother')
		url = "bankdetail.php";
	else if(frompage == 'Multipleothers')
		url = "multipleotherdetails.php";
	else if(frompage == 'Other')
		url = "multipleotherdetails.php";
	else if(frompage == 'Multiemp')
		url = "multipleotherdetails.php";
	else if(frompage == 'emp')
		url = "multiplemployedetail.php";
	else if(frompage == 'count')
		url = "multiplemployedetail.php?5.01";
	else if(frompage == 'visa')
		url = "multiplecountrydetail.php";
	else if(frompage == 'apart')
		url = "multivisadetail.php";
	else if(frompage == 'Multiapart')
		url = "multiapartment.php";
	else if(frompage == 'Live')
		url = "multiapartment.php";		
	else if(frompage == 'Multiliving')
		url = "multiplelivingexp.php?pageval=2.01";
	else if(frompage == 'Multiliving1')
		url = "livingexpenses2.php";
	else if(frompage == 'Multiliving2')
		url = "multiplelivingexp.php";
	else if(frompage == 'business')
		url = "businessexp.php";
	else if(frompage == 'automobileusage')
		url = "automobileusage.php";
	else if(frompage == 'Multimealsinfo')
		url = "multiplemealsinfo.php";
	else if(frompage == 'Multimealsinfo1')
		url = "taxpayerspouse1.php?id=ob";
	else if(frompage == 'Multimealsinfo_b')
		url = "multiplemealsinfo.php";
	else if(frompage == 'accbusiness')
		url = "multiplecharityinfo.php";
	else if(frompage == 'accotherbus')
		url = "accbusinessexp.php";
		else if(frompage == 'accotherbus1')
		url = "taxpayerspouse1.php?id=ae";
	else if(frompage == 'otherbusiness')
		url = "multiplebusinessexp.php";
	else if(frompage == 'Auto')
		url = "multipleauto.php";
	else if(frompage == 'autoexp')
		url = "taxpayerspouse1.php?id=ab";
	else if(frompage == 'autoexp')
		url = "multiplebussexp.php";
	else if(frompage == 'multiplebusiness')
		url = "bussinessexp.php";
	else if(frompage == 'personalinfo')
		url = "personalinfo.php";
	else if(frompage == 'charityinfo')
		url = "multiplecharityinfo.php";
	else if(frompage == 'multipleautoexp')
		url = "multipleautoexp.php";
	else if(frompage == 'editreturns')
		url = "editreturns.php";
		//alert("from = " + frompage + " and url = " + url);
	if(url != "")
		window.location.href = url;
		
}

//***************************************************************************
//function to check if entered amt is numeric
function chkliv4(form)
{
	if(form.expnature.value != "" && form.expamount.value == "")
	{
		alert("Please enter the amount of expenditure")
		form.expamount.focus();
		return false;
	}

	if(form.expamount.value != "")
	{
		chkval = form.expamount.value;
		if(isNaN(form.expamount.value) || chkval.valueOf() <0)
		{
			alert("Please enter a valid Amount")
			form.expamount.focus();
			return false;
		}
	}
	return true
}

//***************************************************************************
	//for the accountant module
	//Coded by Padma on 12-3-2004 
	//function to check for numbers
	function chknumber(txtval)
	{
		//check for null values in the fields
		if(txtval.value == "" || !txtval.value)
		{
			alert("Please enter a valid number here");
			txtval.focus();
		}
		
		num = txtval.value;
		
		if(isNaN(txtval.value) || num.valueOf() <=0)
		{
			alert("Please enter a valid number here");
			txtval.value = "0.00";
		}
	}
	//***************************************************************************
	
//***************************************************************************
	//for the accountant module
	//Coded by Deepa on 15-3-2004 
	//function to check for numbers
	function chkcharity(form)
	{
		//check for null values in the fields
		if(form.txtamount.value == "" || !form.txtamount.value)
		{
			alert("Please enter a valid number here");
			form.txtamount.focus();
			return false;
		}
		
		num = form.txtamount.value;
		
		if(isNaN(form.txtamount.value) || num.valueOf() <0)
		{
			alert("Please enter a valid number here");
			form.txtamount.focus();
			return false;
		}
		return true;
	}
	
	function chkaccother(form)
		{
				
					url = "multiplebusinessexp.php";

				//redirect to the appropriate location
				form.action = url;
		}	


//for the accountant module
	//Coded by vimala on 20-5-2004 
	//function to check for numbers
	function chkaccother(form)
	{
		//check for null values in the fields
		if(form.expamount.value == "" || !form.expamount.value)
		{
			alert("Please enter a valid number here");
			form.expamount.focus();
			return false;
		}
		
		num = form.expamount.value;
		
		if(isNaN(form.expamount.value) || num.valueOf() <0)
		{
			alert("Please enter a valid number here");
			form.expamount.focus();
			return false;
		}
		return true;
	}
	//***************************************************************************
	//***************************************************************************
	//for the accountant module
	//Coded by Deepa on 15-3-2004 
	//function to check for numbers
	function chkaccother(form)
	{
		//check for null values in the fields
		if(form.expamount.value == "" || !form.expamount.value)
		{
			alert("Please enter a valid number here");
			form.expamount.focus();
			return false;
		}
		
		num = form.expamount.value;
		
		if(isNaN(form.expamount.value) || num.valueOf() <=0)
		{
			alert("Please enter a valid number here");
			form.expamount.focus();
			return false;
		}
		return true;
	}
	//***************************************************************************

	//for the Meals information
	//Coded by Deepa on 16-3-2004 
	//function to check the valid number
	function chkmealsinfo(form)
	{
		//check for null values in the fields
		
		/************* Commented by Vimala on 07/12/2004 ************************/
		/*if(form.txtdays.value == "" || !form.txtdays.value)
		{
			alert("Please enter a valid number here");
			form.txtdays.focus();
			return false;
		}
		
		num = form.txtdays.value;
		
		if(isNaN(form.txtdays.value) || num.valueOf() <=0)
		{
			alert("Please enter a valid number here");
			form.txtdays.focus();
			return false;
		}
		if(form.txtamt.value == "" || !form.txtamt.value)
		{
			alert("Please enter a valid number here");
			form.txtamt.focus();
			return false;
		}
		
		num1 = form.txtamt.value;
		
		if(isNaN(form.txtamt.value) || num1.valueOf() <=0)
		{
			alert("Please enter a valid number here");
			form.txtamt.focus();
			return false;
		}*/
		/************* Till Here************************/
		
		/************* Coded by Vimala on 07/12/2004 ************************/
		if(form.txtq1.value=="Yes" && form.txtq2.value=="Yes")
		{
			if(form.txtempname1.value == "" || !form.txtempname1.value)
			{
				alert("Please enter a Employee Name here");
				form.txtempname1.focus();
				return false;
			}
			if(form.txtyesrem1.value == "" || !form.txtyesrem1.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtyesrem1.focus();
				return false;
			}
			
			if(form.txtempname2.value == "" || !form.txtempname2.value)
			{
				alert("Please enter a Employee Name here");
				form.txtempname2.focus();
				return false;
			}
			if(form.txtyesrem2.value == "" || !form.txtyesrem2.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtyesrem2.focus();
				return false;
			}
			
			if(form.txtempname3.value == "" || !form.txtempname3.value)
			{
				alert("Please enter a Employee Name here");
				form.txtempname3.focus();
				return false;
			}
			if(form.txtyesrem3.value == "" || !form.txtyesrem3.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtyesrem3.focus();
				return false;
			}
			
			if(form.txtempname4.value == "" || !form.txtempname4.value)
			{
				alert("Please enter a Employee Name here");
				form.txtempname4.focus();
				return false;
			}
			if(form.txtyesrem4.value == "" || !form.txtyesrem4.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtyesrem4.focus();
				return false;
			}
			if(form.txtyesmeals.value == "" || !form.txtyesmeals.value)
			{
				alert("Please enter Meals and Entertainment Expenses here");
				form.txtyesmeals.focus();
				return false;
			}
		}
		if(form.txtq1.value=="Yes" && form.txtq2.value=="No")
		{
		
			if(form.txtnomeals.value == "" || !form.txtnomeals.value)
			{
				alert("Please enter Meals and Entertainment Expenses here");
				form.txtnomeals.focus();
				return false;
			}
			
			if(form.txtnorem1.value == "" || !form.txtnorem1.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtnorem1.focus();
				return false;
			}
			if(form.txtnorem2.value == "" || !form.txtnorem2.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtnorem2.focus();
				return false;
			}
			if(form.txtnorem3.value == "" || !form.txtnorem3.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtnorem3.focus();
				return false;
			}
			if(form.txtnorem4.value == "" || !form.txtnorem4.value)
			{
				alert("Please enter a Reimbursement Amount here");
				form.txtnorem4.focus();
				return false;
			}
			
		}
		return true;
	}
//***************************************************************************
	//***************************************************************************

	//for the Meals information
	//Coded by Deepa on 16-3-2004 
	//function to check the valid number
	function chkaccautoexpenses(form)
	{
		//check for null values in the fields
		
		
		num = form.accinsurance.value;
		
		if(isNaN(form.accinsurance.value) || num.valueOf() <0)
		{
			if(form.accinsurance.value=="" || !form.accinsurance.value)
						{
							return true;
						}
					else
						{
			
							alert("Please enter a valid number here");
							form.accinsurance.focus();
							return false;
						}
						
		}	
		
		num1 = form.accrepairs.value;
		
		if(isNaN(form.accrepairs.value) || num1.valueOf() <0)
		{
			if(form.accrepairs.value=="" || !form.accrepairs.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid Repair number here");
							form.accrepairs.focus();
							return false;
						}
		}
		num2 = form.acccost.value;
		
		if(isNaN(form.acccost.value) || num2.valueOf() <0)
		{
			if(form.acccost.value=="" || !form.acccost.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acccost.focus();
							return false;
						}
		}	
		
		num3 = form.acctolls.value;
		
		if(isNaN(form.acctolls.value) || num3.valueOf() <0)
		{
			if(form.acctolls.value=="" || !form.acctolls.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acctolls.focus();
							return false;
						}
		}
		num4 = form.acclicense.value;
		
		if(isNaN(form.acclicense.value) || num4.valueOf() <0)
		{
			if(form.acclicense.value=="" || !form.acclicense.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acclicense.focus();
							return false;
						}
		}	
		
		num5 = form.accmiles.value;
		
		if(isNaN(form.accmiles.value) || num5.valueOf() <0)
		{
			if(form.accmiles.value=="" || !form.accmiles.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accmiles.focus();
							return false;
						}
		}
		num6 = form.accestmiles.value;
		
		if(isNaN(form.accestmiles.value) || num6.valueOf() <0)
		{
			if(form.accestmiles.value=="" || !form.accestmiles.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accestmiles.focus();
							return false;
						}
		}	
		
		num7 = form.accmileage.value;
		
		if(isNaN(form.accmileage.value) || num7.valueOf() <0)
		{
			if(form.accmileage.value=="" || !form.accmileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accmileage.focus();
							return false;
						}
		}
		num8 = form.accbmileage.value;
		
		if(isNaN(form.accbmileage.value) || num8.valueOf() <0)
		{
			if(form.accbmileage.value=="" || !form.accbmileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accbmileage.focus();
							return false;
						}
		}	
		
		num9 = form.accavgcost.value;
		
		if(isNaN(form.accavgcost.value) || num9.valueOf() <0)
		{
			if(form.accavgcost.value=="" || !form.accavgcost.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accavgcost.focus();
							return false;
						}
		}
		num11 = form.accbusmile.value;
		
		if(isNaN(form.accbusmile.value) || num11.valueOf() <0)
		{
			if(form.accbusmile.value=="" || !form.accbusmile.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accbusmile.focus();
							return false;
						}
		}	
		
		num12 = form.acctotmileage.value;
		
		if(isNaN(form.acctotmileage.value) || num12.valueOf() <0)
		{
			if(form.acctotmileage.value=="" || !form.acctotmileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acctotmileage.focus();
							return false;
						}
		}
		num13 = form.accpermileage.value;
		
		if(isNaN(form.accpermileage.value) || num13.valueOf() <0)
		{
			if(form.accpermileage.value=="" || !form.accpermileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accpermileage.focus();
							return false;
						}
		}	
		
		num14 = form.gascharges.value;
		
		if(isNaN(form.gascharges.value) || num14.valueOf() <0)
		{
			if(form.gascharges.value=="" || !form.gascharges.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.gascharges.focus();
							return false;
						}
		}
		num15 = form.accreimburse.value;
		
		if(isNaN(form.accreimburse.value) || num15.valueOf() <0)
		{
			if(form.accreimburse.value=="" || !form.accreimburse.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accreimburse.focus();
							return false;
						}
		}	
		
		numa = form.accdpay.value;
		
		if(isNaN(form.accdpay.value) || numa.valueOf() <0)
		{
			if(form.accdpay.value=="" || !form.accdpay.value)
						{
							return true;
						}
					else
						{
								alert("Please enter a valid number here");
								form.accdpay.focus();
								return false;
						}
		}
		numb = form.accmpay.value;
		
		if(isNaN(form.accmpay.value) || numb.valueOf() <0)
		{
			if(form.accmpay.value=="" || !form.accmpay.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accmpay.focus();
							return false;
						}
		}	
		
		numc = form.accterms.value;
		
		if(isNaN(form.accterms.value) || numc.valueOf() <0)
		{
			if(form.accterms.value=="" || !form.accterms.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accterms.focus();
							return false;
						}
		}
		numd = form.fincharges.value;
		
		if(isNaN(form.fincharges.value) || numd.valueOf() <0)
		{
			if(form.fincharges.value=="" || !form.fincharges.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.fincharges.focus();
							return false;
						}
		}
		nume = form.accsaleprice.value;
		
		if(isNaN(form.accsaleprice.value) || nume.valueOf() <0)
		{
			if(form.accsaleprice.value=="" || !form.accsaleprice.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accsaleprice.focus();
							return false;
						}
		}	
		
		numf = form.acclterms.value;
		
		if(isNaN(form.acclterms.value) || numf.valueOf() <0)
		{
			if(form.acclterms.value=="" || !form.acclterms.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acclterms.focus();
							return false;
						}
		}
		numg = form.acclpay.value;
		
		if(isNaN(form.acclpay.value) || numg.valueOf() <0)
		{
			if(form.acclpay.value=="" || !form.acclpay.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acclpay.focus();
							return false;
						}
		}
		if(checkdate(form.accpdate) == false)
					return false;
		if(checkdate(form.accsdate) == false)
					return false;
		if(checkdate(form.accldate) == false)
					return false;
		return true;
	}
		
		//*******************************************************************8
		
			//***************************************************************************

	//for the Meals information
	//Coded by Deepa on 17-3-2004 
	//function to check the valid number
	function chkaccautoexpenses1(form)
	{
		var i;
		for(i=0;i<form.elements.length;i++)
			{	
				numg = form.elements[i].value;
				
				if(isNaN(form.elements[i].value) || numg.valueOf() <=0)
				{
					if(form.elements[i].value=="" || !form.elements[i].value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.elements[i].focus();
							return false;
						}
				}
				
			}
	return true;
	}
	//************************************************************************************
	//***************************************************************************

	//for the Meals information
	//Coded by Deepa on 16-3-2004 
	//function to check the valid number
	function chkaccbusinessexpenses1(form)
	{
		var i;
		for(i=0;i<form.elements.length;i++)
			{	
				numg = form.elements[i].value;
				
				if(isNaN(form.elements[i].value) || numg.valueOf() <0)
				{
					if(form.elements[i].value=="" || !form.elements[i].value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.elements[i].focus();
							return false;
						}
				}
				
			}
	return true;
	}
	function chkaccbusinessexpenses(form)
	{
				if(isNaN(form.acchabove.value))
					{
						alert("Computer Hardware above $500 should be numeric and greater than $500");
						form.acchabove.focus();
						return false;
					}
					
				
				//check if it is a valid price
				if(isNaN(form.acchbelow.value))
					{
						alert("Computer hardware under $500 should be numeric and less than $500");
						form.acchbelow.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.accsoftware.value))
					{
						alert("Computer software charges should be numeric");
						form.accsoftware.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.accservices.value))
					{
						alert("On-Line Service charges should be numeric");
						form.accservices.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.accfurniture.value))
					{
						alert("Office furniture charges should be numeric");
						form.accfurniture.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.accequipment.value))
					{
						alert("Office equipment charges should be numeric");
						form.accequipment.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.accosupplies.value))
					{
						alert("Office supply charges should be numeric");
						form.accosupplies.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.acsupplies.value))
					{
						alert("Computer supply charges should be numeric");
						form.acsupplies.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.acctelephone.value))
					{
						alert("Business Telephone charges should be numeric");
						form.acctelephone.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.accpostage.value) )
					{
						alert("Postage and Messenger service charges should be numeric");
						form.accpostage.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.accbooks.value))
					{
						alert("Books/Subscription charges should be numeric");
						form.accbooks.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.accdues.value))
					{
						alert("Dues/Membership charges should be numeric");
						form.accdues.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.accpfees.value))
					{
						alert("Professional Fee charges should be numeric");
						form.accpfees.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.accseminars.value))
					{
						alert("Tax Prepraton Fee charges should be numeric");
						form.accseminars.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.accvisacost.value))
					{
						alert("Visa/Legal charges should be numeric");
						form.accvisacost.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.acctravel.value))
					{
						alert("Travel expense charges should be numeric");
						form.acctravel.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.acclocaltravel.value))
					{
						alert("Local Travel charges should be numeric");
						form.acclocaltravel.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.accjobsearch.value))
					{
						alert("Job Search charges should be numeric");
						form.accjobsearch.focus();
						return false;
					}
					else
					return true;
	}
	//************************************************************************************	
	//coded by Deepa on 17/3/2004
	//function to check for valid entry in forgot password 
	
	function chkforgot(form)
		{
			if(form.txtemail.value == "" || !form.txtemail.value)
				{
					alert("Please enter your Registered Email Id.");
					form.txtemail.value = "";
					form.txtemail.focus();
					return false;
				}
				if(form.txtemail.value != "" || form.txtemail.value)
				{
					var str,  pos1, pos2;
					str = form.txtemail.value;
					pos1 = str.indexOf("@");
					pos2 = str.indexOf(".");
					if(pos1==-1 || pos2 == -1)
					{
						alert("Please enter a valid Email Address");
						form.txtemail.select();
						return false;
					}
				}
			return true;				
		}	
	//************************************************************************************		
	//************************************************************************************
	//********************************function to validate Scheduled form************
	//coded by Deepa on 2/4/2004
	function chksch1copy(form)
	{

		if(form.txtdesc.value == "" || !form.txtdesc.value)
			{
				alert("Please enter the Description");
				form.txtdesc.focus();
				return false;
			}
			if(form.txtadate.value == "" || !form.txtadate.value)
			{
				alert("Please enter the Acquired Date");
				form.txtadate.focus();
				return false;
			}
			if(form.txtsdate.value == "" || !form.txtsdate.value)
			{
				alert("Please enter the Sold Date");
				form.txtsdate.focus();
				return false;
			}
			
			if(form.txtprice.value == "" || !form.txtprice.value)
			{
				alert("Please enter the Grossprice");
				form.txtprice.focus();
				return false;
			}
			if(isNaN(form.txtprice.value ) || form.txtprice.value < 0)
			{
				alert("The Grossprice must be numeric");
				form.txtprice.focus();
				return false;
			}
			if(form.txtcost.value == "" || !form.txtcost.value)
			{
				alert("Please enter the Cost");
				form.txtcost.focus();
				return false;
			}
			if(isNaN(form.txtcost.value ) || form.txtcost.value < 0)
			{
				alert("The cost must be numeric");
				form.txtcost.focus();
				return false;
			}
			var netgainloss,gprice,cost;
	gprice = form.txtprice.value;
	cost = form.txtcost.value;
	netgainloss = gprice-cost;
	form.txtbasic.value = netgainloss;
			
			if(checkdate(form.txtsdate) == false)
					return false;
			if(checkdate(form.txtadate) == false)
					return false;			
		return this;
	}
	//************************************************************************************	
		
	//********************************function to validate Scheduled form************
	//coded by Deepa on 2/4/2004
	function chksch1(form)
	{
          j = form.elements.length
          for(i=2;i<j-4;)
             {
                 //alert("i="+i);
                if(form.elements[i].value == "" && form.elements[i+1].value == "" && form.elements[i+2].value == "" && form.elements[i+3].value == ""
                &&form.elements[i+4].value == "" &&form.elements[i+5].value == "")
                
                    {
                        //return true;
                    }
               else
                   {

		if(form.elements[i].value == "" || !form.elements[i].value)
			{
				alert("Please enter the Description");
				form.elements[i].focus();
				return false;
			}
			if(form.elements[i+1].value == "" || !form.elements[i+1].value)
			{
				alert("Please enter the Acquired Date");
				form.elements[i+1].focus();
				return false;
			}
			if(form.elements[i+2].value == "" || !form.elements[i+2].value)
			{
				alert("Please enter the Sold Date");
				form.elements[i+2].focus();
				return false;
			}

			if(form.elements[i+3].value == "" || !form.elements[i+3].value)
			{
				alert("Please enter the Grossprice");
				form.elements[i+3].focus();
				return false;
			}
			if(isNaN(form.elements[i+3].value ) || form.elements[i+3].value < 0)
			{
				alert("The Grossprice must be numeric");
				form.elements[i+3].focus();
				return false;
			}
			if(form.elements[i+4].value == "" || !form.elements[i+4].value)
			{
				alert("Please enter the Cost");
				form.elements[i+4].focus();
				return false;
			}
			if(isNaN(form.elements[i+4].value ) || form.elements[i+4].value < 0)
			{
				alert("The cost must be numeric");
				form.elements[i+4].focus();
				return false;
			}
   			if(checkdate(form.elements[i+1]) == false)
					return false;
			if(checkdate(form.elements[i+2]) == false)
					return false;
            }
            i=i+6;
            }
		return this;
	}
	//*****************************************************
		
		
		
	//Coded by Padma on 12-3-2004 
	//function to display the total automatically
	function computeval(form)
	{
		val1 = form.txtdays.value;
		val2 = form.txtamt.value;
		if(!isNaN(val1) && val1.valueOf() >=0)
		{
			if(!isNaN(val2) && val2.valueOf() >=0)
			{
				val3 = val1 * val2;
				form.txttotal.value = val3;
			}
		}
		
	}

//***************************************************************************
//function to store the dependent details
function storerecord(id,fname,lname,ssn,dob,rel,jr)
{
//alert("id=" + id + ",fname=" + fname + " lname = "+lname + " ssn = "+ ssn + " Dob = "+ dob + " Rel = " + rel + "Jr = " + jr)
	this.id = id;
	this.fname = fname;
	this.lname = lname;
	this.ssn = ssn;
	this.dob = dob;
	this.rel = rel;
	this.jr = jr;
}
//***************************************************************************
//funtion to display the dependent details automatically
function filldepdetails(depid)
{
	obj1 = depid;
 	for(var k=0;k < detarray.length;k++)
	 {
			obj2 = detarray[k].id;
			if(obj1 == obj2)
			{
				//alert("Match found for the Depid");
				//fill the details in the form
				frmpersonal.depid.value = obj1;
				frmpersonal.txtdfname.value= detarray[k].fname;		
				frmpersonal.txtdlname.value= detarray[k].lname;
				frmpersonal.txtdssno.value= detarray[k].ssn;		
				frmpersonal.txtddob.value= detarray[k].dob;						
				frmpersonal.selrel.value= detarray[k].rel;		
				frmpersonal.txtjrsr.value= detarray[k].jr;						
			}            
	 }
}
//***************************************************************************
//***************************************************************************
//function to store the scheduled information details
//coded by Deepa on 4/12/2004
function storesch(id,fname,lname,ssn,dob,rel,jr)
{
//alert("id=" + id + ",fname=" + fname + " lname = "+lname + " ssn = "+ ssn + " Dob = "+ dob + " Rel = " + rel + "Jr = " + jr)
	this.id = id;
	this.fname = fname;
	this.lname = lname;
	this.ssn = ssn;
	this.dob = dob;
	this.rel = rel;
	this.jr = jr;
}
//***************************************************************************
//funtion to display the dependent details automatically
function fillschdetails(form,depid)
{
    var a;
	obj1 = depid;
      a=frmsch.elements.length;
      //alert("a="+a);
 	for(var k=0;k < detarray.length;k++)
	 {
           var i=2
			obj2 = detarray[k].id;
			if(obj1 == obj2)
			{
				//alert("Match found for the Depid"+obj1);
				//fill the details in the form
            	frmsch.elements[153].value = detarray[k].id;
				frmsch.elements[i].value= detarray[k].fname;
				frmsch.elements[i+1].value= detarray[k].lname;
				frmsch.elements[i+2].value= detarray[k].ssn;
				frmsch.elements[i+3].value= detarray[k].dob;
				frmsch.elements[i+4].value= detarray[k].rel;
				frmsch.elements[i+5].value= detarray[k].jr;
			}
	 }
}
//***************************************************************************
//function to validate business exp
function chkbusexp(form)
{

				form.oe.value = "oe";
					
				//check if it is a valid price
			if(form.habove.value != "")
				{
					if(isNaN(form.habove.value))
						{
							alert("Computer Hardware above $500 should be numeric");
							
							form.habove.focus();
							return false;
						}
					else 
					{
						if(form.habove.value < 500)
						{
							alert("Computer Hardware above $500 should be numeric and greater than $500");
							form.habove.focus();
							return false;
						}
					}
				}
					
				
				//check if it is a valid price
				if(isNaN(form.hbelow.value))
				{
					alert("Computer hardware under $500 should be numeric");
					form.hbelow.focus();
					return false;
				}
				else 
				{
					if(form.hbelow.value > 500)
					{
						alert("Computer hardware under $500 should be numeric and less than $500");
						form.hbelow.focus();
						return false;
					}
				}
				//check if it is a valid price
				if(isNaN(form.software.value))
					{
						alert("Computer software charges should be numeric");
						form.software.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.services.value))
					{
						alert("On-Line Service charges should be numeric");
						form.services.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.furniture.value))
					{
						alert("Office furniture charges should be numeric");
						form.furniture.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.equipment.value))
					{
						alert("Office equipment charges should be numeric");
						form.equipment.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.osupplies.value))
					{
						alert("Office supply charges should be numeric");
						form.osupplies.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.csupplies.value))
					{
						alert("Computer supply charges should be numeric");
						form.csupplies.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.telephone.value))
					{
						alert("Business Telephone charges should be numeric");
						form.telephone.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.postage.value) )
					{
						alert("Postage and Messenger service charges should be numeric");
						form.postage.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.books.value))
					{
						alert("Books/Subscription charges should be numeric");
						form.books.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.dues.value))
					{
						alert("Dues/Membership charges should be numeric");
						form.dues.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.pfees.value))
					{
						alert("Professional Fee charges should be numeric");
						form.pfees.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.seminars.value))
					{
						alert("Tax Prepraton Fee charges should be numeric");
						form.seminars.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.visacost.value))
					{
						alert("Visa/Legal charges should be numeric");
						form.visacost.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.travelexp.value))
					{
						alert("Travel expense charges should be numeric");
						form.travelexp.focus();
						return false;
					}
				
				//check if it is a valid price
				if(isNaN(form.localtravel.value))
					{
						alert("Local Travel charges should be numeric");
						form.localtravel.focus();
						return false;
					}
				//check if it is a valid price
				if(isNaN(form.jobsearch.value))
					{
						alert("Job Search charges should be numeric");
						form.jobsearch.focus();
						return false;
					}
					
				if(form.chkpage.value == "Add")
				{
						//check if Expense nature is blank
						if(form.expnature.value == "" || form.expnature.value == "")
						{
							alert("Please enter the Other Expenses Nature");
							form.expnature.focus();
							return false;
						}
						
						//check if it is a valid price
						if(isNaN(form.expamount.value) || form.expamount.value == "")
							{
								alert("Other Expenses should be numeric");
								form.expamount.focus();
								return false;
							}	
						if(form.expnature.value != "")
							{
								if(form.expamount.value == "" || !form.expamount.value)
									{
										alert("Please enter the Other Expenses");
										form.expamount.focus();
										return false;
									}
								
								//check if it is a valid price
								if(isNaN(form.expamount.value))
									{
										alert("Other Expenses should be numeric");
										form.expamount.focus();
										return false;
									}
							}
							if(form.expamount.value != "")
								{
									if(form.expnature.value == "")
										{
											alert("Please enter the Other Expenses Nature");
											form.expnature.focus();
											return false;
										}
									
									//check if it is a valid price
									if(isNaN(form.expamount.value)  || form.expamount.value == "")
										{
											alert("Other Expenses should be numeric");
											form.expamount.focus();
											return false;
										}
								}
								
							if(form.expamount.value == "" && form.expnature.value == "")
								form.chkpage.value ="";
					}
					else
					return true;
			}
//***************************************************************************
//function to check if the other expenses are to be saved or not
function chkbusiness(form)
{
	form.chkpage.value="";
	form.rdpage.value="";
	return chkbusexp(form);
}			
			
//***************************************************************************

//function to check if the other expenses are to be saved or not
function savebusiness(form)
{
	form.chkpage.value = "";
	form.rdpage.value = "Close";	
	return chkbusexp(form);
}			
			
//***************************************************************************
//***************************************************************************

//function to check if the other expenses are to be saved or not
function nextbusiness(form)
{
	form.chkpage.value = "";
	form.rdpage.value = "next";	
	return chkbusexp(form);
}			
			
//***************************************************************************
//***************************************************************************

//function to check if the other expenses are to be saved or not
function chksch2(form)
{
	//form.chkpage.value = "";
	form.next.value = "next";	
	return chksch1(form);
}			
			
//***************************************************************************
//***************************************************************************

//function to check if the other expenses are to be saved or not
function chksch3(form)
{
	//form.chkpage.value = "";
	form.add.value = "add";
	return chksch1(form);
}

//***************************************************************************
//***************************************************************************

//function to check if the other expenses are to be saved or not
function chkw2infosave(form)
{
	//form.chkpage.value = "";
	form.save.value = "save";	
	return chkw2info(form);
}			
			
//***************************************************************************
//***************************************************************************

//function to check if the other expenses are to be saved or not
function chkscheduledsave(form)
{
	//form.chkpage.value = "";
	form.save.value = "save";	
	return chkscheduled(form);
}			
			
//*****************************************************************

//function to specify  the page based on the button clicked
function saveotherdetails(form)
{
	form.rdpage.value = "Save";
	return chkotherdetails(form);
}			
			
//***************************************************************************
//***************************************************************************

//function to check if the other expenses are to be saved or not
function chk1099info1(form)
{
	//form.chkpage.value = "";
	form.save.value = "save";	
	return chk1099info(form);
}			
			
//***************************************************************************

//function to store the dependent details
function emprecord(eid,ename,wcity,wstate,wfdate,wtdate,hcity,hstate,hfdate,htdate)
{
	this.eid = eid;
	this.ename = ename;
	this.wcity = wcity;
	this.wstate = wstate;
	this.wfdate = wfdate;
	this.wtdate = wtdate;
	this.hcity = hcity;
	this.hstate = hstate;
	this.hfdate = hfdate;
	this.htdate = htdate;
}
//***************************************************************************
//***************************************************************************

//function to store the residential details
//coded by Deepa on 30/11/2004
//used in employee details
function resrecord(eid,hcity,hstate,hfdate,htdate)
{
	this.eid = eid;	
	this.hcity = hcity;
	this.hstate = hstate;
	this.hfdate = hfdate;
	this.htdate = htdate;
}
//************************************
//function to fill residential info
//coded by deepa on 30/11/2004
//function fillresinfo(form)
	//{
	//	for(i=0;i<resarray.length;i++)
		
	//}

//*************************************
//funtion to display the dependent details automatically
function fillempdetails(depid)
{
	obj1 = depid;
 	for(var k=0;k < emparray.length;k++)
	 {
			obj2 = emparray[k].eid;
			if(obj1 == obj2)
			{
				//fill the details in the form
				frmemp.eid.value = obj1;
				frmemp.txtename.value= emparray[k].ename;		
				frmemp.txtcity.value= emparray[k].wcity;
				frmemp.txtstate.value= emparray[k].wstate;		
				frmemp.txtfdate.value= emparray[k].wfdate;						
				frmemp.txttodate.value= emparray[k].wtdate;		
				frmemp.txtrcity.value= emparray[k].hcity;
				frmemp.txtrstate.value= emparray[k].hstate;		
				frmemp.txtrfdate.value= emparray[k].hfdate;						
				frmemp.txtrtodate.value= emparray[k].htdate;
				frmemp.optionval.value = "Employeedetails";		
			}            
	 }
}
//***************************************************************************

//function to store the country details
function countryrecord(cid,tyear,tcountry,purpose,fdate,tdate)
{
	this.eid = cid;
	this.tyear = tyear;
	this.tcountry = tcountry;
	this.purpose = purpose;
	this.fdate = fdate;
	this.tdate = tdate;
}
//***************************************************************************
//funtion to display the dependent details automatically
function fillcountrydetails(depid)
{
	obj1 = depid;
 	for(var k=0;k < countryarray.length;k++)
	 {
	 
			obj2 = countryarray[k].eid;
			if(obj1 == obj2)
			{
				//fill the details in the form
				frmemp.inoutid.value = obj1;
				frmemp.txtyear.value= countryarray[k].tyear;		
				frmemp.txtfdate1.value= countryarray[k].fdate;						
				frmemp.txttodate1.value= countryarray[k].tdate;		
				frmemp.txtcountry1.value= countryarray[k].tcountry;
				frmemp.txtpurpose.value= countryarray[k].purpose;		
				frmemp.optionval.value = "Countrydetails";		
			}            
	 }
}
//***************************************************************************

//function to store the country details
function visarecord(vid,tdate,tplace,vtype,cnumber)
{
	this.vid = vid;
	this.tdate = tdate;
	this.tplace = tplace;
	this.vtype = vtype;
	this.cnumber = cnumber;
}
//***************************************************************************
//funtion to display the dependent details automatically
function fillvisadetails(depid)
{
	obj1 = depid;
 	for(var k=0;k < visaarray.length;k++)
	 {
			obj2 = visaarray[k].vid;
			if(obj1 == obj2)
			{
				//fill the details in the form
				frmemp.vid.value = obj1;
				frmemp.txtvdate.value= visaarray[k].tdate;		
				frmemp.txtvcountry.value= visaarray[k].tplace;						
				frmemp.txttype.value= visaarray[k].vtype;		
				frmemp.txtcnum.value= visaarray[k].cnumber;
				frmemp.optionval.value = "Visadetails";		
			}            
	 }
}
//***************************************************************************
//***************************************************************************

//function to store the country details
function naturerecord(nid,nexp,namt,remarks)
{
	this.nid = nid;
	this.nexp = nexp;
	this.namt = namt;
	this.rem = remarks;
}
//***************************************************************************
//funtion to display the dependent details automatically
function fillnaturedetails(depid)
{
	obj1 = depid;
 	for(var k=0;k < narray.length;k++)
	 {
			obj2 = narray[k].nid;
			if(obj1 == obj2)
			{
				//fill the details in the form
				aptfrm.nid.value = obj1;
				aptfrm.expense.value= narray[k].nexp;		
				aptfrm.expamt.value= narray[k].namt;						
				aptfrm.txtremarks.value= narray[k].rem;				
				aptfrm.optionval.value = "naturexp";		
			}            
	 }
}
//***************************************************************************
//***************************************************************************

//function to store the country details
function naturerecord1(nid1,nexp1,namt1,rem1)
{
	this.nid1 = nid1;
	this.nexp1= nexp1;
	this.namt1 = namt1;
	this.rem1 = rem1;
}
//***************************************************************************
//funtion to display the dependent details automatically
function fillnaturedetails1(depid)
{
	obj1 = depid;
 	for(var k=0;k < narray1.length;k++)
	 {
			obj2 = narray1[k].nid1;
			if(obj1 == obj2)
			{
				//fill the details in the form
				aptfrm.nid1.value = obj1;
				aptfrm.expense1.value= narray1[k].nexp1;		
				aptfrm.expamt1.value= narray1[k].namt1;						
				aptfrm.txtremarks1.value= narray1[k].rem1;		
				aptfrm.optionval.value = "naturexp1";		
			}            
	 }
}
//***************************************************************************
//***************************************************************************

//function to store the country details
function rrecord(rid,rexp,ramt)
{
	this.rid = rid;
	this.rexp = rexp;
	this.ramt = ramt;
	
}
//***************************************************************************
//funtion to display the dependent details automatically
function fillrealdetails(depid)
{
	obj1 = depid;
 	for(var k=0;k < rarray.length;k++)
	 {
			obj2 = rarray[k].rid;
			if(obj1 == obj2)
			{
				//fill the details in the form
				aptfrm.realid.value = obj1;
				aptfrm.ninc.value= rarray[k].rexp;		
				aptfrm.namt.value= rarray[k].ramt;						
				aptfrm.optionval.value = "realexp";		
			}            
	 }
}
//***************************************************************************

//funtion to display the realestate details automatically
function fillrealdetails1(depid)
{
	obj1 = depid;
 	for(var k=0;k < rarray1.length;k++)
	 {
			obj2 = rarray1[k].rid1;
			if(obj1 == obj2)
			{
				//fill the details in the form
				aptfrm.realid1.value = obj1;
				aptfrm.ninc1.value= rarray1[k].rexp1;		
				aptfrm.namt1.value= rarray1[k].ramt1;						
						
				aptfrm.optionval.value = "realexp1";		
			}            
	 }
}


//***************************************************************************


//function to store the country details
function rrecord1(rid1,rexp1,ramt1)
{
	this.rid1 = rid1;
	this.rexp1 = rexp1;
	this.ramt1 = ramt1;
	
}
//***************************************************************************



//***************************************************************************
//***************************************************************************
//***************************************************************************

//function to store the country details
function orecord1(oid1,oexp1,oamt1)
{
	this.oid1 = oid1;
	this.oexp1 = oexp1;
	this.oamt1 = oamt1;

}
//***************************************************************************
//funtion to display the dependent details automatically
function fillotherdetails1(depid)
{
	obj1 = depid;
 	for(var k=0;k < oarray1.length;k++)
	 {
			obj2 = oarray1[k].oid1;
			if(obj1 == obj2)
			{
				//fill the details in the form
				aptfrm.oid1.value = obj1;
				aptfrm.income1.value= oarray1[k].oexp1;		
				aptfrm.incamt1.value= oarray1[k].oamt1;						
				aptfrm.optionval.value = "otherexp1";		
			}            
	 }
}
//***************************************************************************
//***************************************************************************

//function to store the country details
function orecord(oid,oexp,oamt)
{
	this.incoid = oid;
	this.oexp = oexp;
	this.oamt = oamt;

}
//***************************************************************************
//funtion to display the dependent details automatically
function fillotherdetails(depid)
{
	obj1 = depid;
 	for(var k=0;k < oarray.length;k++)
	 {
			obj2 = oarray[k].incoid;
			if(obj1 == obj2)
			{
				//fill the details in the form
				aptfrm.oid.value = obj1;
				aptfrm.income.value= oarray[k].oexp;		
				aptfrm.incamt.value= oarray[k].oamt;						
				aptfrm.optionval.value = "otherexp";		
			}            
	 }
}
//***************************************************************************
//function for the next button
function nextotherdetails(form)
{
	form.rdpage.value=""
	return chkotherdetails(form);
}
//*********************************************************************************
function chkoexp(form)
	{
				//check for null values in the txtstate field
				if(form.txtstate.value=="" || !form.txtstate.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate.focus();
						return false;
					}				
				form.roexp.value = "roexp";
				//check for null values in the txtapart field
				if(form.txtapart.value=="" || !form.txtapart.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart.focus();
						return false;
					}
					obj =form.txtapart.value;
					
					//check if it is a valid price
				if(isNaN(form.txtapart.value) || obj.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart.focus();
						return false;
					}
					
					if(form.txtfdate.value=="" || !form.txtfdate.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txtfdate.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate) == false)
						return false;
						
					if(form.txttodate.value=="" || !form.txttodate.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txttodate.focus();
						return false;
					}
					
					if(checkdate(form.txttodate) == false)
						return false;
					
				
			
				//check for null values in the txtbed field
				if(form.txtbed.value=="" || !form.txtbed.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed.focus();
						return false;
					}
					obj1 = form.txtbed.value;

				//check if it is a valid price
				if(isNaN(form.txtbed.value) || obj1.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl.value=="" || !form.txtutl.value)
					{
						alert("Please enter the utilities available in the apartment");
						form.txtutl.focus();
						return false;
					}
					
				
					
					//check for null values in the txtph field
				if(form.txtph.value=="" || !form.txtph.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins.value=="" || !form.txtins.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins.focus();
						return false;
					}
					
				//check if it is a valid price
				ins = form.txtins.value;
				if(isNaN(form.txtins.value) || ins.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins.focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur.value=="" || !form.txtfur.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur.focus();
						return false;
					}
					
				//check if it is a valid price
				fur = form.txtfur.value;
				if(isNaN(form.txtfur.value) || fur.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov.value=="" || !form.txtmov.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov.focus();
						return false;
					}
					
				//check if it is a valid price
				mov = form.txtmov.value;
				if(isNaN(form.txtmov.value) || mov.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur.value=="" || !form.txtrentfur.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr = form.txtrentfur.value;
				if(isNaN(form.txtrentfur.value) || ftr.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry.value=="" || !form.txtdry.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln = form.txtdry.value;
				if(isNaN(form.txtdry.value) || dcln.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty.value=="" || !form.txtcounty.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity.value=="" || !form.txtcity.value)
					{
						alert("Please enter the City & Telephone number");
						form.txtcity.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse = form.reimburse.value;
				if(isNaN(form.reimburse.value) || reimburse.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse.focus();
						return false;
					}
					//check if it is a valid price
				charity = form.charity.value;
				if(isNaN(form.charity.value) || charity.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity.focus();
						return false;
					}
					
					//check if it is a valid price
				//check if it is a valid price
				pprice = form.pprice.value;
				if(isNaN(form.pprice.value) || pprice.valueOf()<0)
					{
						alert("Purchase Price should be numeric");
						form.pprice.focus();
						return false;
					}
					//check if it is a valid price
				finamt = form.finamt.value;
				if(isNaN(form.finamt.value) || finamt.valueOf()<0)
					{
						alert("Finance Amount should be numeric");
						form.finamt.focus();
						return false;
					}
					
				//check if it is a valid price
				fincharges = form.fincharges.value;
				if(isNaN(form.fincharges.value) || fincharges.valueOf()<0)
					{
						alert("Finance charges should be numeric");
						form.fincharges.focus();
						return false;
					}
					
					//check if it is a valid price
				rtax = form.rtax.value;
				if(isNaN(form.rtax.value) || rtax.valueOf()<0)
					{
						alert("Real estate tax charges should be numeric");
						form.rtax.focus();
						return false;
					}
					
				//check if nature is entered
				if(form.ninc.value == "" || !form.ninc.value)
					{
						alert("Enter the nature of Other Expenses");
						form.ninc.focus();
						return false;
					}
					
				//check if nature is entered
				if(form.namt.value == "" || !form.namt.value)
					{
						alert("Enter the amount for the Other Expenses");
						form.namt.focus();
						return false;
					}	
						
					
				//check if it is a valid price
				namt = form.namt.value;
				if(isNaN(form.namt.value) || namt.valueOf()<0)
					{
						alert("Other expenses charges should be numeric");
						form.namt.focus();
						return false;
					}
			form.optionval.value = "realexp";
			return true;
		}
//*******************************************************************************************
//*********************************************************************************
function chkoexp1(form)
	{
					//check for null values in the txtstate field
				if(form.txtstate1.value=="" || !form.txtstate1.value)
					{
						alert("Please enter the State you are filing for");
						form.txtstate1.focus();
						return false;
					}
					form.roexp.value = "roexp";
						//check for null values in the txtapart field
				if(form.txtapart1.value=="" || !form.txtapart1.value)
					{
						alert("Please enter the Apartment Rent mortgage value");
						form.txtapart1.focus();
						return false;
					}
					obj11 =form.txtapart1.value;
					
					if(form.txtfdate1.value=="" || !form.txtfdate1.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txtfdate1.focus();
						return false;
					}
					
					if(checkdate(form.txtfdate1) == false)
						return false;
						
						if(form.txttodate1.value=="" || !form.txttodate1.value)
					{
						alert("Please enter your Dependent' date of Birth.");
						form.txttodate1.focus();
						return false;
					}
					
					if(checkdate(form.txttodate1) == false)
						return false;
					
				//check if it is a valid price
				if(isNaN(form.txtapart1.value) || obj11.valueOf()<0)
					{
						alert("Please enter a Valid Apartment Rent");
						form.txtapart1.focus();
						return false;
					}
			
				//check for null values in the txtbed field
				if(form.txtbed1.value=="" || !form.txtbed1.value)
					{
						alert("Please enter the number of Bedrooms in the apartment ");
						form.txtbed1.focus();
						return false;
					}
					obj12 = form.txtbed1.value;

				//check if it is a valid price
				if(isNaN(form.txtbed1.value) || obj11.valueOf()<0)
					{
						alert("Number of Bedrooms should be numeric");
						form.txtbed1.focus();
						return false;
					}

				//check for null values in the txtutl field
				if(form.txtutl1.value=="" || !form.txtutl1.value)
					{
						alert("Please enter the utilities available in the apartment");
						form.txtutl1.focus();
						return false;
					}
					
				
					
					//check for null values in the txtph field
				if(form.txtph1.value=="" || !form.txtph1.value)
					{
						alert("Please enter the Telephone charges");
						form.txtph1.focus();
						return false;
					}
					
				//check if it is a valid price
				if(isNaN(form.txtph1.value))
					{
						alert("Telephone charges should be numeric");
						form.txtph1.focus();
						return false;
					}
			
				//check for null values in the txtins field
				if(form.txtins1.value=="" || !form.txtins1.value)
					{
						alert("Please enter the Insurance charges");
						form.txtins1.focus();
						return false;
					}
					
				//check if it is a valid price
				ins1 = form.txtins1.value;
				if(isNaN(form.txtins1.value) || ins1.valueOf()<0)
					{
						alert("Insurance charges should be numeric");
						form.txtins1focus();
						return false;
					}

				//check for null values in the txtfur field
				if(form.txtfur1.value=="" || !form.txtfur1.value)
					{
						alert("Please enter the Furnishing & other charges");
						form.txtfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				fur1 = form.txtfur1.value;
				if(isNaN(form.txtfur1.value) || fur1.valueOf()<0)
					{
						alert("Furnishing charges should be numeric");
						form.txtfur1.focus();
						return false;
					}

				//check for null values in the txtmov field
				if(form.txtmov1.value=="" || !form.txtmov1.value)
					{
						alert("Please enter the Moving costs incurred");
						form.txtmov1.focus();
						return false;
					}
					
				//check if it is a valid price
				mov1 = form.txtmov1.value;
				if(isNaN(form.txtmov1.value) || mov1.valueOf()<0)
					{
						alert("Moving charges should be numeric");
						form.txtmov1.focus();
						return false;
					}
					
				//check for null values in the txtrentfur field
				if(form.txtrentfur1.value=="" || !form.txtrentfur1.value)
					{
						alert("Please enter the Rental furniture charges");
						form.txtrentfur1.focus();
						return false;
					}
					
				//check if it is a valid price
				ftr1 = form.txtrentfur1.value;
				if(isNaN(form.txtrentfur1.value) || ftr1.valueOf()<0)
					{
						alert("Furniture charges should be numeric");
						form.txtrentfur1.focus();
						return false;
					}


				//check for null values in the txtdryclean field
				if(form.txtdry1.value=="" || !form.txtdry1.value)
					{
						alert("Please enter the Dry cleaning/Laundry charges");
						form.txtdry1.focus();
						return false;
					}
					
				//check if it is a valid price
				dcln1 = form.txtdry1.value;
				if(isNaN(form.txtdry1.value) || dcln1.valueOf()<0)
					{
						alert("Dry cleaning/Laundry charges should be numeric");
						form.txtdry1.focus();
						return false;
					}

				//check for null values in the txtcounty field
				if(form.txtcounty1.value=="" || !form.txtcounty1.value)
					{
						alert("Please enter the County where you lived ");
						form.txtcounty1.focus();
						return false;
					}

				//check for null values in the txtcity field
				if(form.txtcity1.value=="" || !form.txtcity1.value)
					{
						alert("Please enter the City & Telephone number");
						form.txtcity1.focus();
						return false;
					}
				
				//check if it is a valid price
				reimburse1 = form.reimburse1.value;
				if(isNaN(form.reimburse1.value) || reimburse1.valueOf()<0)
					{
						alert("reimburse charges should be numeric");
						form.reimburse1.focus();
						return false;
					}
					//check if it is a valid price
				charity1 = form.charity1.value;
				if(isNaN(form.charity1.value) || charity1.valueOf()<0)
					{
						alert("charity contributions should be numeric");
						form.charity1.focus();
						return false;
					}
					
					//check if it is a valid price
				//check if it is a valid price
				pprice = form.pprice1.value;
				if(isNaN(form.pprice1.value) || pprice.valueOf()<0)
					{
						alert("Purchase Price should be numeric");
						form.pprice1.focus();
						return false;
					}
					//check if it is a valid price
				finamt = form.finamt1.value;
				if(isNaN(form.finamt1.value) || finamt.valueOf()<0)
					{
						alert("Finance Amount should be numeric");
						form.finamt1.focus();
						return false;
					}
					
				//check if it is a valid price
				fincharges = form.fincharges1.value;
				if(isNaN(form.fincharges1.value) || fincharges.valueOf()<0)
					{
						alert("Finance charges should be numeric");
						form.fincharges1.focus();
						return false;
					}
					
					//check if it is a valid price
				retax = form.retax1.value;
				if(isNaN(form.retax1.value) || retax.valueOf()<0)
					{
						alert("Real estate tax charges should be numeric");
						form.retax1.focus();
						return false;
					}
					
				//check if nature is entered
				if(form.ninc1.value == "" || !form.ninc1.value)
					{
						alert("Enter the nature of Other Expenses");
						form.ninc1.focus();
						return false;
					}
					
				if(form.namt1.value == "" || !form.namt1.value)
					{
						alert("Enter the amount for the Other Expenses");
						form.namt1.focus();
						return false;
					}	
					
					//check if it is a valid price
				namt = form.namt1.value;
				if(isNaN(form.namt1.value) || namt.valueOf()<0)
					{
						alert("Other expenses charges should be numeric");
						form.namt1.focus();
						return false;
					}
			form.optionval.value = "realexp1";
			return true;
		}
//*******************************************************************************************

//function to store the country details
function busrecord(bid,expnature,amt)
{
	this.bid = bid;
	this.expnature = expnature;
	this.amt = amt;
}
//***************************************************************************
//funtion to display the dependent details automatically
function fillexpdetails(depid)
{
	obj1 = depid;
 	for(var k=0;k<busarray.length;k++)
	 {
			obj2 = busarray[k].bid;
			if(obj1 == obj2)
			{
				//fill the details in the form
				businessfrm.otherid.value = obj1;
				businessfrm.expnature.value= busarray[k].expnature;		
				businessfrm.expamount.value= busarray[k].amt;						
			}            
	 }
}
//***************************************************************************
//function to check for null values in the automobileusage form
	function checkautoexp(form)
	{
		//check for valid dates entry
		if(form.pdate.value != "")
		{
			if(checkdate(form.pdate) == false)
				return false;
		}
		
		if(form.sdate.value != "")
		{
			if(checkdate(form.sdate) == false)
				return false;
		}
		
		if(form.ldate.value != "")
		{
			if(checkdate(form.ldate) == false)
				return false;
		}
		
		//check for non-numeric values in the price fields if entered
		//for the cost field		
		if(form.cost.value != "")
		{
			if(isNaN(form.cost.value) || form.cost.value <0)
			{
				alert("Please enter a valid amount here");
				form.cost.focus();
				return false;
			}
		}
		
		//for the insurance field
		if(form.insurance.value != "")
		{
			if(isNaN(form.insurance.value) || form.insurance.value <0)
			{
				alert("Please enter a valid amount for insurance");
				form.insurance.focus();
				return false;
			}
		}			
		
		//for the tolls field
		if(form.tolls.value != "")
		{
			if(isNaN(form.tolls.value) || form.tolls.value <0)
			{
				alert("Please enter a valid amount for Tolls & Parking");
				form.tolls.focus();
				return false;
			}
		}
		

		//for the repairs field
		if(form.repairs.value != "")
		{
			if(isNaN(form.repairs.value) || form.repairs.value <0)
			{
				alert("Please enter a valid amount for Repairs");
				form.repairs.focus();
				return false;
			}
		}
		
		//for the license field
		if(form.license.value != "")
		{
			if(isNaN(form.license.value) || form.license.value <0)
			{
				alert("Please enter a valid amount for License");
				form.license.focus();
				return false;
			}
		}
		
		//for the mileage field
		if(form.mileage.value != "")
		{
			if(isNaN(form.mileage.value) || form.mileage.value <0)
			{
				alert("Please enter a valid mileage value");
				form.mileage.focus();
				return false;
			}
		}
		
		//for the gallon field
		if(form.gallon.value != "")
		{
			if(isNaN(form.gallon.value) || form.gallon.value <0)
			{
				alert("Please enter a valid mileage/gallon value");
				form.gallon.focus();
				return false;
			}
		}
		
		//for the estmiles field
		if(form.estmiles.value != "")
		{
			if(isNaN(form.estmiles.value) || form.estmiles.value <0)
			{
				alert("Please enter a valid estimation for Miles");
				form.estmiles.focus();
				return false;
			}
		}
		
		//for the bmileage field
		if(form.bmileage.value != "")
		{
			if(isNaN(form.bmileage.value) || form.bmileage.value <0)
			{
				alert("Please enter a valid Business Mileage");
				form.bmileage.focus();
				return false;
			}
		}
		
		//for the reimburse field
		if(form.reimburse.value != "")
		{
			if(isNaN(form.reimburse.value) || form.reimburse.value <0)
			{
				alert("Please enter a valid Reimburse amount");
				form.reimburse.focus();
				return false;
			}
		}
		
		
		
		//for the mpayment field
		if(isNaN(form.dpay.value) || form.dpay.value <0)
			{
				alert("Please enter a valid Down payment amount");
				form.dpay.focus();
				return false;
			}
		if(isNaN(form.mpayment.value) || form.mpayment.value <0)
			{
				alert("Please enter a valid Monthly Payment");
				form.mpayment.focus();
				return false;
			}
		if(isNaN(form.loanterms.value) || form.loanterms.value <0)
			{
				alert("Please enter a valid Monthly Payment");
				form.loanterms.focus();
				return false;
			}
		if(form.mpayment.value != "")
		{
			if(form.dpay.value == "")
			{
				alert("Please enter Down Payments");
				form.dpay.focus();
				return false;
			}
			
			
			if(form.loanterms.value == "")
			{
				alert("Please enter Down Payments");
				form.loanterms.focus();
				return false;
			}
			
		}
		if(form.dpay.value != "")
		{
			if(form.mpayment.value == "")
			{
				alert("Please enter Monthly Payments");
				form.mpayment.focus();
				return false;
			}
			
			
			if(form.loanterms.value == "")
			{
				alert("Please enter Loan Terms");
				form.loanterms.focus();
				return false;
			}
			
		}
		if(form.loanterms.value != "")
		{
			if(form.dpay.value == "")
			{
				alert("Please enter Down Payments");
				form.dpay.focus();
				return false;
			}
			
			
			if(form.mpayment.value == "")
			{
				alert("Please enter Monthly Payments");
				form.mpayment.focus();
				return false;
			}
			
		}
		
		
		//for the saleprice field
		if(form.saleprice.value != "")
		{
			if(isNaN(form.saleprice.value) || form.saleprice.value <0)
			{
				alert("Please enter a valid amount for Sale Price");
				form.saleprice.focus();
				return false;
			}
		}
		
		if(isNaN(form.leasepay.value) || form.leasepay.value <0)
			{
				alert("Please enter Lease Payment/Month in numeric");
				form.leasepay.focus();
				return false;
			}
		if(isNaN(form.leaseterms.value) || form.leaseterms.value <0)
			{
				alert("Please enter a valid amount for Monthly Payment");
				form.leaseterms.focus();
				return false;
			}
		
		if(form.leasepay.value != "")
		{
			if(form.leaseterms.value == "")
			{
				alert("Please enter Terms of Lease");
				form.leaseterms.focus();
				return false;
			}
			
			
			if(form.ldate.value == "")
			{
				alert("Please enter Date Of Lease");
				form.ldate.focus();
				return false;
			}
			
		}
		
		if(form.leaseterms.value != "")
		{
			if(form.leasepay.value == "")
			{
				alert("Please enter Lease Payment/Month");
				form.leasepay.focus();
				return false;
			}
			
			
			if(form.ldate.value == "")
			{
				alert("Please enter Date Of Lease");
				form.ldate.focus();
				return false;
			}
			
		}
		if(form.ldate.value != "")
		{
			if(form.leasepay.value == "")
			{
				alert("Please enter Lease Payment/Month");
				form.leasepay.focus();
				return false;
			}
			
			
			if(form.leaseterms.value == "")
			{
				alert("Please enter Term Of Lease");
				form.leaseterms.focus();
				return false;
			}
			
		}
		
	}
//***************************************************************************************************	
//function for the save button
function saveautoexp(form)
{
	form.rdpage.value="Close";
	return checkautoexp(form);
}

//***************************************************************************************************	

//function for the save button
function savelivingapt(form)
{
	form.rdpage.value="Close";
	return chklivingapt(form);
}



//***************************************************************************
//funtion to display the 1099 details automatically
function gdetails(form,tp,sp,tpsno,spsno)
{
			var grn;
			grn = form.txtrname.value;
			//alert("tp is"+grn);
			if(form.txtrname.value == tp)
			{
					//alert("tp is"+tp);
				//fill the details in the form
				form.txtfid.value = tpsno;										
			}      
			else   
				{
					form.txtfid.value = spsno;
				}  
		return true; 
	
}
//******************************************************************************************
//***************************************************************************
//function to get the net loss/gain of scheduleD
//coded by deepa on 5/6/2004
function gnetgain(id,form,kk)
{
    if(kk=="txtcost[]")
    {
    aa=0;
    bb=0;
    aa=parseFloat(id);
    bb=aa-1;
    cc=aa+1;
    }
    else
    {
        aa=0;
        bb=0;
        bb=parseFloat(id);
        aa=bb+1;
        cc=aa+1;
    }
	//var netgainloss,gprice,cost;
    //gprice = 0;
    gprice = form.elements[bb].value;
	cost = form.elements[aa].value;
  //alert("gpice"+gprice+"cost"+cost);
    if(gprice=="" || gprice<0)
    {
    gprice=0;
    }
     if(cost=="" || cost<0)
    {
    cost=0;
    }
     //alert("gprice"+gprice+"cost"+cost);
	netgainloss =gprice-cost;
    //alert("gprice"+gprice+cost+netgainloss);
	form.elements[cc].value = netgainloss;
	return true;

}	
//************************************************************************************************
 //*************************************************************
 //function to add other business exp page
 //coded by deeepa on 04122004
 function checkacbusexp(form)
 {
     //alert("acc") ;
      if(form.expnature.value=="" || !form.expnature.value)
          {
              alert("Please enter Nature of Expenses");
              form.expnature.focus();
              return false;
          }
      if(form.expamount.value=="" || !form.expamount.value)
          {
              alert("Please enter Nature of Expenses Amount");
              form.expamount.focus();
              return false;
          }
       if(isNaN(form.expamount.value) || form.expamount.value<0)
       {
           alert("Please enter a valid number here");
           form.expamount.focus();
            return false;
    }

         return true;
 }
 //***************************************************************************

	//for the Meals information
	//Coded by Deepa on 16-3-2004
	//function to check the valid number
	function checkaccautoexp(form)
	{
		//check for null values in the fields
				//alert("in");
		//alert("inside");


		num = form.accinsurance.value;

		if(form.accinsurance.value!="")
			{
				if(isNaN(form.accinsurance.value) || num.valueOf() <0)
						{

							alert("Please enter a valid number here");
							form.accinsurance.focus();
							return false;
						}


			}

		/*if(isNaN(form.accinsurance.value) || num.valueOf() <0)
		{
			if(form.accinsurance.value=="" || !form.accinsurance.value)
						{
							return true;
						}
					else
						{

							alert("Please enter a valid number here");
							form.accinsurance.focus();
							return false;
						}

		}*/

		num1 = form.accrepairs.value;
		//alert("inside1");
		if(isNaN(form.accrepairs.value) || num1.valueOf()<0)
		{
			if(form.accrepairs.value=="" || !form.accrepairs.value)
						{
							//return true;
						}
					else
						{
							alert("Please enter a valid Repair number here");
							form.accrepairs.focus();
							return false;
						}
		}
		num2 = form.acccost.value;
		/*
		if(isNaN(form.acccost.value) || num2.valueOf()<0)
		{
			if(form.acccost.value=="" || !form.acccost.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acccost.focus();
							return false;
						}
		}*/
		//alert("inside2");
		//alert("in");
		num3 = form.acctolls.value;
		//alert("inside3");
		if(isNaN(form.acctolls.value) || num3.valueOf() <0)
		{
			if(form.acctolls.value=="" || !form.acctolls.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acctolls.focus();
							return false;
						}
		}
		num4 = form.acclicense.value;

		if(isNaN(form.acclicense.value) || num4.valueOf() <0)
		{
			if(form.acclicense.value=="" || !form.acclicense.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acclicense.focus();
							return false;
						}
		}

		num5 = form.accmiles.value;
		//alert("inside4");
		if(isNaN(form.accmiles.value) || num5.valueOf() <0)
		{
			if(form.accmiles.value=="" || !form.accmiles.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accmiles.focus();
							return false;
						}
		}
		num6 = form.accestmiles.value;

		if(isNaN(form.accestmiles.value) || num6.valueOf() <0)
		{
			if(form.accestmiles.value=="" || !form.accestmiles.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accestmiles.focus();
							return false;
						}
		}

		num7 = form.accmileage.value;

		if(isNaN(form.accmileage.value) || num7.valueOf() <0)
		{
			if(form.accmileage.value=="" || !form.accmileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accmileage.focus();
							return false;
						}
		}
		num8 = form.accbmileage.value;

		if(isNaN(form.accbmileage.value) || num8.valueOf() <0)
		{
			if(form.accbmileage.value=="" || !form.accbmileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accbmileage.focus();
							return false;
						}
		}

		num9 = form.accavgcost.value;

		if(isNaN(form.accavgcost.value) || num9.valueOf() <0)
		{
			if(form.accavgcost.value=="" || !form.accavgcost.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accavgcost.focus();
							return false;
						}
		}
		num11 = form.accbusmile.value;
		//alert("inside");
		if(isNaN(form.accbusmile.value) || num11.valueOf() <0)
		{
			if(form.accbusmile.value=="" || !form.accbusmile.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accbusmile.focus();
							return false;
						}
		}
		var num12,num13,tot;
		num12 = form.acctotmileage.value;
		/*if(isNaN(form.acctotmileage.value) || num12.valueOf() <0)
		{
			if(form.acctotmileage.value=="" || !form.acctotmileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acctotmileage.focus();
							return false;
						}
		}*/
		num13 = form.accpermileage.value;
		var tot;
		//num11 = parseFloat("num11");
		//num13 = parseFloat("num13");
		tot = parseFloat(form.accbusmile.value)+parseFloat(form.accpermileage.value);

		//tot = parseFloat(tot);

		//alert("total"+tot);
		form.acctotmileage.value = num11+num13;
		if(isNaN(form.accpermileage.value) || num13.valueOf() <0)
		{
			if(form.accpermileage.value=="" || !form.accpermileage.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accpermileage.focus();
							return false;
						}
		}

		num14 = form.gascharges.value;

		if(isNaN(form.gascharges.value) || num14.valueOf() <0)
		{
			if(form.gascharges.value=="" || !form.gascharges.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.gascharges.focus();
							return false;
						}
		}
		num15 = form.accreimburse.value;

		if(isNaN(form.accreimburse.value) || num15.valueOf() <0)
		{
			if(form.accreimburse.value=="" || !form.accreimburse.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accreimburse.focus();
							return false;
						}
		}

		numa = form.accdpay.value;

		if(isNaN(form.accdpay.value) || numa.valueOf() <0)
		{
			if(form.accdpay.value=="" || !form.accdpay.value)
						{
							return true;
						}
					else
						{
								alert("Please enter a valid number here");
								form.accdpay.focus();
								return false;
						}
		}
		numb = form.accmpay.value;

		if(isNaN(form.accmpay.value) || numb.valueOf() <0)
		{
			if(form.accmpay.value=="" || !form.accmpay.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accmpay.focus();
							return false;
						}
		}

		numc = form.accterms.value;
		//alert("inside");
		if(isNaN(form.accterms.value) || numc.valueOf() <0)
		{
			if(form.accterms.value=="" || !form.accterms.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accterms.focus();
							return false;
						}
		}
		numd = form.fincharges.value;

		if(isNaN(form.fincharges.value) || numd.valueOf() <0)
		{
			if(form.fincharges.value=="" || !form.fincharges.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.fincharges.focus();
							return false;
						}
		}
		nume = form.accsaleprice.value;

		if(isNaN(form.accsaleprice.value) || nume.valueOf() <0)
		{
			if(form.accsaleprice.value=="" || !form.accsaleprice.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.accsaleprice.focus();
							return false;
						}
		}

		numf = form.acclterms.value;

		if(isNaN(form.acclterms.value) || numf.valueOf() <0)
		{
			if(form.acclterms.value=="" || !form.acclterms.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acclterms.focus();
							return false;
						}
		}
		numg = form.acclpay.value;

		if(isNaN(form.acclpay.value) || numg.valueOf() <0)
		{
			if(form.acclpay.value=="" || !form.acclpay.value)
						{
							return true;
						}
					else
						{
							alert("Please enter a valid number here");
							form.acclpay.focus();
							return false;
						}
		}
		if(checkdate(form.accpdate) == false)
					return false;
		if(checkdate(form.accsdate) == false)
					return false;
		if(checkdate(form.accldate) == false)
					return false;
				//num13 = form.accpermileage.value;
		//tot = num11+num13;
		//alert("total"+tot);
		form.acctotmileage.value =tot;
        mile =   parseFloat(form.accmileage.value);
        //alert("m"+mile);
        pp = tot/parseFloat(form.accmileage.value);
        //gexp = parseFloat
        gexp = pp*parseFloat(form.accavgcost.value);
       // alert("gexp"+gexp);
       // alert("pp"+pp);
        form.gascharges.value = gexp;
		return true;
	}

/*********** Coded by Vimala on 07/12/2004 *********/
var total=0;
function ReimbTotal(form)
{
	if(form.txtq1.value=="Yes" && form.txtq2.value=="Yes")
	{

		j=form.elements.length;
		k=3;
		for(i=1;i<4;i++)
		{
			alert(form.elements[k+2].value);
			total = parseFloat(total)+ parseFloat(form.elements[k+2].value);
			k=k+2;
			//rem=parseFloat(rem);
		}
	  alert("total="+total);

		return true;
	}
	if(form.txtq1.value=="Yes" && form.txtq2.value=="No")
	{

	}
	return true;

}
/********************************** Till Here **************/

//********************************function to validate Mealsinfo Form************
	//coded by Vimala on 07/12/2004
	function MealinfoCheck(form)
	{
		if(form.txtq1.value=="Yes" && form.txtq2.value=="Yes")
		{
          j = form.elements.length;
		  //alert(form.mealid.value);
		  if(form.mealid.value=="" || !form.mealid.value)
		  {
          		for(i=2;i<j-5;)
             	{
                 //alert("i="+i);
                	if(form.elements[i].value == "" && form.elements[i+1].value == "")
                
                    {
                        //return true;
                    }
               		else
                   {

					if(form.elements[i+1].value == "" || !form.elements[i+1].value)
					{
						alert("Please enter the Employer Name");
						form.elements[i+1].focus();
						return false;
					}
					if(form.elements[i+2].value == "" || !form.elements[i+2].value)
					{
						alert("Please enter the Reimbursement Amount");
						form.elements[i+2].focus();
						return false;
					}
				  }
            	}
            	i=i+2;
            }
			
			else
			{
				if(form.txtempname.value == "" || !form.txtempname.value)
				{
					alert("Please enter the Employer Name");
					form.txtempname.focus();
					return false;
				}
				if(form.txtyesrem.value == "" || !form.txtyesrem.value)
				{
					alert("Please enter the Reimbursement Amount");
					form.txtyesrem.focus();
					return false;
				}

			}
		  
			if(form.txtyesmeals.value == "" || !form.txtyesmeals.value)
			{
				alert("Please enter the Meals Expenses");
				form.txtyesmeals.focus();
				return false;
			}
		}
		else if(form.txtq1.value=="Yes" && form.txtq2.value=="No")
		{
          j = form.elements.length
		  if(form.txtnomeals.value == "" || !form.txtnomeals.value)
			{
				alert("Please enter the Meals Expenses");
				form.txtnomeals.focus();
				return false;
			}
			if(form.mealid.value=="" || !form.mealid.value)
		  {
          	for(i=2;i<j-5;)
             {
                 //alert("i="+i);
                if(form.elements[i].value == "" && form.elements[i+1].value == "")
                
                    {
                        //return true;
                    }
               else
                   {
					if(form.elements[i+2].value == "" || !form.elements[i+2].value)
					{
						alert("Please enter the Reimbursement Amount");
						form.elements[i+2].focus();
						return false;
					}
            	}
            	i=i+1;
            	}
			}
			else
			{
				if(form.txtnorem.value == "" || !form.txtnorem.value)
					{
						alert("Please enter the Reimbursement Amount");
						form.txtnorem.focus();
						return false;
					}
			}
			
		}
		return this;
	}
//*****************************************************
//function coded by deepa on 14122004
//function to validate meals information
function MealinfoCheck1(form)
{
    flen = form.elements.length;
    //alert("flen"+flen);
    flen = flen-1;
    total = 0;
    if(flen==15 || flen==6)
    {
    for(i=3;i<flen;)
       {
        if(form.elements[i].value==""&& form.elements[i+1].value==""&&form.elements[i+2].value=="")
           {
           }
        else
            {
             mexp = form.elements[i+1].value;
             rem = form.elements[i+2].value;
             mexp = parseFloat(mexp);
             rem = parseFloat(rem);
              if(form.elements[i].value=="")
                 {
                    alert("Please enter the Employer Name") ;
                    form.elements[i].focus();
                    return false;
                }
              if(form.elements[i+1].value=="")
                {
                    alert("Please enter the Meals and entertainment expenses") ;
                    form.elements[i+1].focus();
                    return false;
                }
                if(isNaN(form.elements[i+1].value)|| form.elements[i+1].value<0)
                {
                    alert("The Meals and entertainment expenses must be a Positive Number") ;
                    form.elements[i+1].focus();
                    return false;
                }
              if(form.elements[i+2].value=="")
                 {
                   alert("Please enter the Reimbursement from employer") ;
                     form.elements[i+2].focus();
                    return false;
                 }
               if(isNaN(form.elements[i+2].value)|| form.elements[i+2].value<0)
                {
                    alert("The Reimbursement from employer must be a Positive Number") ;
                    form.elements[i+2].focus();
                    return false;
                }

               if(rem>mexp)
                 {
                   alert("The Reimbursement from employer must be less than Meals and entertainment expenses") ;
                     form.elements[i+2].focus();
                    return false;
                 }

             amt=mexp-rem;
             total = total+amt;
            }

              i=i+3;
        }
        form.txtyestotal.value=total;
     fname = form.elements[3].value
   //alert("flen"+total+"nval"+fname);
   }
   else
   {
       total=0;
       for(j=3;j<flen;)
         {
             //alert("j"+j);
             if(form.elements[j].value=="" && form.elements[j+1].value=="")
                {
                }
             else
                 {
                      mexp = form.elements[j].value;
                      rem = form.elements[j+1].value;
                       mexp = parseFloat(mexp);
                       rem = parseFloat(rem);
                       if(form.elements[j].value=="")
                {
                    alert("Please enter the Meals and entertainment expenses") ;
                    form.elements[j].focus();
                    return false;
                }
                if(isNaN(form.elements[j].value)|| form.elements[j].value<0)
                {
                    alert("The Meals and entertainment expenses must be a Positive Number") ;
                    form.elements[j].focus();
                    return false;
                }
              if(form.elements[j+1].value=="")
                 {
                   alert("Please enter the Reimbursement from employer") ;
                     form.elements[j+1].focus();
                    return false;
                 }
               if(isNaN(form.elements[j+1].value)|| form.elements[j+1].value<0)
                {
                    alert("The Reimbursement from employer must be a Positive Number") ;
                    form.elements[i+2].focus();
                    return false;
                }

               if(rem>mexp)
                 {
                   alert("The Reimbursement from employer must be less than Meals and entertainment expenses") ;
                     form.elements[j+1].focus();
                    return false;
                 }

             amt=mexp-rem;
             total = total+amt;
                 }
               j=j+2;
         }
         form.txtyestotal.value=total;
   }

    return true;
}
//****************************************************
//funtion to display the dependent details automatically
function fillmealsdetails(form,depid)
{
    var a;
	obj1 = depid;
      a=mealsfrm.elements.length;
      //alert("a="+a);
 	for(var k=0;k < detarray.length;k++)
	 {
           var i=2
			obj2 = detarray[k].id;
			if(obj1 == obj2)
			{
				//alert("Match found for the Depid"+obj1);
				//fill the details in the form
            	mealsfrm.elements[153].value = detarray[k].id;
				mealsfrm.elements[i].value= detarray[k].fname;
				mealsfrm.elements[i+1].value= detarray[k].lname;
			}
	 }
}

//****************************************************************************
//Coded by Vimala on 08/12/2004 
//Function to validate Tax Payer/Spouse form

function chkgeneral(form)
{
	//to see weather entered marital status or not
	if(form.optinfo[0].checked == false && form.optinfo[1].checked == false)
	{
		alert("Please select Tax Payer information or Spouse information");
		form.optinfo[0].focus();
		return false;
	}
	
}	

//***************************************************************************	

