

//--for login--//
function loginform()
{
    obj=document.myform.adm_loginid;
    if(isEmpty(obj,"Login ID"))
        return false;

    obj=document.myform.adm_password;
    if(isEmpty(obj,"Password"))
        return false;
     return true;
}

//--For Change password--//
function changepassword()
{
	obj= document.forms[0];
	if(obj.txtold.value=="")
	{
		alert("Please Enter Old Password")
		obj.txtold.focus();
		return false;
	}
	
	if(obj.txtnew.value=="")
	{
		alert("Please Enter New Password")
		obj.txtnew.focus();
		return false;
	}

	if(obj.txtre.value=="")
	{
		alert("Please Retype New Password")
		obj.txtre.focus();
		return false;
	}
	
	if(obj.txtnew.value!=obj.txtre.value)
	{
		alert("Please Enter Correct Password")
		obj.txtre.focus();
		return false;
	}
	return true;
}

//--------validation for email------------//
function isValidEmailId(obj, name)
{
   obj.value=trim(obj.value);
   if (obj.value=='')
   {
	   alert("Please enter your Email ID" );
	   obj.focus();
	   return false;
   }
   
   if (! isValidEmail(obj.value))
   {
      alert("EmailID should be like : yourname@yourdomain.com");
	  obj.focus();
	  return false;
   }
   return true;
}

function isValidEmail(elm)
{
 if(elm.indexOf('@',1) ==-1)
 	return (false);
 
 if(elm.indexOf('.',1) ==-1)
 	return (false);
 
 return true;
}

function trim(p_str)
{
   var i=0;
   while(1)
   {
     if ( p_str.charAt(0)==" " || p_str.charAt(0)=="\n" || p_str.charAt(0)=="\r") 
       p_str = p_str.substr(i+1);
     else
       break;
    } 
   
   while(1)
   {
     i=p_str.length;
     if ( p_str.charAt(i-1)==" " || p_str.charAt(i-1)=="\n" || p_str.charAt(i-1)=="\r") 
       p_str=p_str.substr(0,i-1);
     else
       break;
   }
  return p_str; 
}


function deletetrainingprograms(id)
{

	obj= document.myform;
	if(!confirm("Are you sure to delete it?"))
		return;
	obj.action ="training_programs_view.php?del=delete&AID="+id;
	obj.submit();
}
function validproject()
{
    obj=document.myform.cmbdivision;
    if(obj.value=='-1')
	{
		alert("Please select Division")
		obj.focus();
		return false;
	}

    obj=document.myform.pro_heading;
    if(isEmpty(obj,"project heading"))
        return false;
   

     return true;
}

function deleteproject(id)
{
	obj= document.forms[0];
	if(!confirm("Are you sure to delete it?"))
		return;
	obj.action ="project_view.php?del=delete&PID="+id;
	obj.submit();
}

function SmallWin(id)
{
  window.open("training_programs_details.php?ID="+id,"","resizable=no,width=530,height=300,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}

function winevent(id)
{
  window.open("eventpopup.php?ID="+id,"","resizable=no,width=530,height=250,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}


function validatetrainingprogram()
{
    obj=document.myform.cmbdivision;
    if(obj.value=='-1')
	{
		alert("Please select Division")
		obj.focus();
		return false;
	}

	return true;
}
function deletetdivfacilities(id)
{  
	obj= document.myform;
	if(!confirm("Are you sure to delete it?"))
		return;
	obj.action ="division_facilities_view.php?del=delete&FID="+id;
	obj.submit();
}

function deletepatent(id)
{
	obj= document.forms[0];
	if(!confirm("Are you sure to delete it?"))
		return;
	obj.action ="patent_copyright_view.php?del=delete&PID="+id;
	obj.submit();
}

function deletemandet(id)
{
	obj= document.forms[0];
	if(!confirm("Are you sure to delete it?"))
		return;
	obj.action ="mandet_view.php?del=delete&MNID="+id;
	obj.submit();
}

function SmallWin2(id)
{
 
  window.open("publication_details.php?PID="+id,"","resizable=no,width=700,height=500,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}
function SmallWintend(id)
{
 
  window.open("tender_details.php?TID="+id,"","resizable=no,width=530,height=300,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}


function SmallWin23(id)
{
 
  window.open("newsletter_detail.php?PID="+id,"","resizable=no,width=530,height=300,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}


function validtt()
{	
	 obj=document.myform.txttech;
		if(obj.value=='')
	{
		alert("Name of the Technology applied for could not be empty")
		obj.focus();
		return false;
	}
 
        return true;
}
function validcs()
{	
	
     obj=document.myform1.txtpid;
		if(obj.value=='')
	{
		alert(" Project ID No. could not be empty")
		obj.focus();
		return false;
	}

	return true;
	
}

 function SmallWin12(id)
{
 
  window.open("tech_details.php?TID="+id,"","resizable=no,width=530,height=300,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}
 function SmallWin13(id)
{
 
  window.open("tech_details1.php?VID="+id,"","resizable=no,width=530,height=300,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}

 function SmallWin44(id)
{
 
  window.open("photo_details.php?HID="+id,"","resizable=yes,width=700,height=500,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}

 function SmallWin33(id)
{
 
  window.open("award_details.php?AID="+id,"","resizable=no,width=700,height=500,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}

function video(fileN)
{
	alert (fileN);
   window.open("movie_details.php?filename="+fileN,"SizeHelp","resizable=no,width=370,height=330,scrollbars=yes,status=no,top=75,screenY=255,left=200,screenX=350");
}

function validfeedback(obj,name)
{	
	
     obj=document.myform.txtname;
		if(obj.value=='')
	{
		alert("Name could not be empty")
		obj.focus();
		return false;
	}

	obj=document.myform.txtmail;
		if(obj.value=='')
	{
		alert("Email ID could not be empty")
		obj.focus();
		return false;
	}
	
	obj=document.myform.txtfeed;
		if(obj.value=='')
	{
		alert("Feedback could not be empty")
		obj.focus();
		return false;
	}
	
	return true;
	
}
function validclient(obj,name)
{	
	
     obj=document.myform.txtname;
		if(obj.value=='')
	{
		alert("Name could not be empty")
		obj.focus();
		return false;
	}

	obj=document.myform.txtmail;
		if(obj.value=='')
	{
		alert("Email ID could not be empty")
		obj.focus();
		return false;
	}
	
	obj=document.myform.txtfeed;
		if(obj.value=='')
	{
		alert("Feedback could not be empty")
		obj.focus();
		return false;
	}
	
	return true;
	
}