function checkug()
{
  ugbutton = document.form1.ugbutton.value;
  course = document.form1.ug.value;
  if(document.form1.ug.value=="")
  {
     alert("Select Course Name");
	 document.form1.ug.focus();
	 return false;
  }

  ugregno = document.form1.ugregno.value;
  if(document.form1.ugregno.value=="")
  {
     alert("Enter Reg No");
	 document.form1.ugregno.focus();
	 return false;
  }
  
   	newwindow=window.open('result3.php?ugregno='+ugregno+'&ugcourse='+course+'&ugbutton='+ugbutton,'name','scrollbars=no,height=620,width=700,screenX=400,screenY=400,top=0,left=0');
	if (window.focus) {newwindow.focus()}
	 return false;

}

function checkpg()
{
  pgbutton = document.form2.pgbutton.value;
  course = document.form2.pg.value;
  var selIndex = document.form2.pg.selectedIndex
 coursetext = document.form2.pg.options[selIndex].text;

  if(document.form2.pg.value=="")
  {
     alert("Select Course Name");
	 document.form2.pg.focus();
	 return false;
  }

  pgregno = document.form2.pgregno.value;
  if(document.form2.pgregno.value=="")
  {
     alert("Enter Reg No");
	 document.form2.pgregno.focus();
	 return false;
  }
  
//newwindow=window.open('result3.php?ugregno='+pgregno+'&coursetext='+coursetext+'&ugcourse='+course+'&ugbutton='+pgbutton,'name','scrollbars=no,height=620,width=700,screenX=400,screenY=400,top=0,left=0');

	if (window.focus) {newwindow.focus()}
	 return false;

}




/* Alumini registration */

function check_alumini()
{
	
	
	var no=/[^-()'/,&.0-9 ]/;
	var char=/[^-()'/,&.A-Z.a-z ]/;
	name=document.form1.name.value;
	email=document.form1.email.value;
	phoneno=document.form1.phoneno.value;
	department=document.form1.department.value;
	yearofjoin=document.form1.yearofjoin.value;
	//yearofleaving=document.form1.yearofleaving.value;
	Designation=document.form1.Designation.value;
	//occupation=document.form1.occupation.value;
	Address=document.form1.Address.value;
	var FLOG=0;
	if(name=="")
	{
		alert("please enter student name");
		document.form1.name.focus();
		FLOG=1;
		return false;
		
		
	}
	if((document.form1.r1[0].checked==false) && (document.form1.r1[1].checked==false))
	{
  	 alert("Please Select Sex");
	 FLOG=1;
	 return false;
  	}
	if(email=="")
	{
		alert("please enter E-Mail id");
		document.form1.email.focus();
			 FLOG=1;
			 return false;
	}
	
	
	if (isEmail(document.form1.email.value) == false)
	{
        alert("Please enter a valid email address.");
        document.form1.mail.focus();
			 FLOG=1;
        return false;
    }
	
	if(phoneno=="")
	{
		alert("please enter Phone No");
		document.form1.phoneno.focus();
			 FLOG=1;
			 return false;
	}
	if(document.form1.phoneno.value.match(no))
	{
		alert("Eenter number only");
		document.form1.phoneno.value="";
		document.form1.phoneno.focus();
			 FLOG=1;
			 return false;
	}
	if(department=="")
	{
		alert("please Choose Department");
		document.form1.department.focus();
			 FLOG=1;
			 return false;
	}
	if(yearofjoin=="")
	{
		alert("please enter year of join");
		document.form1.yearofjoin.focus();
			 FLOG=1;
			 return false;
	}
	if(document.form1.yearofjoin.value.match(no))
	{
		alert("Eenter number only");
		document.form1.yearofjoin.value="";
		document.form1.yearofjoin.focus();
			 FLOG=1;
			 return false;
	}	
	/*if(yearofleaving=="")
	{
		alert("please enter year of leaving");
		document.form1.yearofleaving.focus();
			 FLOG=1;
	}
	if(document.form1.yearofleaving.value.match(no))
	{
		alert("Eenter number only");
		document.form1.yearofleaving.value="";
		document.form1.yearofleaving.focus();
			 FLOG=1;
	}	*/
	if(Designation=="")
	{
		alert("please enter Designation");
		document.form1.yearofleaving.focus();
			 FLOG=1;
	}
	/*if(occupation=="")
	{
		alert("please enter occupation");
		document.form1.occupation.focus();
			 FLOG=1;
	}*/
	if(Address=="")
	{
		alert("please enter Address");
		document.form1.Address.focus();
			 FLOG=1;
			 return false;
				
	}
	/*if(FLOG==0)
	{
		t = '/insert.php';
		t = encodeURI (t); // encode URL
		// assign form's action a new value. Original "action" value will be overwritten.
		f1.action = t;
		f1.submit(); // submit form using javascript
		return true;

	}*/
	
	function isEmail(string) {
    if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
        return true;
    else
        return false;
}


	
}


