function schcode()
{
	mfcode = new String();
	var flag,len1,scode,scode1,fname;
	if(document.navrec100.elements['scode'].value=="")
	{
		alert("no blanks please")
		flag="B";
	}
	else
	{
		scode=document.navrec100.scode.value
		if(fname="")
		{
			fname="snap";
		}
		len1=scode.length
		for(i=0;i<3;i++)
		{
			result=scode.charAt(i)
			if(scode==" ")
			{
				alert("no spaces allowed")
				flag=="B";
				break;
			}
			else
			{
				scode1=scode;	
			}
		}
	}
	
	if(scode!=" " && flag!="B")
	{
		fname=document.navrec100.fname.value
		document.navrec100.action="/mf/mfinfo/mfcodesearch.php?scode="+scode+"&scode1="+scode1+"&flag="+flag+"&fname="+fname;
		document.navrec100.submit();
	}
	else
	{
		document.navrec100.scode.focus();
	}
}

function sname()
{
	var flag,fname,tempvar;
	var lenc;
	var i=0;
	if(document.navrec100.AMCname.value =="")
	{
		alert("no blanks please")
		flag="false";
	}
	else
	{
		AMCname= new String(document.navrec100.AMCname.value);
		if(fname="")
		{
			fname="snap";
		}
		flag="true"
	}
	if(flag=="true")
	{
		fname=document.navrec100.fname.value
		document.navrec100.action="/mf/mf_info/mfsearch.php?AMCname="+escape(AMCname)+"&fname="+fname;
		document.navrec100.submit();
	}
	else
	{
		document.navrec100.AMCname.focus();
	}
}

function tocheck()
{
	if(document.navrec100.AMCname.value=="MF Scheme Search" || document.navrec100.AMCname.value=="Scheme Name")
	{
		 alert("Please Enter Scheme Name");
		 document.navrec100.AMCname.focus();
		 return(false);
	}
	if(document.navrec100.AMCname.value.length<3)
	{
		 alert("Please enter minimum 3 characters to search")
		 return(false);
	}

	sname();
	return (true);
	/*if(document.navrec100.AMCname.value!="")
	{
		if (document.navrec100.scode.value!="" && (document.navrec100.AMCname.value=="MF Scheme Search" || document.navrec100.AMCname.value==""))
		{
			schcode();
			return (true);
		}
		else
		{
			if (document.navrec100.AMCname.value!="" && (document.navrec100.scode.value=="Scheme Code" || document.navrec100.scode.value==""))
			{
				sname();
				return (true);
			}
			else
			{
				 alert("Please Enter Any One Field")
				 return(false);
			}
		}
	}*/	

	/*if(document.navrec100.AMCname.value=="")
	{
		alert("Please Enter Scheme Name")
		return(false);
	}*/
	//return(true);
}

function returnfunc()
{
	imid=document.myform.imid.value;
	imffid=document.myform.imffid.value;
	imdesc=document.myform.imdesc.value;
	ffdesc=document.myform.ffdesc.value;
	firstdt=document.myform.firstdt.value;
	lastdt=document.myform.lastdt.value;
	fdt=document.myform.fdt.value;
	ldt=document.myform.ldt.value;
	
	myfromdt1=document.myform.fromdt1.value;
	myfromdt2=document.myform.fromdt2.value;
	myfromdt3=document.myform.fromdt3.value;

	mytodt1=document.myform.todt1.value;
	mytodt2=document.myform.todt2.value;
	mytodt3=document.myform.todt3.value;

	myfromdt=myfromdt3+""+myfromdt2+""+myfromdt1;
	mytodt=mytodt3+""+mytodt2+""+mytodt1;

	if(myfromdt2=="02")
	{
		rem = myfromdt3 % 4;
		if (rem != 0)
		{
			if (myfromdt1 > 28)
			{
				alert("Invalid From Date enterred");
				mytmpvar=document.myform.fromdt1;
				mytmpvar.focus();
				return false;
			}
		}
	}
	
	if(myfromdt2=="04" || myfromdt2=="06" || myfromdt2=="09" || myfromdt2=="11")
	{
		if(myfromdt1 > "30")
		{
			alert("Invalid From Date enterred");
			mytmpvar=document.myform.fromdt1;
			mytmpvar.focus();
			return false;
		}
	}

	if(mytodt2=="02")
	{
		rem = mytodt3 % 4;
		if (rem != 0)
		{
			if (mytodt1 > 28)
			{
				alert("Invalid To Date enterred");
				mytmpvar=document.myform.todt1;
				mytmpvar.focus();
				return false;
			}
		}
	}

	if(mytodt2=="04" || mytodt2=="06" || mytodt2=="09" || mytodt2=="11")
	{
		if(mytodt1 > "30")
		{
			alert("Invalid To Date enterred");
			mytmpvar=document.myform.todt1;
			mytmpvar.focus();
			return false;
		}
	}

	if(myfromdt > mytodt)
	{
		alert("From Date cannot be greater than To Date");
		mytmpvar=document.myform.todt1;
		mytmpvar.focus();
		return false;
	}

	if(myfromdt < fdt)
	{
		alert("Start Date cannot be before "+firstdt);
		mytmpvar=document.myform.fromdt1;
		mytmpvar.focus();
		return false;
	}

	if(mytodt > ldt)
	{
		alert("End Date cannot be greater than "+lastdt);
		mytmpvar=document.myform.fromdt1;
		mytmpvar.focus();
		return false;
	}

	document.myform.action="/mf/mf_info/returns.php?im_id="+imid+"&im_ffid="+imffid+"&im_desc="+imdesc+"&ff_desc="+ffdesc+"&retcalc=true&frdate="+myfromdt+"&todate="+mytodt;
}