	function TxtCounter(field, countField, Max )
	{
		if (field.value.length > Max )
			field.value = field.value.substring(0,Max);
		else	
			countField.value = Max - field.value.length;
	}

	function radChk1( obj, target )
	{
		if(obj.checked==true)
		{
			target.disabled=false;
		}
	}
	
	function radChk2( obj, target )
	{
		if(obj.checked==true)
		{ 	
			target.value="";
			form1.otherCoaching.value = "";
			target.disabled=true;
		}
	}
	
	function EnableOthers()
	{	
		var val;
		val = form1.coachInst.options[form1.coachInst.options.selectedIndex].value;
		if( val == "Others") 
			form1.otherCoaching.disabled = false;
		else{
			form1.otherCoaching.value = "";
			form1.otherCoaching.disabled = true;
			}
	}
		
	function Validate( flg )
	{
		if ( flg == "true" )
		{
			if(form1.TestCenter.value == "" )
			{
				alert('Please select the Test center!');
				form1.TestCenter.focus();
				return false;
			} 
			
			if(form1.Prefix.options[form1.Prefix.options.selectedIndex].value == "Select" )
			{
				alert('Please select the prefix!');
				form1.Prefix.focus();
				return false;
			} 
		
		if(form1.sName.value == "" )
		{
			alert('Please enter your name!');
			form1.sName.focus();
			return false;
		}
		if(form1.sQuali.value == "" )
		{
			alert('Please enter your highest qualification!');
			form1.sQuali.focus();
			return false;
		}
		if(form1.sAddress1.value == "" )
		{
			alert('Please enter the Address!');
			form1.sAddress1.focus();
			return false;
		}
		if(form1.sCity.value == "" )
		{
			alert('Please enter the city where you live!');
			form1.sCity.focus();
			return false;
		}
		if(form1.sState.options[form1.sState.options.selectedIndex].value == "Select" )
		{
			alert('Please select the state!');
			form1.sState.focus();
			return false;
		} 
		if(form1.sTelNo.value == "" )
		{
			alert('Please enter a contact number!');
			form1.sTelNo.focus();
			return false;
		}
		if(form1.sTelNo.value != "" )
		{
			if( isNaN(form1.sTelNo.value) )
			{	alert('Please enter a valid contact number!');
				form1.sTelNo.focus();
				return false;
			}
			if( (form1.sTelNo.value.substring(0,3) == "123") || (form1.sTelNo.value.substring(0,3) == "111"))
			{	alert('Please enter a valid contact number!');
				form1.sTelNo.focus();
				return false;
			}	
		}
		if(form1.sEmail.value == "" )
		{
			alert('Please enter a valid email id!');
			form1.sEmail.focus();
			return false;
		}
		if(form1.sEmail.value!="")
		{
			var mail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			if (!mail.test(form1.sEmail.value)) 
			{
				alert("! Please enter a valid email address eg:info@ibsindia.org !");
				form1.sEmail.focus();
				form1.sEmail.select();
				return false;
			}
		}
		if(form1.DD.options[form1.DD.options.selectedIndex].value == "DD" )
		{
			alert('Please select your date of birth!');
			form1.DD.focus();
			return false;
		}
		if(form1.MM.options[form1.MM.options.selectedIndex].value == "MM" )
		{
			alert('Please select your month of birth!');
			form1.MM.focus();
			return false;
		}
		if(form1.YYYY.options[form1.YYYY.options.selectedIndex].value == "YYYY" )
		{
			alert('Please select your year of birth!');
			form1.YYYY.focus();
			return false;
		}    
		
		if(form1.sInstitute.value == "" )
		{
			alert('Please enter name of the institute where you are currently studying!');
			form1.sInstitute.focus();
			return false;
		}
		
		if((form1.Coaching[0].checked == false) && (form1.Coaching[1].checked == false))
		{
			alert('Please indicate if you are attending any coaching classes!');
			form1.Coaching[0].focus();
			return false;
		}
		
		if(form1.Coaching[0].checked == true )
		{ 
			if(form1.coachInst.options[form1.coachInst.options.selectedIndex].value == "Select" )
			{
				alert('Please select one of the coaching institutes listed below!');
				form1.coachInst.focus();
				return false;
			}  
			if( (form1.coachInst.options[form1.coachInst.options.selectedIndex].value == "Others" ) && (form1.otherCoaching.value == "" ))
			{
				alert('Please enter the coaching institutes name!');
				form1.otherCoaching.focus();
				return false;
			}  	 
		}
		
	} //  if ( flg == "true" )
		
	if ( flg != "true" )
	{
		if( document.getElementById("reg").checked == false )
		{
			alert('Cannot proceed without confirming to register for Practice Test');
			return false;
		}
	}
		 	
	}	
	//--------------------------------------------------------------------//
	function frmSubmit( url )
	{
		document.form1.action = url ;
		document.form1.method = "post";
		document.form1.submit();
		return true;
	}
	
	// Reprint 
	
	function chkForm( flg )
	{
		if ( flg == "true" )
		{
			if(form1.admitCardNo.value == "" )
			{
				alert('Please enter the admit card number!');
				form1.admitCardNo.focus();
				return false;
			}
			if( form1.admitCardNo.value!= "" )
			{
				if( form1.admitCardNo.value.substring(0,2) != "PT" )
				{
					alert('Enter a valid admit card number ( case sensitive )');
					form1.admitCardNo.focus();
					return false;
				}
			}
		}
		if ( flg == "false" )
		{
			if( document.getElementById("reg").checked == false )
			{
				alert('Cannot proceed without confirming to register for Practice Test');
				return false;
			}	
		}
		
		if(form1.sEmail.value == "" )
		{
			alert('Please enter a valid email id!');
			form1.sEmail.focus();
			return false;
		}
		if(form1.sEmail.value!="")
		{
			var mail = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			if (!mail.test(form1.sEmail.value)) 
			{
				alert("! Please enter a valid email address eg:info@ibsindia.org !");
				form1.sEmail.focus();
				form1.sEmail.select();
				return false;
			}
		}
	
	}
	
	
	
	
	function MM_findObj(n, d) { //v4.01
    var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_showHideLayers() { //v6.0
    var i,p,v,obj,args=MM_showHideLayers.arguments;
    for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
	}
//-->