function funcValidation(frmSubscription)
{
	var strFName = " ", strCompany = " ", strEmail = " ", strTel = "", strMobile = "", strSubject = "", strEnquiry = "";	
	
	var bError = 0;
	
	strFName =  	document.frmSubscription.txtFullName.value;
	strCompany =  	document.frmSubscription.txtCompany.value;
	strEmail =  	document.frmSubscription.txtEmail.value;
	strTel = 		document.frmSubscription.txtTel.value; 
	strMobile = 	document.frmSubscription.txtMobile.value;
	strSubject = 	document.frmSubscription.txtSubject.value;
	strEnquiry = 	document.frmSubscription.txtEnquiry.value;
	
	if(strFName == "")
	{
		alert("Please give your Full Name");
		document.frmSubscription.txtFullName.focus();
		bError = 1;
		return false;
	
	}
	else
	{
		document.frmSubscription.txtCompany.focus();
	
	}
	
	if(strCompany == "")
	{
		alert("Please give your Company Name");
		document.frmSubscription.txtCompany.focus();
		bError = 1;
		return false;
	
	}
	else
	{
		document.frmSubscription.txtEmail.focus();
	
	} 
	
	//******************* Email address checking starts *******************//
		var str_current_character;
		var b_valid_email,b_period_present; 
		var i_last_position_of_period,b_correct_length_extension;
		var i_num_at_symbol=0;
		var i_pos_at_symbol;
		var i_length_of_server_name=1;
		var i_pos_consecutive_dots;
		var strEmail=new String(func_trim(strEmail));
		i_length=strEmail.length;
		b_period_present=1;
		b_correct_length_extension=1;
		i_last_position_of_period=0;
	
		if(i_length==0)
		{
			bError = 1;
			alert("Please give your email address");
			document.frmSubscription.txtEmail.focus();
			return false;
		}
	
		for(i_loop=0; i_loop<i_length; i_loop++)
		{
			if(!((strEmail.charCodeAt(i_loop)>=65 && strEmail.charCodeAt(i_loop)<=90)
		 	 	|| (strEmail.charCodeAt(i_loop)>=97 && strEmail.charCodeAt(i_loop)<=122)
		  		|| (strEmail.charCodeAt(i_loop)>=48 && strEmail.charCodeAt(i_loop)<=57)
			 	|| (strEmail.charAt(i_loop)=="@")
			  	|| (strEmail.charAt(i_loop)=="_")
			  	|| (strEmail.charAt(i_loop)=="-")
		  		|| (strEmail.charAt(i_loop)==".")))
			{
				bError = 1;
				alert("Invalid Email address");
				document.frmSubscription.txtEmail.value = "";
				document.frmSubscription.txtEmail.focus();
				return false;
			}
		}
	
		i_pos_consecutive_dots=strEmail.indexOf('..');
		if(i_pos_consecutive_dots!=-1)
		{
			bError = 1;
			alert("Invalid Email address");
			document.frmSubscription.txtEmail.value = "";
			document.frmSubscription.txtEmail.focus();
			return false;
		}
	
		var i_pos_space;
		i_pos_space = strEmail.indexOf(' ');
		if(i_pos_space!=-1)
		{
			bError = 1;
			alert("Invalid Email address");
			document.frmSubscription.txtEmail.value = "";
			document.frmSubscription.txtEmail.focus();
			return false;
		}
	
		i_last_position_of_period = strEmail.lastIndexOf('.');
		if(i_last_position_of_period<=0)
		{
			b_period_present=0;
		}	
	
		if(((i_length-i_last_position_of_period)>4) || ((i_length-i_last_position_of_period)<3))
		{
			b_correct_length_extension=0;
		}
	
		for(i_loop=0;i_loop<=i_length;i_loop++)
		{
			str_current_character=strEmail.charAt(i_loop);
			if (str_current_character=='@')
			{
				i_num_at_symbol=i_num_at_symbol + 1;
			}
		}
	
		if(i_num_at_symbol!=1)
		{
			bError = 1;
			alert("Invalid Email address");
			document.frmSubscription.txtEmail.value = "";
			document.frmSubscription.txtEmail.focus();
			return false;
		}	
	
		i_pos_at_symbol = strEmail.indexOf('@');
		if(strEmail.charAt(i_pos_at_symbol+1) == '.')
		{
			i_length_of_server_name=0;
		}
	
		if((i_num_at_symbol==1) && (b_period_present==1) && (b_correct_length_extension==1) && (i_length_of_server_name==1))
		{
			b_valid_email=1;
		}
		else
		{
			 b_valid_email=0;
		}
	
		if(b_valid_email==0)
		{
			bError = 1;
			alert("Invalid Email address");
			document.frmSubscription.txtEmail.value = "";
			document.frmSubscription.txtEmail.focus();
			return false;
		}
		else
		{
			document.frmSubscription.txtTel.focus();
		}
	
	//******************* Email address checking ends ********************** 	
	
	if(strTel == "")
	{
		alert("Please give your telephone number");
		document.frmSubscription.txtTel.focus();
		bError = 1;
		return false;
	
	}
	
	else
	{
		document.frmSubscription.txtMobile.focus();
	
	}
	
	if(strMobile == "")
	{
		alert("Please give mobile number");
		document.frmSubscription.txtMobile.focus();
		bError = 1;
		return false;
	
	}
	
	else
	{
		document.frmSubscription.txtSubject.focus();
	
	}
	
	if(strSubject == "")
	{
		alert("Please select a subject");
		document.frmSubscription.txtSubject.focus();
		bError = 1;
		return false;
	
	}
	
	else
	{
		document.frmSubscription.txtEnquiry.focus();
	
	} 
	
	if(strEnquiry == "")
	{
		alert("Please provide a message");
		document.frmSubscription.txtEnquiry.focus();
		bError = 1;
		return false;
	
	}

	 
	
	if(bError == 0 )
	{
		//return true;		
		return true;
		
	
	}//end if chekcing any error in the form or not
	else
	{
		//return false;			
		return false;
	}//end else			
	
}//end funcValidation

//**************** function for trim operation starts *********************
function func_trim(param_text)
		{
			var str_text=new String(param_text);
			var str_return_text;
			str_return_text="";
			b_non_blank_started=false;
			b_non_blank_ended=false;
			str_intermediate_blank_chunk="";
			var i_loop;
			for(i_loop=0;i_loop<str_text.length;i_loop++)
			{
				if(str_text.charCodeAt(i_loop)!=32)
				{
					if(!b_non_blank_started)
					{
						b_non_blank_started=true;
					}
					if(b_non_blank_started && !b_non_blank_ended)
					{
						str_return_text+=str_text.charAt(i_loop);
					}
					if(b_non_blank_ended)
					{
						str_return_text+=(str_intermediate_blank_chunk+str_text.charAt(i_loop));
						b_non_blank_ended=false;
						str_intermediate_blank_chunk="";
					}
				}
				else
				{
					if(b_non_blank_started)
					{
						b_non_blank_ended=true;
						str_intermediate_blank_chunk+=" ";
					}
				}
			}
			return str_return_text;
		}

//**************** function for trim operation ends*********************

function funcFocus()
{
	
	document.frmSubscription.txtFulltName.focus();
	
}//end if