			function Validate()
			{
				var x;
				var str;
				
				x=window.document.getElementById("tb_Myname");
				str="Please enter myname ";
     
				if (Trim(x.value)=="")
				{
					alert(str);x.value="";x.focus();return false;
				}
				
				x=window.document.getElementById("tb_MyEmail");
				str="Please enter myemail";
				if (Trim(x.value)=="")
				{
					alert(str);x.value="";x.focus();return false;
				}
				if (!CheckEmail(x))
					{	
						x.focus();
						return false;
					}
					
				x=window.document.getElementById("tb_Friendname");
				str="Please enter friend name";
				if (Trim(x.value)=="")
				{
					alert(str);x.value="";x.focus();return false;
				}
				
				x=window.document.getElementById("tb_FriendEmail");
				//alert(x.value);
				str="Please enter friend email";
				if (Trim(x.value)=="")
				{
					alert(str);x.value="";x.focus();return false;
				}
				if (!CheckEmail(x))
					{	
						x.focus();
						return false;
					}
				
				
			}	
			
				/************************************************************
				function : LTrim(strText)
				usage    : for removing blank spaces from left of a string
				inputs   : string.
				output   : string without spaces on its left
				e.g      : LTrim("  abc  ") = "abc  "
				************************************************************/
				function LTrim(strText)
				{
					while (strText.substring(0,1) == ' ')
							strText = strText.substring(1, strText.length);
					return strText;
				} 


				/************************************************************
				function : RTrim(strText)
				usage    : for removing blank spaces from right of a string
				inputs   : string.
				output   : string without spaces on its right
				e.g      : RTrim("  abc  ") = "  abc"
				************************************************************/
				function RTrim(strText)
				{
					while (strText.substring(strText.length-1,strText.length) == ' ')
							strText = strText.substring(0, strText.length-1);
					return strText;
				}
					

				/************************************************************
				function : Trim(strText)
				usage    : for removing blank spaces from right and left of a string
				inputs   : string.
				output   : string without spaces on its right and left
				e.g      : Trim("  abc  ") = "abc"
				**************************************************************/
				function Trim(strText)
				{
					return RTrim(LTrim(strText));
				}

				
				
				
				function CheckEmail(strMail)
				{ 
					if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(strMail.value))
					{
					return (true)
					}
					alert("Invalid E-mail Address! Please re-enter.")
					strMail.focus();
					strMail.select();
					return (false)
				}
				
				function chk(str)
				{  
				var len = str.length;
				var flag=false;
				  
				for(var i=0;i<len;i++)
				{
				var a = str.charAt(i); 
				if (i%2==0) // 0,2,4,6,8.... case(alfa ,b,c.......)
				{     
					if (!isNaN(a))
					flag=true;      
				}
				else // 1,3,5,7.... case(Numeric 1,2,3....)
				{
					if (isNaN(a))
					flag=true;      
				}
				}
				return flag;
				}
				
				
				

