function post_to_url(path, params, method) {
  method = method || "post"; // Set method to post by default, if not specified.

  var form = document.createElement("form");
  form.setAttribute("method", method);
  form.setAttribute("action", path);

  for(var key in params) {
    var hiddenField = document.createElement("input");
    hiddenField.setAttribute("type", "hidden");
    hiddenField.setAttribute("name", key);
    hiddenField.setAttribute("value", params[key]);

    form.appendChild(hiddenField);
  }

  document.body.appendChild(form);
  form.submit();
}

function popUp(href, x, y, popUpName) {
  if (document.all) {
    var xMax = screen.width, yMax = screen.height;
  } else {
    if (document.layers) {
      var xMax = window.outerWidth, yMax = window.outerHeight;
    } else {
      var xMax = 640, yMax=480;
    }
  }

  if (x) {
    var width = x;
  } else {
    var width = 350;
  }

  if (y) {
    var height = y;
  } else {
    var height = 200;
  }
  
  var xOffset = (xMax - width)/2, yOffset = (yMax - height)/2;

  if (!popUpName) {
    var popUpName = 'popUpWindow';
  }

  popUpWindow=window.open(href, popUpName, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,dependent=1,width='+width+',height='+height+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset);
  popUpWindow.focus();
}
