/**
 * This function allows a mailto operation to hide behind a form button. When
 * the user clicks the form button the behaviour is identical to clicking on
 * a mailto tag in HTML.
 *
 * This function is used for Outlook Integration.
 *
 * @author SMcE 12/August/2003. A fine summers day.
 */
function popupMessage(subject, body) {
  // BUILD MAIL MESSAGE COMPONENTS
  var doc = "mailto:" +
  "?subject=" + escape(subject) +
  '&body=' + escape(body);
  window.location = doc;
}

/**
 * This function is similar to above but allows us to pass in a 'To' email address.
 *
 * This function is used for sending a support e-mail from the login page. when the
 * user clicks the support@company.com hypertext, this function will create a mail
 * message with the To and Subject fields populated.
 *
 * @author GW 23/Jan/2004.
 */

function popupMessageTo(to, subject, body) {
  // BUILD MAIL MESSAGE COMPONENTS
  var doc = "mailto:" + to +
  "?subject=" + escape(subject) +
  '&body=' + escape(body);
  window.location = doc;
}

function inviteEmailPopup(subject, body, msg) {
  var escapedSubject = escape(subject);
  var escapedBody = escape(body);
  var size = escapedSubject.length + escapedBody.length;
  if (size > 2048) {
    alert(msg);
  }
  else {
      var doc = "mailto:" +
      "?subject=" + escapedSubject +
      '&body=' + escapedBody;
      window.location = doc;
  }
}

function copyrightWindow (path, winStyle) {
    var query;
    if (-1 == path.indexOf("http"))
      query = "http://" + document.domain + "/" + path;
    else
      query = path;
    var settings = winStyle.split (",");

    var winl = Number (Number (Number(window.screen.availWidth) - Number(settings[0])) /2);
    var wint = Number (Number (Number(window.screen.availHeight) - Number(settings[1])) /2);
    var style ='width='+settings[0]+',';
    style +='height='+settings[1]+',';
    style +='top='+wint+',';
    style +='left='+winl+',';
    style +='status='+settings[2]+',';
    style +='resizable='+settings[3]+',';
    style +='toolbar='+settings[4]+',';
    style +='menubar='+settings[5]+',';
    style +='scrollbars='+settings[6]+',';
    style +='location='+settings[7];
    return window.open(query, "WebPortal3", style);
}
