newnum = new Array("","9849","9885","9840","9841","9810","9811","9892","9821","9831","9845","9895","9847","9846","9894","9843","9842","9843","9890","9823","9822","9824","9898","9825","9890","9823","9822","9896","9812","9816","9893","9815","9837")

function onphoneclick()
{
	for(i=0;i<document.cellphone.r1.length;i++)
	{
		if (document.cellphone.r1.selectedIndex==i)
		{
			document.cellphone.T2.value = newnum[i];
		}
	}
}

function ontfocus()
{
	if (document.cellphone.r1.selectedIndex==0)
	{
		document.cellphone.T2.blur();
		document.cellphone.r1.focus();
	}	
}

function phonecell(theform)
{
	if (theform.r1.selectedIndex==0 && theform.T2.value=="")
	{
		alert("Please choose your subscriber.");
		theform.r1.focus();
		return false;
	}

	if (theform.r1.selectedIndex!=0 && isNaN(theform.T2.value))
	{
		alert("Characters are not allowed in this phone field.");
		onphoneclick();
        	theform.T2.select();
		theform.T2.focus();
		return false;
	}

	if (theform.r1.selectedIndex!=0 && theform.T2.value.length!=10)
	{
		for(j=0;j<theform.r1.length;j++)
		{
			if (theform.r1.selectedIndex==j)		
			alert("Please enter a number of 10 digits beginning with "+newnum[j]+".");
		}
		theform.T2.select();
		theform.T2.focus()
		return false;
	}

	if(theform.name1.value == "")
	{
		alert ("Please enter your name.");
		theform.name1.select();
		theform.name1.focus();
		return false;
	}
	else
	{
		for(var i=0;i<theform.name1.value.length;i++)
		{
			if(theform.name1.value.charAt(i)<'A' ||  theform.name1.value.charAt(i)>'Z')
			{
 				if(theform.name1.value.charAt(i)<'a' ||  theform.name1.value.charAt(i)>'z')
				{
					if(!((theform.name1.value.charAt(i)=='.') || (theform.name1.value.charAt(i)==' ')))
					{
						alert("Only alphabets, a space and a . are allowed in the name field.");
						theform.name1.select();
						theform.name1.focus();
						return false;
					}
				}
			}
		}
	}

	if(theform.email1.value!="" && (theform.email1.value.indexOf('@')==-1 || theform.email1.value.indexOf('.') == -1))
	{
		alert("Please enter your correct email address.");
		theform.email1.select();
		theform.email1.focus();
		return false;
	}

	if(theform.message1.value=="")
	{
		alert("Please enter the text that you want to send.");
		theform.message1.select();
		theform.message1.focus();
		return false;
	}

	if(theform.message1.value.length >195)
	{
		alert("The entered text should be within 196 characters.");
		theform.message1.select();
		theform.message1.focus();
		return false;
	}
return true;
}

/* old validations */
function phonecell1(theform)
{
newnum = new Array("9849","9848","9840","9841","9810","9811","9892","9821","9831","9845","9895","9847","9846","9894","9843","9842","9843","9890","9823","9822","9824","9898","9825","9890","9823","9822","9896","9812","9816","9893","9815","9837")
j=2
for(i=0;i<theform.r1.length;i++)
{
if (j<=33)
{
if (theform.r1[i].checked==false && isNaN(eval("theform.T"+j+".value")))
{
alert("Characters are not allowed in this phone field.");
eval("theform.T"+j+".value=''");
eval("theform.T"+j+".value="+newnum[i]);
eval("theform.T"+j+".select()");
eval("theform.T"+j+".focus()");
return false;
}
j++
}
}
return true;
}


function phonecell1(theform)
{

if(theform.r1[0].checked==false && theform.r1[1].checked==false)
{
 alert("Please check either Airtel or Hutch radio button.");
 theform.r1[0].focus();
 return false;
}


/*if(theform.r1[0].checked==false && theform.r1[1].checked==false && theform.r1[2].checked==false)
{
 alert("Please check either Tata Cellular or Airtel or Hutch radio button.");
 theform.r1[0].focus();
 return false;
}*/



/*if(theform.r1[0].checked==true && isNaN(theform.T1.value) ==true)
{
 alert("Characters are not allowed in this phone field.");
 theform.T1.value=9848;
 theform.T1.select();
 theform.T1.focus();
 return false;
}

if(theform.r1[0].checked==true && theform.T1.value.length !=10)
{
 alert("Please enter a number of 10 digits beginning with 984.");
 theform.T1.value=9849;
 theform.T1.select();
 theform.T1.focus();
 return false;
}*/

//for displaying the message access denied to the number 9848197890

/*if (theform.T1.value=="9848197890")
{
 alert("Sorry, Access Denied.");
 theform.T1.focus();
 theform.T1.select();
 return false;
}*/

if(theform.r1[0].checked==true && isNaN(theform.T2.value) ==true)
{
 alert("Characters are not allowed in this phone field.");
 theform.T2.value=9849;
 theform.T2.select();
 theform.T2.focus();
 return false;
}

if(theform.r1[0].checked==true && theform.T2.value.length !=10)
{
 alert("Please enter a number of 10 digits beginning with 984.");
 theform.T2.value=9849;
 theform.T2.select();
 theform.T2.focus();
 return false;
}

if(theform.r1[1].checked==true && isNaN(theform.T3.value) ==true)
{
 alert("Characters are not allowed in this phone field.");
 theform.T3.value=9885;
 theform.T3.select();
 theform.T3.focus();
 return false;
}

if(theform.r1[1].checked==true && theform.T3.value.length !=10)
{
 alert("Please enter a number of 10 digits beginning with 988.");
 theform.T3.value=9885;
 theform.T3.select();
 theform.T3.focus();
 return false;
}

if(theform.name1.value == "")
{
 alert ("Please enter your name.");
 theform.name1.select();
 theform.name1.focus();
 return false;
}
else
{
for(var i=0;i<theform.name1.value.length;i++)
{
 if(theform.name1.value.charAt(i)<'A' ||  theform.name1.value.charAt(i)>'Z')
{
 if(theform.name1.value.charAt(i)<'a' ||  theform.name1.value.charAt(i)>'z')
{
 if(!((theform.name1.value.charAt(i)=='.') || (theform.name1.value.charAt(i)==' ')))
 {
  alert("Only alphabets, a space and a . are allowed in the name field.");
  theform.name1.select();
  theform.name1.focus();
  return false;
 }
}
}
}
}

if(theform.email1.value!="" && (theform.email1.value.indexOf('@')==-1 || theform.email1.value.indexOf('.') == -1))
{
alert("Please enter correct email address.");
theform.email1.select();
theform.email1.focus();
return false;
}

if(theform.message1.value=="")
{
 alert("Please enter the text that you want to send.");
 theform.message1.select();
 theform.message1.focus();
 return false;
}

if(theform.message1.value.length >195)
{
 alert("The entered text should be within 196 characters.");
 theform.message1.select();
 theform.message1.focus();
 return false;
}
return true;
}

/*function tatacell()
{
 if(document.cellphone.r1[0].checked==false)
 {
  document.cellphone.T1.blur();
  document.cellphone.r1[0].focus();
 }
}*/

//}
/*
function airtell()
{
 if(document.cellphone.r1[0].checked==false)
 {
  document.cellphone.T2.blur();
  document.cellphone.r1[0].focus();
 }
}

function hutch()
{
 if(document.cellphone.r1[1].checked==false)
 {
  document.cellphone.T3.blur();
  document.cellphone.r1[1].focus();
 }
}
*/

/*function tataclick()
{
 document.cellphone.T2.value="";
 document.cellphone.T1.value="";
 document.cellphone.T3.value="";
 document.cellphone.T1.select();
 document.cellphone.T1.focus();
 document.cellphone.T1.value=9848;
}*/

function airclick()
{
// document.cellphone.T1.value="";
 document.cellphone.T2.value="";
 document.cellphone.T3.value="";
 document.cellphone.T2.select();
 document.cellphone.T2.focus();
 document.cellphone.T2.value=9849;
}

function hutchclick()
{
// document.cellphone.T1.value="";
 document.cellphone.T2.value="";
 document.cellphone.T3.value="";
 document.cellphone.T3.select();
 document.cellphone.T3.focus();
 document.cellphone.T3.value=9885;
}

