//************************************************************************************************************
	var globalArray = new Array()	
	var globalCount=-1

function validate()
{

	if(document.registration.Username.value.length < 5)
	{
		globalArray.length=0
		globalCount=-1
		alert("Username must have minimum 5 letters")
		document.registration.Username.select()
		document.registration.Username.focus() 
		 
		return false	
	}	
	
	if(document.registration.Username.value.length > 20)
	{
		globalArray.length=0
		globalCount=-1
		alert("Username do not allowed to exceed 20 letters")
		document.registration.Username.select()
		document.registration.Username.focus() 
		 
		return false	
	}	
	
	if(document.registration.Password.value.length < 5)
	{
		globalArray.length=0
		globalCount=-1
		alert("Password must have minimum 5 letters")
		document.registration.Password.select()
		document.registration.Password.focus() 
		 
		return false	
	}	
	
	if(document.registration.Password.value.length > 20)
	{
		globalArray.length=0
		globalCount=-1
		alert("Password do not allowed to exceed 20 letters")
		document.registration.Password.select()
		document.registration.Password.focus() 
		 
		return false	
	}	

	if(document.registration.Name.value == "")
	{
		globalArray[++globalCount] = "\n Name : "
	}	
	
	if(document.registration.Name.value.length > 30)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Name is 30 !!! "
	}	
	if(document.registration.Gender.value == "false")
	{
		globalArray[++globalCount] = "\n Gender : "
	}
	if(!document.registration.NoOfChildren.disabled)
	{	
		if(document.registration.NoOfChildren.value == "false")
		{			
			globalArray[++globalCount] = "\n No Of Children : "			
		}	
	}	
	if(document.registration.Height.value == "false")
	{
		globalArray[++globalCount] = "\n Height : "
	}
	if(document.registration.Complexion.value == "false")
	{
		globalArray[++globalCount] = "\n Complexion : "
	}
	
	if(document.registration.religion.value == "SelectReligion")
	{
		globalArray[++globalCount] = "\n Religion : "
	}	

	if(document.registration.Marital_Status.value == "false")
	{
		globalArray[++globalCount] = "\n Marital Status : "
	}
	if(document.registration.State_Country.value == "false")
	{
		globalArray[++globalCount] = "\n State : "
	}
	if(document.registration.City.value == "")
	{
		globalArray[++globalCount] = "\n District : "
	}
	if(document.registration.City.value.length > 20)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of District is 20 !!! "
	}
	if(document.registration.NowResiding.value.length > 50)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Now Residing is 50 !!! "
	}			
	if(document.registration.Qualification.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Qualification is 100 !!! "
	}				
	if(document.registration.Education_Level.value == "false")
	{
		globalArray[++globalCount] = "\n Education Level : "
	}
	if(document.registration.Job_Category.value == "false")
	{
		globalArray[++globalCount] = "\n Job Category : "
	}
	if(document.registration.JobDescription.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Job Description is 100 !!! "
	}	
	if(document.registration.BriefDetails.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Brief Details is 100 !!! "
	}	
	
	if(document.registration.Monthly_Income.value == "false")
	{
		globalArray[++globalCount] = "\n Monthly Income : "
	}
	if(document.registration.Share_of_Property.value == "false")
	{
		globalArray[++globalCount] = "\n Share of property : "
	}
	if(document.registration.Other_Details.value.length > 250)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Other Details is 250 !!! "
	}	
	if(document.registration.Name_Of_Guardian.value == "")
	{
		globalArray[++globalCount] = "\n Name Of Guardian : "
	}
	if(document.registration.Name_Of_Guardian.value.length > 30)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Guardian's name is 30 !!! "
	}	
	if(document.registration.Relationship.value == "false")
	{
		globalArray[++globalCount] = "\n Relationship : "
	}
	
	if(document.registration.Address.value == "")
	{
		globalArray[++globalCount] = "\n Address : "
	}
	
	if(document.registration.Address.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Address is 100 !!! "
	}	
	if(document.registration.Phone.value == "")
	{
		globalArray[++globalCount] = "\n Phone : "
	}
	if(document.registration.Phone.value.length > 30)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Phone is 30 !!! "
	}	
	if(document.registration.Email.value.length > 40)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Email is 40 !!! "
	}	
	if(document.registration.Fathers_Job.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Father's Job is 100 !!! "
	}				
	if(document.registration.Mothers_Job.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Mother's Job is 100 !!! "
	}				
	
	if(document.registration.DemandJobDescription.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Demand Job Description is 100 !!! "
	}
	if(document.registration.Birth_Place.value.length > 100)
	{
		globalArray[++globalCount] = "\n Maximum allowed length of Demand Birth Place is 100 !!! "
	}	
			
	if((registration.Photo.value).length > 0 )
	{
		if(!validateFileExtension("registration","Photo"))
		{
			alert("Only jpg , gif  formats are allowed")
			globalArray.length=0
			globalCount=-1	
			categoryCount = 0
		
			return false
		}
	}		
	if(globalCount>=0)
	{
		alert("Following fields should not be empty \n"+globalArray)
		globalArray.length=0
		globalCount=-1
		
		return false
	}
	else
	{		
		return true
	}
	
}

function searchSpace(name)
{
	var str = name.value
	
	if( str.indexOf(" ",0) >= 0 )
	{
		alert ("Please do not use any space.");
		name.focus();
		name.select();
		return false;
	}
	else
	{return true;}
}

function loadPicture(picturename)
{

	document.smallPicture.src = document.registration.Photo.value 	
	
}

function validateFileExtension(form,picturename)
{
	fileName = document.getElementById(picturename).value
	//fileName = form.Small_Picture.value
	fileName = fileName.toLowerCase()
	if( fileName!= "" )
	{
		index = fileName.length-1
		strTemp=""		
		for(i=0;i<3;i++)
		{
			strTemp = strTemp+fileName.charAt(index--)
		}
	
		if( (strTemp=="fig") || (strTemp== "gpj")|| (strTemp== "gepj"))
			return true
		else
			return false		
	}
	
}
function ManageChildrens(name1,name2)
{

	if(name1.value=="Never married" || name1.value=="false")
	{
		name2.disabled = true
	}
	else
	{
		name2.disabled = false
	}

}