function checkPrev()
{

	var fname, lname, rel, city, zip, htel, wtel, ctel, fax, email ,tfname, tlname, gender, age, cflag, pflag;

	
	fname = document.f1.fname.value;
	lname = document.f1.lname.value ;
	rel = document.f1.rel.value ;
	city = document.f1.city.value ;
	zip = document.f1.zip.value ;
	htel = document.f1.htel.value ;
	wtel = document.f1.wtel.value ;
	ctel = document.f1.ctel.value ;
	fax = document.f1.fax.value ;
	email=document.f1.email.value;
	
	tfname=document.f1.tfname.value;
	tlname=document.f1.tlname.value;
	gender=document.f1.gender.value;
	age=document.f1.age.value;
	
	cflag=document.f1.cflag.value;
	pflag=document.f1.pflag.value;
	
	var flg1, flg2, flg3;
	flg1 =0 ;
	flg2 =0;
	flg3 =0;

	//start required field validation

	if(fname=="")
	{
		window.alert("First name can not be blank.....");
		document.f1.fname.focus(); 
		return false
	}
	else if(lname=="")
	{
		window.alert("Last name can not be blank.....");
		document.f1.lname.focus();
		return false
	}
	else if(rel=="Select")
	{
		window.alert("You must mention your Relation.....");
		document.f1.rel.focus();
		return false		
	}
	else if(email=="")
	{
		window.alert("You must mention your Email Address.....");
		document.f1.email.focus();
		return false		
	}
	else if(gender=="")
	{
		window.alert("You must mention your Teen's gender.....");
		document.f1.gender.focus();
		return false		
	}
	else if(age=="")
	{
		window.alert("You must mention your Teen's age.....");
		document.f1.age.focus();
		return false		
	}
	else if(cflag==1)
	{
		window.alert("You must mention your areas of concern.....");
		return false		
	}
	else if(pflag==1)
	{
		window.alert("You must mention the programs you are interested in.....");
		return false		
	}

	//end required field validation
	

	//start email validation

	if(email!="")
	{
		pos=email.indexOf("@");
		posdot=email.indexOf(".");
		lent=email.length;
		if(lent<7 || pos<1 || posdot<3)
		{
			window.alert("Enter E-Mail ID in proper format.....");
			document.f1.email.focus();
			return false
		}			
	}	
	
	//end email validation
	

	//Start First Name
	
	fnl = fname.length;		
	for(h=0;h<fnl;h++)
	{	q = fname.substring(h,h+1)
		if(isdigit(q)== true)
		{	flg1 = 1
			break;
		}		
		if(isspch(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No numeric value is allowed for First Name.......");
		document.f1.fname.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for First Name.....");
		document.f1.fname.focus();
		flg2 =0;
		return false
	} 
	
	//End First Name
	
	
		//Start Last Name
	lnl = lname.length;	
	for(h=0;h<lnl;h++)
	{	q = lname.substring(h,h+1)
		if(isdigit(q)== true)
		{	flg1 = 1
			break;
		}		
		if(isspch1(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No numeric value is allowed for Last Name.......");
		document.f1.lname.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for Last Name.....");
		document.f1.lname.focus();
		flg2 =0;
		return false
	} 
	
	//End Last Name
	
	//Start City
	canl = city.length;		
	for(h=0;h<canl;h++)
	{	q = city.substring(h,h+1)
		if(isdigit(q)== true)
		{	flg1 = 1
			break;
		}		
		if(isspch(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No numeric value is allowed for City.......");
		document.f1.city.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for City.....");
		document.f1.city.focus();
		flg2 =0;
		return false
	} 
	//End City


	//Start Zip Code
	czip = zip.length;
	
	if(czip>=10)
	{
		flg3=1
	}
			
	for(h=0;h<czip;h++)
	{	q = zip.substring(h,h+1)
		if(iszip(q)== false)
		{	flg1 = 1
			break;
		}		
		if(isspch1(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No charecter / special charecter value is allowed for Zip except for hyphen.......");
		document.f1.zip.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for Zip.....");
		document.f1.zip.focus();
		flg2 =0;
		return false
	} 

	if (flg3 == 1)
	{	window.alert("Not more than 10 digit is allowed for Zip.....");
		document.f1.zip.focus();
		flg2 =0;
		return false
	} 
	//End Zip Code


	//Start Home Telephone
	chtel = htel.length;
	
	if(chtel>=20)
	{
		flg3=1
	}
			
	for(h=0;h<chtel;h++)
	{	q = htel.substring(h,h+1)
		if(iszip(q)== false)
		{	flg1 = 1
			break;
		}		
		if(isspch1(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No charecter / special charecter value is allowed for Home Telephone except for hyphen.......");
		document.f1.htel.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for Home Telephone.....");
		document.f1.htel.focus();
		flg2 =0;
		return false
	} 

	if (flg3 == 1)
	{	window.alert("Not more than 20 digit is allowed for Home Telephone.....");
		document.f1.htel.focus();
		flg2 =0;
		return false
	} 
	//End Home Telephone


	//Start Work Telephone
	cwtel = wtel.length;
	
	if(cwtel>=20)
	{
		flg3=1
	}
			
	for(h=0;h<cwtel;h++)
	{	q = wtel.substring(h,h+1)
		if(iszip(q)== false)
		{	flg1 = 1
			break;
		}		
		if(isspch1(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No charecter / special charecter value is allowed for Work Telephone except for hyphen.......");
		document.f1.wtel.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for Work Telephone.....");
		document.f1.wtel.focus();
		flg2 =0;
		return false
	} 

	if (flg3 == 1)
	{	window.alert("Not more than 20 digit is allowed for Work Telephone.....");
		document.f1.wtel.focus();
		flg2 =0;
		return false
	} 
	//End Work Telephone


	//Start Cell Telephone
	cctel = ctel.length;
	
	if(cctel>=20)
	{
		flg3=1
	}
			
	for(h=0;h<cctel;h++)
	{	q = ctel.substring(h,h+1)
		if(iszip(q)== false)
		{	flg1 = 1
			break;
		}		
		if(isspch1(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No charecter / special charecter value is allowed for Cell Telephone except for hyphen.......");
		document.f1.ctel.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for Cell Telephone.....");
		document.f1.ctel.focus();
		flg2 =0;
		return false
	} 

	if (flg3 == 1)
	{	window.alert("Not more than 20 digit is allowed for Cell Telephone.....");
		document.f1.ctel.focus();
		flg2 =0;
		return false
	} 
	//End Cell Telephone


	//Start Fax
	cfax = fax.length;
	
	if(cfax>=20)
	{
		flg3=1
	}
			
	for(h=0;h<cfax;h++)
	{	q = fax.substring(h,h+1)
		if(iszip(q)== false)
		{	flg1 = 1
			break;
		}		
		if(isspch1(q) == false)
		{	flg2 = 1
			break;
		}	
	}
	if (flg1 == 1)
	{	window.alert("No charecter / special charecter value is allowed for Fax except for hyphen.......");
		document.f1.fax.focus();
		flg1 = 0;
		return false
	}	 
	if (flg2 == 1)
	{	window.alert("No special character is allowed for Fax.....");
		document.f1.fax.focus();
		flg2 =0;
		return false
	} 

	if (flg3 == 1)
	{	window.alert("Not more than 20 digit is allowed for Fax.....");
		document.f1.fax.focus();
		flg2 =0;
		return false
	} 
	//End Fax


	

	 return true
}


function isdigit(q)
{
	var d = ""
	d="" + q
	if(d=="0" || d=="1" || d=="2" || d=="3" || d=="4" || d=="5" || d=="6" || d=="7" || d=="8" || d=="9")
	{
		return true;
	}
	return false;
}
function isspch(x)
{
  y="" + x
		if( y=="!"  ||  y=="@"  ||  y=="#"  || y=="$"  || y=="%"  || y=="^"  ||  y=="&"  || y=="*"  ||  y=="("  || y==")"  ||  y==">"  || y==","   ||  y=="."   ||  y=="?"   ||  y=="/"   ||  y=="'"   ||  y=="-"    ||  y=="_"    ||  y=="+"   ||  y=="="   || y=='/'    ||  y=="|" || y=="&#92;")
		{
			return false;
		}
return true;
}


function iszip(q)
{
	var d = ""
	d="" + q
	if(d=="0" || d=="1" || d=="2" || d=="3" || d=="4" || d=="5" || d=="6" || d=="7" || d=="8" || d=="9" || d=="-")
	{
		return true;
	}
	return false;
}


function isspch1(x)
{
  y="" + x
		if( y=="!"  ||  y=="@"  ||  y=="#"  || y=="$"  || y=="%"  || y=="^"  ||  y=="&"  || y=="*"  ||  y=="("  || y==")"  ||  y==">"  || y==","   ||  y=="."   ||  y=="?"   ||  y=="/"   ||  y=="'"   ||  y=="_"    ||  y=="+"   ||  y=="="   || y=='/'    ||  y=="|" || y=="&#92;")
		{
			return false;

		}
return true;
}
