// JavaScript Document
function clear()
{
	document.reg.reset();  
}
function clearlo()
{
	document.login.reset();  
}

function clearfor()
{
	document.forgot.reset();  
}


function txtcheck()
{
		
		var Name=document.getElementById('txtname')
			if(Name.value == ""||Name.value == null)
				{
					alert("Please enter the name.");
					Name.focus();
					return false
				}
		var emailID=document.getElementById('txtemail')
				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
					}

		var Mobile=document.getElementById('txtmobile')
			if(Mobile.value == ""||Mobile.value == null)
				{
					alert("Please enter your mobile number.");
					Mobile.focus();
					return false
				}
				
		var pasword=document.getElementById('txtpass')
			if(pasword.value == ""||pasword.value == null)
				{
					alert("Enter the password.");
					pasword.focus();
					return false
				}
			
		var pasword=document.getElementById('txtpass')
		var RePass=document.getElementById('txtcopass')
			if(RePass.value == ""||RePass.value == null || RePass.value != pasword.value)
				{
					alert("Please enter your confirm password.");
					RePass.focus();
					return false
				}
		var Country=document.getElementById('country')
			if(Country.value == ""||Country.value == null)
				{
					alert("Please select country.");
					Country.focus();
					return false
				}
		if (!document.reg.radio[0].checked &&
			!document.reg.radio[1].checked)
			{
			
			alert("Please Choose Whether The Delivery is within india Or Out Side India")
			document.reg.radio[0].focus();
			return false;
			}
		return true
	}
	
	
function txtchecklog()
{
		var emailID=document.getElementById('txtLemail')
				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
					}
		
		var Name=document.getElementById('txtLpass')
			if(Name.value == ""||Name.value == null)
				{
					alert("Please enter the password.");
					Name.focus();
					return false
				}
		if (!document.login.radios[0].checked &&
			!document.login.radios[1].checked)
			{
			
			alert("Please Choose Whether The Delivery is within india Or Out Side India")
			document.login.radios[0].focus();
			return false;
			}
	return true
}
	
function txtcheckfor()
{
		var emailID=document.getElementById('txtLemail')
				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
}

	
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 checkForInvalid(obj) 
	{
		obj.value = obj.value.replace(/[^0-9\-]|(-{2,})/gi, (RegExp.$1.indexOf("-") > -1) ? "-" : "");
	}

	

