var navAgent       = navigator.appVersion;
var browserType    = "";
var cMinPageHeight = "500";

browserType = (navAgent.indexOf("4.") == -1) ? 'Not4.0'  : '4';

if (browserType == '4') {
  browserType = (navAgent.indexOf("MSIE") == -1)
             ? (navigator.appName == 'Netscape')
             ? 'NN'
             : 'Unknown'
             : 'IE';
}

else if (navigator.appName == 'Netscape' && navigator.vendorSub) { 
  //Extra check in case browser doesn't support vendorSub
  if (navigator.vendorSub.substring(0,1) == '6') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,1) == '7') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,3) == '0.9') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,4) == '0.10') {
    browserType = 'NN6';
  } else if (navigator.vendorSub.substring(0,3) == '1.0') {
    browserType = 'NN6';
  }
 
} else {
  //Mozilla
  if (navigator.appName == 'Netscape' && navAgent.indexOf("5.") > -1 ) {
     browserType = 'NN6';
  } 
}

function ellen() {
  //empty
} 
 
function joe() {
  //empty
} 
 
function reloadsite() {
  window.location.replace('index.html');
  //self.location == 'http://www.ellenjaffee.com';
} 
 
function dvWriteContent(content) {
  if (browserType == "NN") {
      bodyContent.document.open();
      bodyContent.document.write(content);
      bodyContent.document.close();
  } else {
    bodyContent.innerHTML = content;
    textFrame.focus();
    if (browserType == 'IE' || browserType == 'NN6') {
    bodyContent.style.visibility = 'visible';
    } else {
    bodyContent.visibility = 'visible';
    }
  }
}

function dvWriteContentHdr(content) {
  if (browserType == "NN") {
      bodyContentHdr.document.open();
      bodyContentHdr.document.write(content);
      bodyContentHdr.document.close();
  } else {
    bodyContentHdr.innerHTML = content;
  }
}

function getPage(cHTMLSource) {
  window.location.replace(cHTMLSource);
}

function chkEmail(){
  if (document.getemailaddr.emailaddr.value == '') {
    alert('You must enter a valid email address');
    return false;
  }
  
  var emailadd = document.getemailaddr.emailaddr.value;

  var list1 = emailadd.split('@');  
  var beforeAt = list1[0];
  var afterAt = list1[1];
  
  //alert(beforeAt.length);
  
  //alert(afterAt);
  
  //must have an @ with something before and something after
  if ((beforeAt == "") || (afterAt == "") || (! afterAt) || (! beforeAt)) {
    alert('You must enter a valid email address');
    return false;
  }

  var list2 = afterAt.split('.');
  
  //Must be dot something
  if (! list2[1]) {
    alert('You must enter a valid email address');
    return false;
  }
  
  //must have domain
  if (list2[0].length < 2) {
    alert('You must enter a valid email address');
    return false;
  }

  document.getemailaddr.submit();
}

function chkProspect() {
  if (document.getProspect.fullname.value == '') {
    alert('Please enter your name');
    return false;
  }
  
  if (document.getProspect.phone.value == '') {
    alert('Please enter your phone');
    return false;
  }
  
  document.getProspect.submit();
}

function chkProspect2() {
  if (document.getProspect.fullname.value == '') {
    alert('Please enter your name');
    return false;
  }
    
  document.getProspect.submit();
}

function chkMsg() {
  
  if (document.getMsg.fullname.value == '') {
    alert('Please enter your name');
    return false;
  }

  if (document.getMsg.subject.value == '') {
    alert('Please enter a subject');
    return false;
  }
  
  document.getMsg.submit();
}

function getIss(cHTMLIssSource) {
  var iWinWidth;
  var iWinHeight;
  var cSrc;
  var cOpts;
  var cText;
  var winName;
  cText = cHTMLIssSource;
  
  iWinWidth  = 730;
  iWinHeight = 500;
  cOpts = 'scrollbars=1,location=0,top=0,menubar=0,width=' + iWinWidth + ',height=' + iWinHeight;
  winName = 'issbox';
  vWin = window.open(cText,winName,cOpts);
  vWin.focus();
}

function openNews(articleName) {
  var cOpts;
  var winName;
  var cUrl = 'http://www.ellenjaffee.com/news/' + articleName;
  
  cOpts = 'scrollbars=1,location=0,top=0,menubar=0,width=720,height=580';
  winName = 'newsArt';
  vWin = window.open(cUrl,winName,cOpts);
  vWin.focus();
}

function openInvite() {
  var cOpts;
  var winName;
  var cUrl = 'http://www.ellenjaffee.com/invite.html';
  
  cOpts = 'scrollbars=1,location=0,top=0,menubar=0,width=850,height=550';
  winName = 'tasteeastwin';
  vWin = window.open(cUrl,winName,cOpts);
  vWin.focus();
}

