function validateForm()
{

	var name=document.getElementById("name").value;
	var email=document.getElementById("email").value;
	var depts=document.getElementById("depts").value;
	var subject=document.getElementById("subject").value;
	var message=document.getElementById("message").value;
	var cell=document.getElementById("cell").value;
	var attach=document.getElementById('attach').value;
	var enteredturing=document.getElementById('enteredturing').value;
	var realturing=document.getElementById('realturing').value;

	
	var illegalchrs = /[\<\>\,\;\'\#\\\\\/\"\[\]]/;
	////////////////////////////////////////////////////////////////////
	if(name.length==0)
	{
		alert("Please insert your name.");
		return false;
	}
	else
	{
		if(name.length >50)
		{
			alert("Sorry, name should not excceed 50 characters.");
			return false;
		}
		if(illegalchrs.test(name))
		{
			alert("Sorry,illegal characteres are not accepted in your name.");
			return false;
		}
	}
	//////////////////////////////////////////////////////////////////////
	var str1=email;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;


	if(email.length==0)
	{
		alert("Please insert an e-mail.");
		return false;
	}
	if (!filter.test(str1))
	{
		alert("Please, insert a valid mail.");
		return false;
	}


	///////////////////////////////////////////////////////////////////////////
	
	

	
	if(cell.length==0)
	{
		alert("Please enter your mobile number.");
		return false;
	}
	if(cell.length<10)
	{
		alert("Please check your mobile number.");
		return false;
	}
	
	
	
	if(depts.length==0)
	{
		alert("Please choose a department.");
		return false;
	}
	

	///////////////////////////////////////////////////////////////////////////
	
	if(subject.length==0)
	{
		alert("Please insert the subject.");
			return false;
	}

	if(subject.length!=0)
	{
		if(illegalchrs.test(subject))
		{
			alert("Sorry,illegal characters are not accepted in the subject field.");
			return false;
		}

		if(subject.length >50)
		{
			alert("Sorry, subject title  shouldn't excceed 50 characters ");
			return false;
		}
	}
	///////////////////////////////////////////////////////////////////////

	if(message.length==0)
	{
		alert("Please insert a message");
		return false;
	}

	else if(message.length > 500)
	{
		alert("Sorry, message shouldn't excceed 500 characters ");
		return false;
	}
	/////////////////////////////////////////////////////////////////
	// check for the extension of the uploadded file
	if(attach.length!=0)
	{
	var str=attach.split(".");
	var extension=str[1];
	extension=extension.toLowerCase();

	var file_extensions= new Array('txt','pdf','doc','zip','rar','jpeg','png','gif','ppt','xls','html');
	var test=0;
	for (i=0;i< file_extensions.length;i++)
	{
		if (extension==file_extensions[i])
		{
			test=1;
			return true;
		}
	}// end of for

	if(test!=1)
	{
		alert("Sorry, the extension of the attached file is not accepted");
		return false;
	}
	}
	
	if(enteredturing.length==0)
	{
		alert("Please rewrite the number shown in the image.");
		return false;
	}
	else if(enteredturing!=realturing)
	{
		alert("Please check the number shown in the image.");
		return false;
	}
	
	
	

	////////////////////////////////////////////////////////////////////////
}