
 //_-------------valid email-id----------//
function isValidEmailId(obj, name)
{
   obj.value=trim(obj.value);
   if (obj.value=='')
   {
	   alert('"'  + name + '" can not be blank. Please enter it.' );
	   obj.focus();
	   return false;
   }
   
   if (! isValidEmail(obj.value))
   {
      alert("Invalid e-Mail-Id entered.");
	  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 For Posting Enquiry-------------//
function validenquiry()
{
	obj= document.postenquiry;
	obj.name.value=trim(obj.name.value)
	if(obj.name.value=="")
	{
		alert("Please Enter Name")
		obj.name.focus();
		return false;
	}
	
	obj= document.postenquiry.email;
	if(!isValidEmailId(obj, " Your Email ID"))
	{
			return false;
	}

	obj= document.postenquiry;
	obj.enquiry.value=trim(obj.enquiry.value)
	if(obj.enquiry.value=="")
	{
		alert("Please Post Your Enquiry")
		obj.enquiry.focus();
		return false;
	}
	return true
}


//*************validation for Registration form ********************//
function validresume()
{	
		obj= document.myform;
		obj.fname.value= trim(obj.fname.value);
		if(obj.fname.value=="")
		{
		alert(" Name can not be blank. Please enter it.")
		obj.fname.focus();
		return false;
		}
		obj= document.myform;
		obj.lname.value= trim(obj.lname.value);
		if(obj.lname.value=="")
		{
		alert("Last Name can not be blank. Please enter it.")
		obj.lname.focus();
		return false;
		}
		obj= document.myform;
		if(obj.postdate.value=="")
		{
			alert("Date Of Birth can not be blank. Please enter it.")
			return false;
		}
		

		
		obj7=document.myform.email;
			if(!isValidEmailId(obj7, "Email"))
			{
					return false;
			}

		/*obj= document.myform;
		if(obj.cmbdegree.value=="-1")
		{
		alert("Highest Qualification can not be blank. Please enter it.")
		obj.cmbdegree.focus();
		return false;
		}
		*/

		obj= document.myform;
		if(obj.image1.value=="")
		{
		alert(" Please Upload updated Resume")
		obj.image1.focus();
		return false;
		}
		
		
		
	return true;
	
	}
function SmallWin5(id)
{
  window.open("sendmail.php?JID="+id,"","resizable=no,width=370,height=220,scrollbars=Yes,status=no,top=75,screenY=255,left=200,screenX=350");
}

function sendmail()
{

	obj=document.myform;
	if(obj.txtname.value=="")
	{
		
		alert("Name can not be blank. Please enter it.")
		obj.txtname.focus();
		return false;
	}



	obj1=document.myform.txtemail;
	if(!isValidEmailId(obj1, "Email"))
	{
					return false;
	}

	obj=document.myform;
	if(obj.txtfriendname.value=="")
	{
		
		alert("Name can not be blank. Please enter it.")
		obj.txtfriendname.focus();
		return false;
	}

	obj2=document.myform.txtfriendemail;
	if(!isValidEmailId(obj2, " Friend's Email Id"))
	{
			return false;
	}
	
		return true;
}

function SmallWin7(id)
{
  window.open("prd_img_det.php?PID="+id,"","resizable=no,width=570,height=420,scrollbars=Yes,status=no,top=75,screenY=255,left=200,screenX=350");
}