function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
            return true					
}

function focus_field()
{
	//alert("ss");
if(document.form1.radiobutton[0].checked ==true ) 
	{
	document.form1.shell.disabled
document.form1.shell.focus();
document.form1.shell.select();
	}
else{
if(document.form1.radiobutton[1].checked ==true ) 
	{
document.form1.bare.focus();
document.form1.bare.select();
document.form1.radiobutton[1].checked =true;
	}
}
}


function exb_reg()
{

var theone=0;
	for (i=0;i<document.form1.radiobutton.length;i++)
	{
	if (document.form1.radiobutton[i].checked==true)
		{
    theone=1;
    break //exist for loop, as target acquired.
        }
   
    }
if(theone==0)
	{
	alert('You must enter your space type!');
   return false;
	}

if((document.form1.shell.value =="" ) && ( document.form1.bare.value == "" ))
	{
	     alert("Please enter your area size");
		  document.form1.shell.focus();
		 return false; 
	
	}
	
/*if  ( document.form1.check1.checked == false &&
	document.form1.check2.checked == false &&
	document.form1.check3.checked == false &&
	document.form1.check4.checked == false &&
	document.form1.check5.checked == false &&
	document.form1.check6.checked == false ) 
	{
 alert("Please enter one stand segment");
	 return false; 
	}*/

/*
var theone2=0;
	for (i=0;i<document.form1.check1.length;i++)
	{
	if (document.form1.check1[i].checked==true)
		{
    theone2=1;
    break //exist for loop, as target acquired.
        }
   
    }
if(theone2==0)
	{
	alert('Please enter one stand segment!');
   return false;
	}
*/
var chkd=0;
for(i=4;i<9;i++)
	{
	if(document.form1.elements[i].checked)
		{
		chkd=1;
		}
	}
	if(chkd==0)
	{
		alert("Please select type of segments");
		return false
	}

var theone1=0;
	for (i=0;i<document.form1.radiobutton1.length;i++)
	{
	if (document.form1.radiobutton1[i].checked==true)
		{
    theone1=1;
    break //exist for loop, as target acquired.
        }
   
    }

if(theone1==0)
	{
	alert('You must choose any of the option!');
   return false;
	}

if(document.form1.name.value =="")
	{
	     alert("Please enter your name");
		 document.form1.name.focus();
         return false; 
	
	}
	if(document.form1.name.value !="")
	{
     if(!isNaN(document.form1.name.value))
		{
		 alert("Name should not be numeric");
		 document.form1.name.focus();
         return false; 
		}
	
	}
	if(document.form1.desi.value =="")
	{
	     alert("Please enter your designation");
		 document.form1.desi.focus();
         return false; 
	
	}
	if(document.form1.comapany.value =="")
	{
	     alert("Please enter your company");
		 document.form1.comapany.focus();
         return false; 
	
	}
	if(document.form1.address.value =="")
	{
	     alert("Please enter your address");
		 document.form1.address.focus();
         return false; 
	
	}
	if(document.form1.city.value =="")
	{
	     alert("Please enter your city");
		 document.form1.city.focus();
         return false; 
	
	}
	if(document.form1.state.value =="")
	{
	     alert("Please enter your state");
		 document.form1.state.focus();
         return false; 
	
	}
	if(document.form1.country.value =="#")
	{
	     alert("Please enter your country");
		 document.form1.country.focus();
         return false; 
	
	}
	if(document.form1.pin.value =="")
	{
	     alert("Please enter your pin no");
		 document.form1.pin.focus();
         return false; 
	
	}
	if(document.form1.email.value =="")
	{
    	 alert("Please enter your Email ID");
		 document.form1.email.focus();
         document.form1.email.select();
         return false; 
	}
if(document.form1.email.value !="")
	{
     if(echeck(document.form1.email.value)==false)
		{
		 document.form1.email.focus();
         document.form1.email.select();
         return false; 
		}
       
		 }
 if(document.form1.phno.value =="")
	{
	 alert("Please enter the Phone number ");
		 document.form1.phno.focus();
         document.form1.phno.select();
         return false; 
	}
	 else{
		var validChars = "0123456789-";
		var checkStr=document.form1.phno.value;
		var valid=true;
		
		for (var i=0;i<checkStr.length ; i++)
		{
			var ch=checkStr.charAt(i);
			for (var j=0;j<validChars.length ;j++ )
			{
				if (ch==validChars.charAt(j))
				{
					break;
				}
			}

			if (j==validChars.length)
			{
				valid=false;
			}
		}

		if (!valid)
		{
			alert('Data Are Invalid.Only  0-9 -  Are Allowed');
			document.form1.phno.focus();
			return false;
		}
	}	
	 if(document.form1.mob.value =="")
	{
	 alert("Please enter the Mobile number ");
		 document.form1.mob.focus();
         document.form1.mob.select();
         return false; 
	}
	else{
		var validChars = "0123456789-";
		var checkStr=document.form1.mob.value;
		var valid=true;
		
		for (var i=0;i<checkStr.length ; i++)
		{
			var ch=checkStr.charAt(i);
			for (var j=0;j<validChars.length ;j++ )
			{
				if (ch==validChars.charAt(j))
				{
					break;
				}
			}

			if (j==validChars.length)
			{
				valid=false;
			}
		}

		if (!valid)
		{
			alert('Data Are Invalid.Only  0-9 -  Are Allowed');
			document.form1.mob.focus();
			return false;
		}
	}	
	/*if ( document.all.radio1.value == "" ) 
	{
 alert("Please enter your registration city");
 document.all.radio1.focus();
 return false; 
	}*/
/*	function checkForm(form1) { 
for (var i=0; i<form.radio1.length; i++) { 
if (form1.radio1.checked == false) { 
alert("you have to choose a button"); 
return false; 
} 
} 
alert("this is not working"); 
} 


	var btn=valButton(form1.radio1);
	if(btn==null)
	{
		alert("enter  your registration city");
	document.all.radio1.focus();
    return false; 
	}*/

	return true;
}
