// JavaScript Document

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 ValidateForm(){
	var emailID=document.formregister.email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
 
 var  pre_id=1;
function showhide(id){
    obj1=document.getElementById(id);
	obj1.style.display="";
    obj2=document.getElementById(pre_id);
	obj2.style.display="none";
	pre_id=id; 
} 
function changetest2(){

$w=1;
if(document.formregister.user.value =="")
		{
			alert("please enter the user name");
			document.formregister.user.focus();
			$w=0;			
			return false;
		}
		if(document.formregister.password1.value =="")
		{
			alert("please enter the password");
			document.formregister.password1.focus()
			$w=0;
			return false;
		}
		if(document.formregister.password1.value != document.formregister.confirmpass.value)
		{
			alert("please confirm password");
			document.formregister.confirmpass.focus()
			$w=0;
			return false;
		}		
	    if(document.formregister.firmname.value =="")
		{
			alert("please enter the firm name");
			document.formregister.firmname.focus()
			$w=0;
			return false;
		}
		if(document.formregister.attorney.value == "")
		{
			alert("please enter the Attorney Name");
			document.formregister.attorney.focus();
			$w=0;
			return false;
		}
		
		if(document.formregister.saddress1.value == "")
		{
			alert("You must enter address");
			document.formregister.saddress1.focus()
			$w=0;
return false;
			
		}
		
		if(document.formregister.city.value == "")
		{
			alert("You must enter city");
			document.formregister.city.focus()
			$w=0;
return false;
			
		}
		if(document.formregister.county.value == "")
		{
			alert("You must enter county");
			document.formregister.country.focus()
			$w=0;
return false;
			
		}
		if(document.formregister.yourstate.value == "")
		{
			alert("You must enter state");
			document.formregister.yourstate.focus()
			$w=0;
return false;
			
		}
		
		if(document.formregister.email.value == "")
		{
			alert("You must enter your E mail Address");
			document.formregister.email.focus()
			$w=0;
			return false;
			
		}		
		if (echeck(document.formregister.email.value)==false){
		document.formregister.email.value=""
		document.formregister.email.focus()
		$w=0;
		return false
		}
		
		if(document.formregister.Phone.value == "")
		{
			alert("You must enter your Phone");
			document.formregister.Phone.focus()
			$w=0;
return false;
			
		}
		
		return true;		
	
}
function checkform(){
$w=1;
if(document.formregister.username.value =="")
		{
			alert("please enter the user name");
			document.formregister.username.focus();
			$w=0;			
			return false;
		}
if(document.formregister.fname.value =="")
		{
			alert("please enter first name");
			document.formregister.fname.focus();
			$w=0;			
			return false;
		}
if(document.formregister.bname.value =="")
		{
			alert("please enter the business name");
			document.formregister.bname.focus();
			$w=0;			
			return false;
		}

if(document.formregister.country.value =="")
		{
			alert("please enter the country name");
			document.formregister.country.focus();
			$w=0;			
			return false;
		}
if(document.formregister.saddress.value =="")
		{
			alert("please enter address");
			document.formregister.saddress.focus();
			$w=0;			
			return false;
		}
if(document.formregister.city.value =="")
		{
			alert("please enter the city name");
			document.formregister.city.focus();
			$w=0;			
			return false;
		}
if(document.formregister.zip.value =="")
		{
			alert("please enter zip");
			document.formregister.zip.focus();
			$w=0;			
			return false;
		}
if(document.formregister.email.value =="")
		{
			alert("please enter correct email name");
			document.formregister.email.focus();
			$w=0;			
			return false;
		}
if(document.formregister.phone.value =="")
		{
			alert("please enter correct phone number");
			document.formregister.phone.focus();
			$w=0;			
			return false;
		}
if(document.formregister.firminfo.value =="")
		{
			alert("please enter the firm information");
			document.formregister.firminfo.focus();
			$w=0;			
			return false;
		}
if (echeck(document.formregister.email.value)==false){		
		document.formregister.email.focus();
		$w=0;
		return false
		}		
		if(confirm("Are you sure ??")){
			return true;}else{return false;}
}
function showdiv()
{
document.getElementById("upload").style.display='';

}
function hidediv()
{
document.getElementById("upload").style.display='none';

}
//================================ get from ananghd.0.0.1.js
function redraw(x){
	nama=document.getElementById(x);
	if(nama.style.display==""){
		nama.style.display="none";
	}else{
		nama.style.display="";
	}}
function rrshow(x){
	nama=document.getElementById(x);
	nama.style.display="";
	nama.style.visibility="";}
	
function rrhide(x){
	nama=document.getElementById(x);
	nama.style.display="none";
	nama.style.visibility="hidden";}
function redrawwarning(){
	nama=document.getElementById('warning');
	nama.style.display="none";
	clearInterval("redrawwarning()");}	
function gotogo(dt){
	window.location=dt;}
function nilai(x){
	nama=document.getElementById(x);
	nilai=nama.value;	
	return nilai;}
function popup(dt,w,h){
	w=w+20;
	h=h+4;
	window.open(dt,'Viewable',"toolbar=no,menubar=no,resizable=yes,location=no,scrollbars=yes,width="+ w +",height="+ h);}
function blank(x){
	 nama=document.getElementById(x);
   	 nama.innerHTML = "";}

