// JavaScript Document
 function callMeEnquiry1()
{
   if(document.form1.sName.value=="sitm1234")
    {
	   document.form1.submit();
  	}
  else 
  {
	  alert("You are not authorised user");
	   document.form1.sName.focus();
  }
	
}

 function callMeEnquiry()
{
   if(document.form1.sName.value=="")
    {
	   alert("Please enter student Name");
	   document.form1.sName.focus();
 	}
	else if(document.form1.fName.value=="")
    {
	   alert("Please enter Father's Name");
	   document.form1.fName.focus();
 	}
	else if(document.form1.address.value=="")
    {
	   alert("Please enter address");
	   document.form1.address.focus();
 	}
	else if(document.form1.dob.value=="")
    {
	   alert("Please enter Date of Birth");
	   document.form1.dob.focus();
 	}
 else 
 document.form1.submit();
	
}
 
function openFile(obj)
{
   //alert(obj);
  window.open(obj,'_self');
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//alumniSITM
function validate()
{
if(checkempty(document.getinfo.Name.value))
    {
     alert("Please Fill the Complete Form")
     document.getinfo.Name.focus();
     return false
     }
if(checkempty(document.getinfo.Father.value))
    {
     alert("Please Fill the Father's Name")
     document.getinfo.Father.focus();
     return false
     }	 
if(checkempty(document.getinfo.Address.value))
    {
     alert("Address Field is Empty")
     document.getinfo.Address.focus();
     return false
    }
if(checkempty(document.getinfo.Batch.value))
    {
     alert("Please Select Your Batch")
     document.getinfo.stream.focus();
     return false
    }
if(checkempty(document.getinfo.Stream.value))
    {
     alert("Please Select Your Batch")
     document.getinfo.stream.focus();
     return false
    }	
if(checkempty(document.getinfo.Email.value))
    {
     alert("Please Fill the Email ID")
     document.getinfo.Email.focus();
     return false
     }	 
	 	 
   var mail=document.getinfo.Email.value;
   if ((mail.indexOf("@") ==-1) || (mail.indexOf("."))== -1) 
     {
        alert("Please type a valid email:");
        getinfo.Email.focus(); 
        return false;
    }
      

if(checkempty(document.getinfo.stream.value))
    {
     alert("Please Select Your Stream")
     document.getinfo.stream.focus();
     return false
    }
    
if(!(checkname(document.getinfo.Name.value)))
	{	
	alert("Name can have only 'a-z A-Z space' characters ")
	document.getinfo.Name.focus();
    document.getinfo.Name.select();
    return false
    }  
if(!(checkname(document.getinfo.Father.value)))
	{	
	alert("Father's Name can have only 'a-z A-Z space' characters ")
	document.getinfo.Father.focus();
    document.getinfo.Father.select();
    return false
    }      

if(!(checknumber(document.getinfo.YearofAdm.value)))
    {
    alert("Year of Admission can only have numerical value ")
    document.getinfo.YearofAdm.focus();
    document.getinfo.YearofAdm.select();
    return false         
    }        

      
if(!(checkmail(document.getinfo.Email.value)))
    {
    alert("Email address is not valid or it may have only spaces")
    document.getinfo.Email.focus();
    document.getinfo.Email.select();
    return false         
    }        
}
// end of validate 
function checkmail(str)
 {
  var len,i
  len=str.length
  if (len==0)
  return true
  for (i=0;i<len;i++)
   { 
    if(str.charAt(i)=="@")
     return true
    }
   return false  
 }//end of checkmail
 
function checkempty(str)
 {
  var len,i
  len=str.length
  for (i=0;i<len;i++)
   { 
    if(str.charAt(i)!=" ")
     return false
    }
   return true  
 }//end of checkempty


function checkname(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(65)&& ch<=String.fromCharCode(90))||(ch>=String.fromCharCode(97)&& ch<=String.fromCharCode(122))||(ch==String.fromCharCode(32))||(ch==String.fromCharCode(46)) ))
    return false
   }
  return true
 }//end of checkname
 
 function checknumber(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(48)&& ch<=String.fromCharCode(57))||(ch==String.fromCharCode(44)) ))
    return false
   }
  return true
 }//end of checknumber
 function checkstd(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(48)&& ch<=String.fromCharCode(57)) ))
    return false
   }
  alert("Thank You for submitting your data "); 
  return true
 }//end of checkstd

function openFile(obj)
{
   //alert(obj);
  window.open(obj,'_self');
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

//alumniSITMa
function validate()
{
if(checkempty(document.getinfo.Name.value))
    {
     alert("Please Fill the Complete Form")
     document.getinfo.Name.focus();
     return false
     }
if(checkempty(document.getinfo.Father.value))
    {
     alert("Please Fill the Father's Name")
     document.getinfo.Father.focus();
     return false
     }	 
if(checkempty(document.getinfo.Address.value))
    {
     alert("Address Field is Empty")
     document.getinfo.Address.focus();
     return false
    }
if(checkempty(document.getinfo.Batch.value))
    {
     alert("Please Select Your Batch")
     document.getinfo.stream.focus();
     return false
    }
if(checkempty(document.getinfo.Stream.value))
    {
     alert("Please Select Your Batch")
     document.getinfo.stream.focus();
     return false
    }	
if(checkempty(document.getinfo.Email.value))
    {
     alert("Please Fill the Email ID")
     document.getinfo.Email.focus();
     return false
     }	 
	 	 
   var mail=document.getinfo.Email.value;
   if ((mail.indexOf("@") ==-1) || (mail.indexOf("."))== -1) 
     {
        alert("Please type a valid email:");
        getinfo.Email.focus(); 
        return false;
    }
      

if(checkempty(document.getinfo.stream.value))
    {
     alert("Please Select Your Stream")
     document.getinfo.stream.focus();
     return false
    }
    
if(!(checkname(document.getinfo.Name.value)))
	{	
	alert("Name can have only 'a-z A-Z space' characters ")
	document.getinfo.Name.focus();
    document.getinfo.Name.select();
    return false
    }  
if(!(checkname(document.getinfo.Father.value)))
	{	
	alert("Father's Name can have only 'a-z A-Z space' characters ")
	document.getinfo.Father.focus();
    document.getinfo.Father.select();
    return false
    }      

if(!(checknumber(document.getinfo.YearofAdm.value)))
    {
    alert("Year of Admission can only have numerical value ")
    document.getinfo.YearofAdm.focus();
    document.getinfo.YearofAdm.select();
    return false         
    }        

      
if(!(checkmail(document.getinfo.Email.value)))
    {
    alert("Email address is not valid or it may have only spaces")
    document.getinfo.Email.focus();
    document.getinfo.Email.select();
    return false         
    }        
}
// end of validate 
function checkmail(str)
 {
  var len,i
  len=str.length
  if (len==0)
  return true
  for (i=0;i<len;i++)
   { 
    if(str.charAt(i)=="@")
     return true
    }
   return false  
 }//end of checkmail
 
function checkempty(str)
 {
  var len,i
  len=str.length
  for (i=0;i<len;i++)
   { 
    if(str.charAt(i)!=" ")
     return false
    }
   return true  
 }//end of checkempty


function checkname(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(65)&& ch<=String.fromCharCode(90))||(ch>=String.fromCharCode(97)&& ch<=String.fromCharCode(122))||(ch==String.fromCharCode(32))||(ch==String.fromCharCode(46)) ))
    return false
   }
  return true
 }//end of checkname
 
 function checknumber(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(48)&& ch<=String.fromCharCode(57))||(ch==String.fromCharCode(44)) ))
    return false
   }
  return true
 }//end of checknumber
 function checkstd(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(48)&& ch<=String.fromCharCode(57)) ))
    return false
   }
  alert("Thank You for submitting your data "); 
  return true
 }//end of checkstd

function openFile(obj)
{
   //alert(obj);
  window.open(obj,'_self');
}
function showImage(obj)
{
  //alert(obj);
  window.open("gallery/building/1.JPG",'_blank');
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
//FAQSITM
function toggle(obj) {
// Moz. or IE
var sibling=(obj.nextSibling.nodeType==3)? obj.nextSibling.nextSibling
: obj.nextSibling;
// hide or show
if(sibling.style.display=='' || sibling.style.display=='block') {
sibling.style.display='none'; obj.firstChild.firstChild.data='+'; }
else { sibling.style.display='block';
obj.firstChild.firstChild.data='-'; }
}
//
function initCollapse() {
var oDT=document.getElementById('content').getElementsByTagName('dt');
for (var i=0; i < oDT.length; i++) { oDT[i].onclick=function()
{
toggle(this)}; var oSpan=document.createElement('span'); 
var sign=document.createTextNode('+');
oSpan.appendChild(sign);
oDT[i].insertBefore(oSpan, oDT[i].firstChild);
oSpan.style.fontFamily='monospace'; 
oSpan.style.paddingRight='0.5em';
oDT[i].style.cursor='pointer'; 
toggle(oDT[i]); 
}
oDT=null;
}
window.onload=function() {if(document.getElementById && document.createElement) {initCollapse();}}


<!--facultyAppliedSITM
function validate()
{
if(checkempty(document.getinfo.Name.value))
    {
     alert("Please Fill the Complete Form")
     document.getinfo.Name.focus();
     return false
     }
if(checkempty(document.getinfo.Father.value))
    {
     alert("Please Fill the Father's Name")
     document.getinfo.Father.focus();
     return false
     }	 
if(checkempty(document.getinfo.Address.value))
    {
     alert("Address Field is Empty")
     document.getinfo.Address.focus();
     return false
    }
if(checkempty(document.getinfo.Batch.value))
    {
     alert("Please Select Your Batch")
     document.getinfo.stream.focus();
     return false
    }
if(checkempty(document.getinfo.Stream.value))
    {
     alert("Please Select Your Batch")
     document.getinfo.stream.focus();
     return false
    }	
if(checkempty(document.getinfo.Email.value))
    {
     alert("Please Fill the Email ID")
     document.getinfo.Email.focus();
     return false
     }	 
	 	 
   var mail=document.getinfo.Email.value;
   if ((mail.indexOf("@") ==-1) || (mail.indexOf("."))== -1) 
     {
        alert("Please type a valid email:");
        getinfo.Email.focus(); 
        return false;
    }
      

if(checkempty(document.getinfo.stream.value))
    {
     alert("Please Select Your Stream")
     document.getinfo.stream.focus();
     return false
    }
    
if(!(checkname(document.getinfo.Name.value)))
	{	
	alert("Name can have only 'a-z A-Z space' characters ")
	document.getinfo.Name.focus();
    document.getinfo.Name.select();
    return false
    }  
if(!(checkname(document.getinfo.Father.value)))
	{	
	alert("Father's Name can have only 'a-z A-Z space' characters ")
	document.getinfo.Father.focus();
    document.getinfo.Father.select();
    return false
    }      

if(!(checknumber(document.getinfo.YearofAdm.value)))
    {
    alert("Year of Admission can only have numerical value ")
    document.getinfo.YearofAdm.focus();
    document.getinfo.YearofAdm.select();
    return false         
    }        

      
if(!(checkmail(document.getinfo.Email.value)))
    {
    alert("Email address is not valid or it may have only spaces")
    document.getinfo.Email.focus();
    document.getinfo.Email.select();
    return false         
    }        
}
// end of validate 
function checkmail(str)
 {
  var len,i
  len=str.length
  if (len==0)
  return true
  for (i=0;i<len;i++)
   { 
    if(str.charAt(i)=="@")
     return true
    }
   return false  
 }//end of checkmail
 
function checkempty(str)
 {
  var len,i
  len=str.length
  for (i=0;i<len;i++)
   { 
    if(str.charAt(i)!=" ")
     return false
    }
   return true  
 }//end of checkempty


function checkname(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(65)&& ch<=String.fromCharCode(90))||(ch>=String.fromCharCode(97)&& ch<=String.fromCharCode(122))||(ch==String.fromCharCode(32))||(ch==String.fromCharCode(46)) ))
    return false
   }
  return true
 }//end of checkname
 
 function checknumber(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(48)&& ch<=String.fromCharCode(57))||(ch==String.fromCharCode(44)) ))
    return false
   }
  return true
 }//end of checknumber
 function checkstd(str)
 {
  var len,i,ch
  len=str.length
  for (i=0;i<len;i++)
   { 
    ch=str.charAt(i)
    if( !((ch>=String.fromCharCode(48)&& ch<=String.fromCharCode(57)) ))
    return false
   }
  alert("Thank You for submitting your data "); 
  return true
 }//end of checkstd

function openFile(obj)
{
   //alert(obj);
  window.open(obj,'_self');
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


//from SITM
// JavaScript Document

// JavaScript Document
function isAllDigits(argvalue) {
                argvalue = argvalue.toString();
                var validChars = "0123456789";
                var startFrom = 0;
                if (argvalue.substring(0, 2) == "0x") {
                   validChars = "0123456789abcdefABCDEF";
                   startFrom = 2;
                } else if (argvalue.charAt(0) == "0") {
                   validChars = "01234567";
                   startFrom = 1;
                } else if (argvalue.charAt(0) == "-") {
                    startFrom = 1;
                }
                
                for (var n = startFrom; n < argvalue.length; n++) {
                    if (validChars.indexOf(argvalue.substring(n, n+1)) == -1) return false;
                }
                return true;
            }
function nullconv(str)
{	
	if(str==null){
		str="";}
	else if(str=="null"){
		str="";}
	else if(str==""){
		str="";}
	else if(str==null){
		str="";}
	
	return str;
}
function trim(s) 
{
  try{
	  return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
  }
  catch(e)
  {
	  return " ";
  }
}

				
function sameAsPresent()
			{
				if(nullconv(trim(document.alumniRecord.presentAddress.value))!= "")
				{
					document.alumniRecord.permanentAddress.value = 	document.alumniRecord.presentAddress.value;
				}
				else
				{
					document.alumniRecord.same.checked = false;
				}
			}
			
function registerAlumni()
{		if(isAllDigits(nullconv(trim(document.alumniRecord.classRollNo.value)))==false)
       {
	   alert("Please provide roll number in digits or leave the blank");
	   document.alumniRecord.classRollNo.value="";
	   return false;
       }
	else if(nullconv(trim(document.alumniRecord.aname.value))=="")
	  {
		alert("Please enter your name");
		document.alumniRecord.aname.focus();
		return false;
	} 
	else if(nullconv(trim(document.alumniRecord.mobileNo.value))==false)
	{
		alert("Please provide phone number");
		
		document.alumniRecord.mobileNo.focus();
		return false
	}
	else if(isAllDigits(document.alumniRecord.mobileNo.value)==false)
	{
		alert("only numeric value");
		document.alumniRecord.mobileNo.focus();
		return false
	}
	else if(nullconv(trim(document.alumniRecord.email.value))=="")
	{
	alert("Please Provide email");
	document.alumniRecord.email.focus();
	return false;
	}
	 
	return true;
	
}
function goSubmit()
{
	if(registerAlumni()){
	document.alumniRecord.action="alumni1.php";
	document.alumniRecord.submit();
	
	}
}
	
function approveEntry(obj, obj1)
{
document.form1.hidden1.value=obj;
document.form1.hidden2.value=obj1;
document.form1.action="alumniAdminA.jsp";
document.form1.submit();
}

function uploadPic()
{  

  if(document.form2.file1.value==""){
	 alert("Select picture to upload")
	 return false;
 }
 else{
	 document.form2.enctype="multipart/form-data"
	 document.form2.method="post";
	 document.form2.action="uploadPic.jsp";	 
	 document.form2.submit();
	 alert("saved");
 }
}
function callPage()
{

 document.form2.action="alumniSITM.php";
 document.form2.submit();

}

 function ValidationForm()
{
 if(trim(document.formCollege.txtMail.value)=="")
	{               alert("Please type a valid email ID:");
				    document.formCollege.txtMail.focus();
					return false;
	}			
	else if(trim(document.formCollege.txtMail.value )!="")
	{
	    var obj1 = document.formCollege.txtMail;
		 if(obj1.value != "")
		 {
			if ((obj1.value.indexOf("@") == -1) || (obj1.value.indexOf("."))== -1 || obj1.value.length < 9) 
		 	{
							alert("Please type a valid email ID:");
							obj1.value = "";
							obj1.focus();
							return false;							 
			}
		}
	}
	return true;
}		

function goSubmit1()
{
if(ValidationForm())
{
document.formCollege.action="sitmhelp.jsp";
document.formCollege.submit();
alert("Data has saved");
}
}
function charCount(){
	
document.getElementById("charCount").innerHTML=3000-document.formCollege.txtQuery.value.length;
if(document.formCollege.txtQuery.value.length>=3000){
	document.formCollege.txtQuery.value=(document.formCollege.txtQuery.value).substring(0,2999);
}
}

function charCount(){
	
document.getElementById("charCount").innerHTML=3000-document.formCollege.txtQuery.value.length;
if(document.formCollege.txtQuery.value.length>=3000){
	document.formCollege.txtQuery.value=(document.formCollege.txtQuery.value).substring(0,2999);
}
}
function newsCount(){
	
document.getElementById("newsCount").innerHTML=5000-document.adminNews.taNews.value.length;
if(document.adminNews.taNews.value.length>=5000){
	document.adminNews.taNews.value=(document.adminNews.taNews.value).substring(0,4999);
}
}
function submitNews(){
if(nullconv(trim(document.adminNews.txtSubject.value))==""){
	alert("Please write Subjet for your new")
	document.adminNews.txtSubject.focus();
	return false;
}
else if(nullconv(trim(document.adminNews.taNews.value))==""){
	alert("Please write News before submitting the page");
	document.adminNews.taNews.focus();
	return false;
	
}else if(nullconv(trim(document.adminNews.txtOrderOf.value))=="")
{
	alert("Please provide the person name");
	document.adminNews.txtOrderOf.focus();
	return false;
	
	
	
}
else if(nullconv(trim(document.adminNews.txtStartDate.value))==""){
	
	alert("Please Select Starting Date");
	document.adminNews.txtStartDate.focus();
	return false;
	}
	else if(nullconv(trim(document.adminNews.txtExpDate.value))==""){
	alert("Please Select Expire Date of News");
	document.adminNews.txtExpDate.focus();
	return false	
	}
else{
	document.adminNews.action="adminNewsInsert.jsp";
	document.adminNews.submit();
	
}
	
}
function trim(s) {
 return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}
function validationStudentDetailsForm()
{
if(document.studentDetails.txtRoll.value==""){
  alert("Please enter your Rollno ");
  document.studentDetails.txtRoll.focus();
 return false;
 }
 else if(document.studentDetails.txtSName.value==""){
  alert("Please enter your Name");
  document.studentDetails.txtSName.focus();
  return false;
  }
  else if(document.studentDetails.txtFName.value=="")
  {
    alert(" Please enter the Father Name");
	document.studentDetails.txtFName.focus();
	return false;
  }
  else if(document.studentDetails.txtMName.value=="")
  {
  alert("Please enter Mother Name");
  document.studentDetails.txtMName.focus();
  return false;
  }	 
  else if(document.studentDetails.txtAddr.value=="")
  {
  alert("Please enter your Address");
  document.studentDetails.tatAddr.focus();
  return false;
  }
  else if(document.studentDetails.txtDob.value=="")
  {
  alert("Please select your correct date of birth");
  document.studentDetails.txtDob.focus();
    return false;
  }
   else if(document.studentDetails.txtContact.value=="")
  {
  alert("Please enter your contact");
  document.studentDetails.txtContact.focus();
   return false;
  }
   else if(trim(document.studentDetails.txtEmail.value)=="")
	{               alert("Please type a valid email ID:");
				    document.studentDetails.txtEmail.focus();
					return false;
	}			
	else if(trim(document.studentDetails.txtEmail.value )!="")
	{
	    var obj1 = document.studentDetails.txtEmail;
		 if(obj1.value != "")
		 {
			if ((obj1.value.indexOf("@") == -1) || (obj1.value.indexOf("."))== -1 || obj1.value.length < 9) 
		 	{
							alert("Please type a valid email ID:");
							obj1.value = "";
							obj1.focus();
							return false;							 
			}
		}
	}
	return true;
}					 
function goStudentDetailsSubmit()
{
if(validationStudentDetailsForm())
{
document.studentDetails.action="student.jsp";
document.studentDetails.submit();
}
}