//open popup-window
function newWindow(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  winl = 0; wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.focus();
}
function add_file_input()
{
  $('<input type="file" name="file[]"/><br/>').appendTo('#file_inputs');
}
function nl2br (str, is_xhtml) 
{
      var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '' : '<br>';
 
      return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1'+ breakTag +'$2');
}
