// JScript File
function checktxtEmailandName()
{
    if(document.form1.txtName.value=="")
    {
        document.form1.txtName.focus();
        document.form1.txtName.style.backgroundColor="yellow"
        alert("Please enter a your name!!")
        return false;
    }
    else
    {
        document.form1.txtName.style.backgroundColor="white"
        if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtEmail.value))
        {
            document.form1.txtEmail.style.backgroundColor="white"
            return true;
        }
        else
        {  
            document.form1.txtEmail.focus();
            document.form1.txtEmail.style.backgroundColor="yellow"
            alert("Please enter a proper email address\neg. shailesh@healthandyoga.com")
            return false;
        }
    }
}
//////////
function checktxtEmail()
{
    if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtEmail.value))
    {
        document.form1.txtEmail.style.backgroundColor="white"
        return true;
    }
    else
    {  
        document.form1.txtEmail.focus();
        document.form1.txtEmail.style.backgroundColor="yellow"
        alert("Please enter a proper email address\neg. shailesh@healthandyoga.com")
        return false;
    }
}
//////////
function checktxtBuyer()
{
    if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtBuyer.value))
    {
        document.form1.txtBuyer.style.backgroundColor="white"
        return true;
    }
    else
    {  
        document.form1.txtBuyer.focus();
        document.form1.txtBuyer.style.backgroundColor="yellow"
        alert("Please enter a proper previous email address\neg. shailesh@healthandyoga.com")
        return false;
    }
}
//////////
function checktxtRf()
{
    if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtRf.value))
    {
        document.form1.txtRf.style.backgroundColor="white" 
        return true;
    }
    else
    {  
         document.form1.txtRf.focus();
         document.form1.txtRf.style.backgroundColor="yellow"
         alert("Please enter a proper referral email address\neg. shailesh@healthandyoga.com")
         return false;
    }
}
//////////
function checkBothEmail()
{
  if(document.form1.ddlCountry1.value == "9999")
  {
     //document.form1.ddlCountry1.focus();   
     //alert("Pls select billing country!!");
     //return false;
     document.form1.ddlCountry1.value = "223";
  }
  else if(document.form1.ddlCountry2.value == "9999")
  {
     //document.form1.ddlCountry2.focus();   
     //alert("Pls select delivery country!!");
     //return false;
     document.form1.ddlCountry2.value = "223";
  }
  if(document.form1.txtEmail1.value == "")
  {
    document.form1.txtEmail1.style.backgroundColor="white"
    if(document.form1.txtEmail2.value=="")
    {
        document.form1.txtEmail2.style.backgroundColor="white"
        return true;
    }
    else
    {
        //if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtEmail2.value))
		if(/^.+@.+\..{2,3}$/.test(document.form1.txtEmail2.value))
        {
            document.form1.txtEmail2.style.backgroundColor="white"
            return true;
        }
        else
        {  
            document.form1.txtEmail2.focus();
            document.form1.txtEmail2.style.backgroundColor="yellow"
            alert("Please enter a proper dilivery email address\neg. shailesh@healthandyoga.com")
            return false;
        }
    }  
  }
  else
  {
    //if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtEmail1.value))
	if(/^.+@.+\..{2,3}$/.test(document.form1.txtEmail1.value))
    {
        document.form1.txtEmail1.style.backgroundColor="white"
        if(document.form1.txtEmail2.value=="" || document.form1.txtEmail2.value == null)
        {
            document.form1.txtEmail2.style.backgroundColor="white"
            return true;
        }
        else
        {
            //if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtEmail2.value))
			if(/^.+@.+\..{2,3}$/.test(document.form1.txtEmail2.value))
            {
                document.form1.txtEmail2.style.backgroundColor="white"
                return true;
            }
            else
            {  
                document.form1.txtEmail2.focus();
                document.form1.txtEmail2.style.backgroundColor="yellow"
                alert("Please enter a proper billing email address\neg. shailesh@healthandyoga.com")
                return false;
            }
        }  
    }
    else
    {  
         document.form1.txtEmail1.focus();
         document.form1.txtEmail1.style.backgroundColor="yellow"
         alert("Please enter a proper email address\neg. shailesh@healthandyoga.com")
         return false;
    }
  }  
}
//////////
function checktxtEmail2()
{
  if(document.form1.txtEmail2.value=="" || document.form1.txtEmail2.value == null)
  {
     document.form1.txtEmail2.style.backgroundColor="white"
     return true;
  }
  else
  {
    if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.txtEmail2.value))
    {
        document.form1.txtEmail2.style.backgroundColor="white"
        return true;
    }
    else
    {  
         document.form1.txtEmail2.focus();
         document.form1.txtEmail2.style.backgroundColor="yellow"
         alert("Please enter a proper email address\neg. neeraj@healthandyoga.com")
         return false;
    }
  }  
}
//////////
function checkFreeEmail()
{
    if(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.form1.freenews.FreeNewsEmail.value))
    {
        document.form1.freenews.FreeNewsEmail.style.backgroundColor="white"
        return true;
    }
    else
    {  
        document.form1.freenews.FreeNewsEmail.focus();
        document.form1.freenews.FreeNewsEmail.style.backgroundColor="yellow"
        alert("Please enter a proper previous email address\neg. neeraj@healthandyoga.com")
        return false;
    }
}
