function isnoselect(theField,s)
{
	if(theField.value=="")
	{
		alert("Please select the "+s);
		theField.focus();
		return false;

	}
	return true;
}

function isnoselectheight(first,second)
{
	if(first.value=="--Feet/Inches--" && second.value=="--Cms--")
	{
		alert("Please select the Height in Feet/Inches or Cms ");
		first.focus();
		return false;

	}
	return true;
}
function isnoselectweight(first,second)
{
	if(first.value=="--Kgs--" && second.value=="--Lbs--")
	{
		alert("Please select the Weight in Kgs or Lbs ");
		first.focus();
		return false;

	}
	return true;
}
function isradio(theField,s,s1)
{
	if ( IsEmpty(theField,s))
		{
			alert( "Please Select "+s1 );
			theField[0].focus( );
			return false;
		}

	
	return true;
}
function IsEmpty(obj, obj_type)
{
	if (obj_type == "text" || obj_type == "password" || obj_type == "textarea" || obj_type == "file")	{
		var objValue;
		
		objValue = obj.value.replace(/\s+$/,"");
		
		if (objValue.length == 0) {
			//obj.focus();
			return true;
		} else {
			return false;
		}
	} else if (obj_type == "select") {
		for (i=0; i < obj.length; i++) {
			if (obj.options[i].selected) {
				if(obj.options[i].value == "") {
					obj.focus();
					return true;
				} else {
					return false;
				}
			}
			
		}
		return true;	
	} 
	else if (obj_type == "radio" || obj_type == "checkbox") {
		if (!obj[0] && obj) {
			if (obj.checked) {
				return false;
			} else {
				obj.focus();
				return true;	
			}
		} else {
			for (i=0; i < obj.length; i++) {
				if (obj[i].checked) {
					return false;
				}
			}
			obj[0].focus();
			return true;
		}
	} else {
		return false;
	}
}
function empty(theField)
{
		if(theField.value=="")
		{
			return false;
		}
		return true;
}
function myself(theField,s)
{
	if(empty(theField)==false)
	{
		alert(s+" can not be Empty")
			theField.focus();
			return false;
	}
	if(theField.value.length<50)
	{
		alert(s+" can not less than 50 character")
			theField.focus();
			return false;

	}
	return true;
}
function HaveChildnp()
	{
//		var MARST = document.MatriForm.MARITAL_STATUS.options[document.MatriForm.MARITAL_STATUS.selectedIndex].value;
		var CHILDLW = document.MatriForm.NOOFCHILDREN.options[document.MatriForm.NOOFCHILDREN.selectedIndex].value;

		
		if(document.MatriForm.MARITAL_STATUS[0].checked)
		{
		document.MatriForm.NOOFCHILDREN.disabled=true;	
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;									
	    }
		else if ( document.MatriForm.MARITAL_STATUS[1].checked || document.MatriForm.MARITAL_STATUS[2].checked  || document.MatriForm.MARITAL_STATUS[3].checked )
		{
		document.MatriForm.NOOFCHILDREN.disabled=false;			
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=false;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=false;											
		}
		
		if(document.MatriForm.MARITAL_STATUS[0].checked && document.MatriForm.CHILDLIVINGWITHME[0].checked || document.MatriForm.CHILDLIVINGWITHME[1].checked)
		{
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;											
		}

		if(CHILDLW > 0)
		{
			if ( document.MatriForm.MARITAL_STATUS[0].checked)
			{
					if ( (document.MatriForm.CHILDLIVINGWITHME[0].checked || document.MatriForm.CHILDLIVINGWITHME[1].checked) && (!document.MatriForm.CHILDLIVINGWITHME[0].checked || !document.MatriForm.CHILDLIVINGWITHME[1].checked) )
					{
							document.MatriForm.CHILDLIVINGWITHME[0].checked=false;
							document.MatriForm.CHILDLIVINGWITHME[1].checked=false;
							document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
							document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;	
					}
			}
		}

		if(CHILDLW == 0)
		{
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=true;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=true;							
	    }
		else if ( CHILDLW > 1)
		{
		document.MatriForm.CHILDLIVINGWITHME[0].disabled=false;		
		document.MatriForm.CHILDLIVINGWITHME[1].disabled=false;							
		}
				
	}

function validate()
{
		var formname=this.document.MatriForm	
		if ( IsEmpty(document.MatriForm.MARITAL_STATUS,'radio'))
		{
			alert( "Please select Marital Status." );
			document.MatriForm.MARITAL_STATUS[0].focus( );
			return false;
		}

		if ( !(document.MatriForm.MARITAL_STATUS[0].checked) && MatriForm.NOOFCHILDREN.selectedIndex == 0 )
		{
			alert( "Please select the number of children" );
			document.MatriForm.NOOFCHILDREN.focus( );
			return false;
		}			
		
		if ( !(document.MatriForm.MARITAL_STATUS[0].checked) && document.MatriForm.NOOFCHILDREN.options[document.MatriForm.NOOFCHILDREN.selectedIndex].value >= 1 && !MatriForm.CHILDLIVINGWITHME[0].checked && !MatriForm.CHILDLIVINGWITHME[1].checked)
		{
			alert("Please indicate whether the child /children is/are living with you.");
			document.MatriForm.CHILDLIVINGWITHME[0].focus( );
			return false;
		}		
		if(document.MatriForm.DOBYEAR.value=="")
			{
				alert("Select Date of Birth");
				document.MatriForm.DOBYEAR.focus();
				return false;
			}		
		/*if(isradio(formname.RESIDING_STATUS,"radio"," Residing Status ")==false)
			return false;
		if(document.MatriForm.RESIDINGSTATE.value=="")
			{
				alert("Please select state");
				document.MatriForm.RESIDINGSTATE.focus();
				return false;
			}		
		if(empty(formname.RESIDINGCITY)==false)
		{
			alert("Residing City can not be Empty")
			formname.RESIDINGCITY.focus();
			return false;
		}	*/	
		
		
		if(isnoselect(formname.REGISTERED_BY,"Profile")==false)
		return false;

		return true;
		
}
function validateregular()
{
	formname=this.document.frmregular;
	
	return true;
}

