// JavaScript Document
function country()
{
	 if(document.Ref.txtemail.value !="")
	 { 
		document.getElementById("181").style.display = '';
		document.getElementById("281").style.display = 'none';
		return false;    
	 }
	 if(document.Ref.txtemail.value =="")
	 { 
		document.getElementById("181").style.display = 'none';
		return false;    
	 }
	 return true;
}

function country1()
{
	 if(document.Ref.txtemail1.value !="")
	 { 
		document.getElementById("182").style.display = '';
		document.getElementById("282").style.display = 'none';
		return false;    
	 }
	 if(document.Ref.txtemail1.value =="")
	 { 
		document.getElementById("182").style.display = 'none';
		return false;    
	 }
	 return true;
}

function country2()
{
	 if(document.Ref.txtemail2.value !="")
	 { 
		document.getElementById("183").style.display = '';
		document.getElementById("283").style.display = 'none';
		return false;    
	 }
	 if(document.Ref.txtemail2.value =="")
	 { 
		document.getElementById("183").style.display = 'none';
		return false;    
	 }
	 return true;
}

function country3()
{
	 if(document.Ref.txtemail3.value !="")
	 { 
		document.getElementById("184").style.display = '';
		document.getElementById("284").style.display = 'none';
		return false;    
	 }
	 if(document.Ref.txtemail3.value =="")
	 { 
		document.getElementById("184").style.display = 'none';
		return false;    
	 }
	 return true;
}


function txtcheck()
{
		var Name=document.getElementById('txtName')
			if(Name.value == ""||Name.value == null)
				{
					document.getElementById('title').innerHTML="Enter your name";
					Name.focus();
					return false
				}
		var emailID=document.getElementById('txtemail')
				if ((emailID.value==null)||(emailID.value==""))
					{
							document.getElementById('title').innerHTML="Please enter your email id"
							emailID.focus()
						return false
					}
				if (echeck(emailID.value)==false)
					{
						emailID.value=""
						emailID.focus()
						return false
					}
		return true
	}

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){
		   document.getElementById('title').innerHTML="Invalid E-mail ID"
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   document.getElementById('title').innerHTML="Invalid E-mail ID"
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    document.getElementById('title').innerHTML="Invalid E-mail ID"
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    document.getElementById('title').innerHTML="Invalid E-mail ID"
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    document.getElementById('title').innerHTML="Invalid E-mail ID"
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    document.getElementById('title').innerHTML="Invalid E-mail ID"
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    document.getElementById('title').innerHTML="Invalid E-mail ID"
		    return false
		 }

 		 return true					
	}

