function helpdesk_validation() //validation form
	   {
			//alert("hdhfdfhsdf");
			t_name = document.frm_helpdesk.t_name;
			t_email = document.frm_helpdesk.t_email;
			t_contact = document.frm_helpdesk.t_contact;
			/* t_prior = document.frm_helpdesk.t_prior; */
			t_hlptp = document.frm_helpdesk.t_hlptp;
			t_sub = document.frm_helpdesk.t_sub; 
			t_mssg = document.frm_helpdesk.t_mssg; 
			//t_security_code = document.frm_helpdesk.as_security_code; 
			em_security_code = document.frm_helpdesk.em_security_code; 
			//alert(document.frm_helpdesk.site_topic.value);
			site_topic=document.frm_helpdesk.site_topic.value;
			
			if(site_topic=='SCH')
		   {
		   t_schlnm=document.frm_helpdesk.t_schlnm;
		   t_schladd=document.frm_helpdesk.t_schladd;
				
				if(t_schlnm.value==0)
					{
						alert("Please Enter School Name.");
						t_schlnm.focus();
						return false;
					}
				if(t_schladd.value==0)
					{
						alert("Please Enter Address.");
						t_schladd.focus();
						return false;
					}
		   }

			if (t_name.value.trim()=="")
			{
				alert("Please Enter Name.");
				t_name.value="";
				t_name.focus();
				return false;
			}
			
			if ((t_email.value==null)||(t_email.value==""))
			{
				alert("Please Enter Email-ID.");
				t_email.focus();
				return false;
			}
			if (echeck(t_email.value)==false)
			{
				t_email.focus();
				return false;
			}
			
	   
			if (isNaN(t_contact.value)) 
			{
	
				alert('Contact No. Should Be Numeric.');
				t_contact.value='';
				t_contact.focus();
				return false;
	
			}
			
			if(t_contact.value==0)
			{
				alert('Please Enter Contact No.');
				t_contact.value='';
				t_contact.focus();
				return false;
			}
			
			/*if(site_topic=='SCH')
		   {
		   t_ssno=document.frm_helpdesk.t_ssno;
		   t_modno=document.frm_helpdesk.t_modno;
				
				if(t_ssno.value==0)
					{
						alert("Please Enter System Serial No.");
						t_ssno.focus();
						return false;
					}
				if(t_modno.value==0)
					{
						alert("Please Enter Model No.");
						t_modno.focus();
						return false;
					}
		   }*/
			
			
			
			if(t_hlptp.value==0)
			{
				alert('Please Select Help Topic.');
				t_hlptp.value='';
				t_hlptp.focus();
				return false;
			}
			
			if(t_sub.value==0)
			{
				alert('Please Enter Subject.');
				t_sub.value='';
				t_sub.focus();
				return false;
			}
			
			if(t_mssg.value==0)
			{
				//alert(t_hlptp.value);
				alert('Please Enter Message.');
				t_mssg.value='';
				t_mssg.focus();
				return false;
			}
			
			if(em_security_code.value==0)
			{
				//alert(t_hlptp.value);
				alert('Please Enter Security Code.');
				//t_mssg.value='';
				em_security_code.focus();
				return false;
			}
			
			return true;
	
		}

		
	//Email validation
	function echeck(str) 
		{

			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1)
			{
			   alert("Invalid E-mail ID")
			   return false
			}

			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
			{
			   alert("Invalid E-mail ID")
			   return false
			}

			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
			{
			    alert("Invalid E-mail ID")
			    return false
			}

			 if (str.indexOf(at,(lat+1))!=-1){
			    alert("Invalid E-mail ID")
			    return false
			 }

			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
			 {
			    alert("Invalid E-mail ID")
			    return false
			 }

			 if (str.indexOf(dot,(lat+2))==-1)
			 {
			    alert("Invalid E-mail ID")
			    return false
			 }
			
			 if (str.indexOf(" ")!=-1)
			 {
			    alert("Invalid E-mail ID")
			    return false
			 }
			
			return true					
		}

function showTR()// select user_type defined function
						{
							
							var selTyp = document.getElementById('t_hlptp').selectedIndex;
							//alert(document.getElementById('t_hlptp').value);
							
							if(selTyp==1 || selTyp==3 || selTyp==5) // Teacher
							{
								document.getElementById('serial_no').style.display = 'block';
							}
							else
							{
								document.getElementById('t_ssno').value="";
								document.getElementById('t_modno').value="";
								document.getElementById('t_prsno').value="";
								document.getElementById('serial_no').style.display = 'none';
							}
						}//fun