function validate(thisform)
	{
		if (((document.frm_newaccount.txt_mobile.value.length)==0)||(isNaN(document.frm_newaccount.txt_mobile.value)==true) || (document.frm_newaccount.txt_mobile.value.length) < 8)
		{
			alert ("Please enter a valid mobile number");
			document.frm_newaccount.txt_mobile.select();
			return false;
		}


		if (((isempty(document.frm_newaccount.txt_body.value)==false)||(document.frm_newaccount.txt_body.value.length)==0))
		{
			alert ("Please enter a valid message");
			document.frm_newaccount.txt_body.select();
			return false;
		}

	
	}

function zmsg(form,form1) 
  {

     if(frm_newaccount.txt_body.value.length > 160)    
     {
                         
       frm_newaccount.txt_body.value=frm_newaccount.txt_body.value.substring(0,160);
       alert("Your message should be less than 160");
       return(false);
     }                
     frm_newaccount.txt_count.value=frm_newaccount.txt_body.value.length;   
   return;  
  }

function changetab(pos,objname,c)
	{
		var l=objname.length;		
		var t=c;
		if (c==1)
		{
			switch (pos)
			{
				case 1:
					if (l==3) 
					{
						document.frm_newaccount.txt_ph2.focus();
					} 
					break;
				case 2:
					if (l==3) 
					{
						document.frm_newaccount.txt_ph3.focus();
					} 
					break;
				case 3:
					if (l==4) 
					{
						document.frm_newaccount.txt_fax.focus();
					} 
			}
		}
	else
		{
			switch (pos)
			{
				case 1:
					if (l==3) 
					{
						document.frm_newaccount.txt_fax2.focus();
					} 
					break;
				case 2:
					if (l==3) 
					{
						document.frm_newaccount.txt_fax3.focus();
					} 
					break;
				case 3:
					if (l==4) 
					{
						document.frm_newaccount.txt_email.focus();
					} 
			}				
		}		
	}

	function isempty(input)
	{
		var l= input.length;
		var i;
		var charfound="No";
		for (i=0;i<l;i++)
		{
			if(input.charAt(i)!= " ")
			{
				charfound="Yes";
			}
		}
		if (charfound=="Yes")
			return true;
		else
			return false;
	}



	function email(input)
	{
		if (anycharfound(input)==true)
		{
			if (atndot(input)==true)
			{
				if (dot(input)==true)
				{
					return true;
				}
				else
				{
					return false;
				}
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}

	function dot(input)
	{
		var l= input.length;
		if (input.lastIndexOf(".")+1==l)
		{
			return false;
		}		
		else
		{
			return true;
		}
	}

	function atndot(input)
	{
		var atpos;
		var dotpos1;
		var dotpos2;
		atpos=input.indexOf("@");
		dotpos1=input.indexOf(".");
		dotpos2=input.indexOf(".",dotpos1+1);
		if (atpos==-1||dotpos1==-1||atpos==0||atpos>dotpos1||dotpos1==atpos+1||dotpos2==dotpos1+1)
			return false;
		else
		{
			return true;
		}
	}

	function anycharfound(input)
	{
		var l= input.length;
		var charfound=0;
		var atcount=0;
		var i ;
		for (i=0;i<l;i++)
		{
			if (input.charAt(i)!= " ") 
			{
				if (input.charAt(i)== "@") 
				{
					atcount=atcount+1;
				}
				charfound=charfound+1;
			}
		}
		if (charfound==l) 
		{
			if (atcount>1 )
			{
				return false;
			}
			else
			return true;
		}
		else
		{
			return false;
		}
	}
