//Function checks for name & email address on opt-in page
function sendForm()
{
    var okSoFar = true;

    if (okSoFar && document.myForm.name.value=="")
	{
            okSoFar = false;
            alert("Please enter your first name.");
            document.myForm.name.focus();
    }

    if (okSoFar && document.myForm.from.value=="")
	{
            okSoFar = false;
            alert("Please enter your e-mail so we can send you the \"3 Biggest Myths About Option Tading\" emails. Don't worry, we hate spam as much as you do.");
            document.myForm.from.focus();
    }

    if (okSoFar && document.myForm.from.value != "")
	{
      var foundAt = document.myForm.from.value.indexOf("@",0)
      if (foundAt < 1 && okSoFar)
	  {
        okSoFar = false
        alert("Please enter your e-mail so we can send you the \"3 Biggest Myths About Option Tading\" emails. Don't worry, we hate spam as much as you do.");
        document.myForm.from.focus()
      }
    }

    if (okSoFar) 
	{
		var name = document.myForm.name.value;
		var newname = '';
		name = name.split(' ');
		for(var c=0; c < name.length; c++) {newname += name[c].charAt(0).toUpperCase() +  name[c].substring(1).toLowerCase() + ' ';}
		document.myForm.name.value = newname;

		var subnames = document.myForm.name.value.split(" ");
		var fname = subnames[0];
		fname = fname.toLowerCase();
		fname = fname.substr(0,1).toUpperCase() + fname.substr(1);

		var email = document.myForm.from.value;
		email = email.toLowerCase();
		document.myForm.from.value = email;

		document.myForm.redirect.value = document.myForm.redirect.value + "&name=" + fname + "&email=" + email;
		document.myForm.meta_redirect_onlist.value = document.myForm.meta_redirect_onlist.value + "&name=" + fname + "&email=" + email;

		document.myForm.submit();
	}
}


function sendForm2()
{
    var okSoFar = true;

    if (okSoFar && document.myForm.inf_field_FirstName.value=="")
	{
            okSoFar = false;
            alert("Please enter your first name.");
            document.myForm.inf_field_FirstName.focus();
    }

    if (okSoFar && document.myForm.inf_field_Email.value=="")
	{
            okSoFar = false;
            alert("Please enter your e-mail so we can send you the \"3 Biggest Myths About Option Tading\" emails. Don't worry, we hate spam as much as you do.");
            document.myForm.inf_field_Email.focus();
    }

    if (okSoFar && document.myForm.inf_field_Email.value != "")
	{
      var foundAt = document.myForm.inf_field_Email.value.indexOf("@",0)
      if (foundAt < 1 && okSoFar)
	  {
        okSoFar = false
        alert("Please enter your e-mail so we can send you the \"3 Biggest Myths About Option Tading\" emails. Don't worry, we hate spam as much as you do.");
        document.myForm.inf_field_Email.focus()
      }
    }

    if (okSoFar) 
	{
		var name = document.myForm.inf_field_FirstName.value;
		var newname = '';
		name = name.split(' ');
		for(var c=0; c < name.length; c++) {newname += name[c].charAt(0).toUpperCase() +  name[c].substring(1).toLowerCase() + ' ';}
		document.myForm.inf_field_FirstName.value = newname;

		var subnames = document.myForm.inf_field_FirstName.value.split(" ");
		var fname = subnames[0];
		fname = fname.toLowerCase();
		fname = fname.substr(0,1).toUpperCase() + fname.substr(1);

		var email = document.myForm.inf_field_Email.value;
		email = email.toLowerCase();
		document.myForm.inf_field_Email.value = email;

		document.myForm.submit();
	}
}



//Functions to check the VIP codes & payment option
function ind1VIP()
{
  switch (document.vipForm.code.value)
  {
  case "": 
	window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732787";
	break;
  case "super1":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732795";
	break;
  case "alpha2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732795";
	break;
  case "omega2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732795";
	break;
  case "omega3":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732795";
	break;
  default:
    alert("I'm sorry, that V.I.P. code appears to be incorrect. Please make sure " +
	       "there are no errors in the code and re-submit. Note: V.I.P. code is case " +
		   "sensitive.\n\n You may also leave the field blank if you have no V.I.P. code.");
	document.vipForm.code.focus();
  } 
}

function ind2VIP()
{
  switch (document.vipForm.code.value)
  {
  case "": 
	window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732789";
	break;
  case "super1":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732797";
	break;
  case "alpha2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732797";
	break;
  case "omega2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732797";
	break;
  case "omega3":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732797";
	break;
  default:
    alert("I'm sorry, that V.I.P. code appears to be incorrect. Please make sure " +
	       "there are no errors in the code and re-submit. Note: V.I.P. code is case " +
		   "sensitive.\n\n You may also leave the field blank if you have no V.I.P. code.");
	document.vipForm.code.focus();
  } 
}

function part1VIP()
{
  switch (document.vipForm.code.value)
  {
  case "": 
	window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732791";
	break;
  case "super1":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732802";
	break;
  case "alpha2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732802";
	break;
  case "omega2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732802";
	break;
  case "omega3":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732802";
	break;
  default:
    alert("I'm sorry, that V.I.P. code appears to be incorrect. Please make sure " +
	       "there are no errors in the code and re-submit. Note: V.I.P. code is case " +
		   "sensitive.\n\n You may also leave the field blank if you have no V.I.P. code.");
	document.vipForm.code.focus();
  } 
}

function part2VIP()
{
  switch (document.vipForm.code.value)
  {
  case "": 
	window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732793";
	break;
  case "super1":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732803";
	break;
  case "alpha2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732803";
	break;
  case "omega2":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732803";
	break;
  case "omega3":
    window.location="http://www.cyberwealthautomation.com/app/javanof.asp?MerchantID=59831&ProductID=3732803";
	break;
  default:
    alert("I'm sorry, that V.I.P. code appears to be incorrect. Please make sure " +
	       "there are no errors in the code and re-submit. Note: V.I.P. code is case " +
		   "sensitive.\n\n You may also leave the field blank if you have no V.I.P. code.");
	document.vipForm.code.focus();
  } 
}
