function day()
{
	for (var intLoop = 1; intLoop < 32; intLoop++)
	document.write("<OPTION>" + intLoop +"</option>");
}
function month()
{
	for (var intLoop = 1; intLoop <= 12; intLoop++)
		document.write("<OPTION>" + intLoop +"</option>");
		
		//document.write("<OPTION>" + intLoop+"</option>");
}
function year()
{
	for (var intLoop = 1970; intLoop < 2040; intLoop++)
			document.write("<OPTION>" + intLoop+"</option>");
}
function ayear()
{
	for (var intLoop = 1995; intLoop < 2040; intLoop++)
			document.write("<OPTION>" + intLoop+"</option>");
}
function display_add()
{
	var fm=document.frm;
	if(fm.check12.checked==true)
	{
	fm.caddress.value=fm.paddress.value;
	fm.cpin.value=fm.ppin.value;
	fm.cstd.value=fm.pstd.value;
	fm.cphone.value=fm.pphone.value;
	fm.cmobile.value=fm.pmobile.value;
	}
	/*else
	{
	fm.caddress.value="";
	fm.cpin.value="";
	fm.cstd.value="";
	fm.cphone.value="";
	fm.cmobile.value="";	
	}*/
	
}

function numeralsOnly(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : 
        ((evt.which) ? evt.which : 0));
	   if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46) {
        alert("Enter numerals only in this field.");
        return false;
    }
    return true;
}

function sum()
{
	var fm=document.frm;
	var count=0,i;
	var tt=0;
	var num_arr=new Array(0);
	var num1=isNaN(parseFloat(fm.m1.value))==true?0:parseFloat(fm.m1.value);
	num_arr[0]=num1;
		//alert(num1.toFixed(2));
	var num2=isNaN(parseFloat(fm.m2.value))==true?0:parseFloat(fm.m2.value);
	num_arr[1]=num2;
	var num3=isNaN(parseFloat(fm.m3.value))==true?0:parseFloat(fm.m3.value);
	num_arr[2]=num3;
	var num4=isNaN(parseFloat(fm.m4.value))==true?0:parseFloat(fm.m4.value);
	num_arr[3]=num4;	
	var num5=isNaN(parseFloat(fm.m5.value))==true?0:parseFloat(fm.m5.value);
	num_arr[4]=num5;
	var num6=isNaN(parseFloat(fm.m6.value))==true?0:parseFloat(fm.m6.value);
	num_arr[5]=num6;
	var num7=isNaN(parseFloat(fm.m7.value))==true?0:parseFloat(fm.m7.value);
	num_arr[6]=num7;
	var num8=isNaN(parseFloat(fm.m8.value))==true?0:parseFloat(fm.m8.value);
	num_arr[7]=num8;
	for(i=0;i<=7;i++)
	{
		tt=tt+num_arr[i];
		if(num_arr[i]!=0)
		count=count+1;
	}
	var agg=tt/count;
	fm.m_agg.value=agg.toFixed(2);
}

function selectcheck()
{
	
var i;
var ecount=document.frm.elements.length;

if(document.frm.elements[0].checked==true)
 {
 for(i=1;i<ecount-1;i++)
document.frm.elements[i].checked=true;
}
else
{
for(i=1;i<ecount-1;i++)
document.frm.elements[i].checked=false;
}
}
function del_check(msgg)
{
var i,num;
num=0;
var ecount=document.frm.elements.length;	
for(i=1;i<ecount-1;i++)
{
	if(document.frm.elements[i].checked==true)
	num=num+1;
	
}

if(num>0)
{
var mflag=window.confirm(msgg);

if(mflag==true)
return true;
else
return false;
}
else
{
	alert("Please select the rows to delete");
	return false;
}

}

/*function select_batch()
{
	var select_yrs=parseInt(document.all.yr_adms.selectedIndex);
	var select_crs=document.all.hide_crs.value;
	if(select_crs=="B.Tech")
   {
	var add_selectyr=select_yrs+4;
	document.all.btch.selectedIndex=add_selectyr;
   }



}
*/

function check_fval()
{
var fm=document.frm;
if(fm.crs.value=="0")
{
alert("Enter the Course");
fm.crs.focus();
return false;
}
else
if(fm.btch.value=="0")
{
alert("Enter the batch");
fm.btch.focus();
return false;
}
else
if(fm.brch.value=="")
{
alert("Enter the branch");
fm.brch.focus();
return false;
}
/*else
return true;*/
}




/*********** function ********************************************************/
var em  = new Array();
var st = new Array();
em[1] = "1,2,3,4,5,6,18,29";em[2] = "10,29";em[3] = "9,18,19,29";em[4] = "11,29";em[5] = "12,29";em[6] = "20,21,22,23,24,25,26,27,28,29";em[7] = "14,29";em[8] = "15,29";em[9] = "16,29";em[10] = "17,29";em[11] = "7,8,29";em[12] = "30";em[13] = "30";em[14] = "30";

st[1] = "Information Technology";st[2] = "Computer Science & Engineering";st[3] = "Civil Engineering";st[4] = "Electronics & Communication Engineering";st[5] = "Electrical & Electronics Engineering";st[6] = "Mechanical Engineering";st[7] = "Information Technology";st[8] = "Software Technology";st[9] = "Industrial Chemistry";st[10] = "B.Pharma";st[11] = "B.P.Th.";st[12] = "B.Arch.";st[13] = "MBA";st[14] = "MCA";st[15] = "BEd";st[16] = "BBA";st[17] = "BCA"; st[18] = "BioTechnology"; st[19]= "BioInformatics"; st[20]= "Marketing"; st[21]= "Finance" ; st[22]= "Human Resource" ; st[23]= "International Business"; st[24]= "Information Technology"; st[25]= "Material And Operation"; st[26]= "Production"; st[27]= "Non Profit Organizations"; st[28]= "Quality Management";st[29]="Others";st[30]="                        ";

function populateStream(doc,any) 
{
	var streamOptLen = doc.form.brch.options.length;
var i = 0;
	for(var len=0;len<streamOptLen;len++) 
	{
	doc.form.brch.options[len].selected = false;
	}
doc.form.brch.options.length = 0;
	for(var i=0; i< doc.form.crs.options.length; i++) 
	{
	var lval = doc.form.crs.options[i].value;
	if(doc.form.crs.options[i].selected && lval.length > 0)
	 {
	var str  = em[lval];
	var map  = str.split(',');
		if(map.length >1)
		{
		var opt = new Option();
		opt.value="";
		opt.text='------Make Selection----';
		opt.selected=true;
		doc.form.brch.options[doc.form.brch.options.length] = opt;
		}
			for(var mapi=0; mapi < map.length; mapi++)
			 {
			var opt = new Option();
			opt.value=map[mapi];
			 if((opt.value == 47) && (any == 'NO')  && (lval != 7) && (lval != 8) && (lval != 10))
				 continue;
			opt.text=st[map[mapi]];
			doc.form.brch.options[doc.form.brch.options.length] = opt;
			}
	}
  }
}