var m;
var o;
var o1;
function ValidatePhone1(){
o=o1.value
if(o.length==3){
	oo=o;
	e4=o.indexOf('(')
	e5=o.indexOf(')')
	if(e4==-1){
		oo="("+oo;
	}
	if(e5==-1){
		oo=oo+")";
	}
	document.mainForm.CellPhone.value="";
	document.mainForm.CellPhone.value=oo;
}
if(o.length>3){
	e1=o.indexOf('(')
	e2=o.indexOf(')')
	if (e2==-1){
		k30=o.length;
		o30=o.substring(0,4);
		o30=o30+")"
		o31=o.substring(4,k30);
		oo=o30+o31;
		document.mainForm.CellPhone.value="";
		document.mainForm.CellPhone.value=oo;
	}
	}
if(o.length>5){
	o11=o.substring(e1+1,e2);
	if(o11.length>3){
	o12=o11;
	l12=o12.length;
	l15=o.length
	o13=o11.substring(0,3);
	o14=o11.substring(3,l12);
	o15=o.substring(e2+1,l15);
	document.mainForm.CellPhone.value="";
	oo="("+o13+")"+o14+o15;
	document.mainForm.CellPhone.value=oo;
	}
	k16=o.length;
	o16=o.substring(e2+1,k16);
	k17=o16.length;
	if(k17>3&&o16.indexOf('-')==-1){
		o17=o.substring(e2+1,e2+4);
		o18=o.substring(e2+4,k16);
		o19=o.substring(0,e2+1);
	oo=o19+o17+"-"+o18;
	document.mainForm.CellPhone.value="";
	document.mainForm.CellPhone.value=oo;
	}
}
setTimeout(ValidatePhone1,100)
}
function getItWork(q){
m=q.name;
o1=q
ValidatePhone1()
}
function testphone1(obj1){
o=obj1.value
o=o.replace("(","")
o=o.replace(")","")
o=o.replace("-","")
o=o.replace("-","")
if (isNaN(o)==true){
alert("Check phone");
return false;
}
}