function isEmail(str){
   re = /(.*)@(.*).(com|net|org|tv|biz)/ig;
   if (re.exec(str) != null)return true;
   else return false;
};

function checkForm(){
   var ok = true;
   if (ok){
      if (document.getElementById("provider").value.toLowerCase() == "entergy" && document.getElementById("account_number").value == ""){
         alert("You must enter your Entergy account number.");
         ok = false;
      };
   };
   return ok;
};

function isCox(){
   re = /@cox.net|@cox.com|@cox-internet.com|@cox-internet.net/i;
   if (re.exec(document.getElementById("email").value) != null)return true;
   else return false;
};

function toggleConnection(){
   var index = -1;
   for (var i=0; i<document.forms[0].connection_type.length; i++)if (document.forms[0].connection_type[i].checked)index = i;
   switch (index){
      case 0 : if (isCox())document.getElementById("cable_info").style.display = "block";
               document.getElementById("satellite_info").style.display = "none";
               break;
      case 1 : document.getElementById("cable_info").style.display = "none";
               document.getElementById("satellite_info").style.display = "block";
               break;
      case 2 : document.getElementById("cable_info").style.display = "none";
               document.getElementById("satellite_info").style.display = "none";
               break;
   };
};

function openSatellite(){
   var newWin = window.open("satellite.html","","width=400,height=400");
};

function openCable(){
   var newWin = window.open("cable.html","","width=650,height=540,scrollbars=yes,resizable=yes");
};

function checkBilling(provider,cycle){
   if (provider.toLowerCase() != "demco" && cycle.toLowerCase() == "monthly"){
      alert("Please note: Monthly billing cycle is only available for DEMCO customers.");
      document.forms[0].billed.selectedIndex = 1;
   };
   if (provider.toLowerCase() == "entergy")document.getElementById("account_number_row").style.display = "";
   else document.getElementById("account_number_row").style.display = "none";
};