﻿var newListsWindow=null;
function comOpenListsWindow(comForm, checkName)
{ if(comForm.email.value.length==0)
  { alert("Please enter your email address.");
    comForm.email.focus();
    return false;
  }
  
  if (checkName)
  { if(comForm.fullname.value.length==0)
    { alert("Please enter your full name.");
      comForm.fullname.focus();
      return false;
    }
  }
  
  if (!window.focus) return true;
  newListsWindow = window.open("", "comListsWindow", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width=600,height=600"); 
  comForm.target = "comListsWindow";
  newListsWindow.focus();
  return true;
}

function comOpenFeedburnerWindow(comForm)
{ if(comForm.fullname.value.length==0)
  { alert("Please enter your full name.");
    comForm.fullname.focus();
    return false;
  }
  if(comForm.email.value.length==0)
  { alert("Please enter your email address.");
    comForm.email.focus();
    return false;
  }

  var comList = comForm.elements['uri'];
  var comListChecked = false;
  for (var i=0; i<comList.length; i++)
  { if (comList[i].checked)
    { comListChecked = true;
      var comURIValue = comList[i].value;
      break;
    }
  }
  
  if (!comListChecked)
  { // If there were 0 selections made display an alert box 
    msg="Please select an email list.\n"
    alert(msg);
    return false;
  }

  MakeRequest(comURIValue, comForm.fullname.value, comForm.email.value);

  if (!window.focus) return true;
  newListsWindow = window.open("http://feedburner.google.com/fb/a/mailverify", "comListsWindow", "scrollbars=yes,width=550,height=520"); 
  comForm.target = "comListsWindow";
  newListsWindow.focus();
  return true;
}

function getXMLHttp()
{ var xmlHttp
  try
  { //Firefox, Opera 8.0+, Safari
    xmlHttp = new XMLHttpRequest();
  }
  catch(e)
  { //Internet Explorer
    try
    { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    { try
      { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e)
      { alert("Your browser does not support AJAX!")
        return false;
      }
    }
  }
  return xmlHttp;
}

function MakeRequest(uri, fullname, email)
{ var xmlHttp = getXMLHttp(); 
  xmlHttp.onreadystatechange = function()
  { if(xmlHttp.readyState == 4)
    { // HandleResponse(xmlHttp.responseText);
    }
  }
  var page = "feedburner2.php?uri=" + uri + "&name=" + fullname + "&email=" + email;
  xmlHttp.open("GET", page, true); 
  xmlHttp.send(null);
}

