var agt = navigator.userAgent.toLowerCase();
var is_aol = (agt.indexOf("aol") != -1);
var windowOpener = null;

function popUp(url, title, w, h) {
	if(w == null) w = 457;
	if(h == null) h = 450;
	var propStr;
	if(is_aol) {
		propStr = 'scrollbars=yes,menubar=no,resizable=yes,status=no,width=' + w + ',height=' + h;
	} else {
		propStr = 'scrollbars=yes,menubar=no,resizable=yes,status=no,width=' + w + ',height=' + h + ',top=30,left=40';
	}
	openWindow(url, title, propStr);
}

function openWindow(url,winName,propStr) {
   window.open(url,winName,propStr);
}

function unCheckAll(bool) {
  if (!bool) {
    document.getElementById('ckAll').checked = false;
  } else {
    document.getElementById('ck400').checked = false;
    document.getElementById('ck600').checked = false;
    document.getElementById('ck800').checked = false;
  }
}

function optinEmail() {
  if ((isEmail(document.maillist.emailaddress)) && (isEmail(document.maillist.emailaddress))){
    makeWindow();
    return false;
  } else {
    return false;
  }

}

function isEmail(obj) {
   if (obj.value == "") {
      alert("\nThe E-MAIL field is blank.\n\nPlease enter an e-mail address.")
      obj.focus();
      return false;
      }
   if (obj.value.indexOf ('@',0) == -1 || obj.value.indexOf ('.',0) == -1) {
      alert("\nThe E-MAIL field requires a \"@\" and a \".\"be used.\n\nPlease re-enter an e-mail address.")
      obj.select();
      obj.focus();
      return false;
      }
   return true;
}

function makeWindow(){
	var  win = window.open("", "newWindow","HEIGHT=300,WIDTH=440");
	document.maillist.target = "newWindow";
  document.getElementById('sign_up_sent').style.display = 'block';
  document.getElementById('sign_up_form').style.display = 'none';
	document.maillist.submit();
}

function hideSubNavs(nav_id) {
  document.getElementById(nav_id).className = 'bgGry disNon';
}

function showSubNav(nav_id) {
  document.getElementById(nav_id).className = 'bgGry disBlk';
}
