// JavaScript Document

  function insertFile(formName, fieldName, argument)
  {
    var width = 800
 	  var height = 600
    if (argument != '') {
	     argument = '?action=' + argument;
	   }
    window.open("insert_file.php" + argument, "insertWindow", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" + width + ",height=" + height);

    return true;
  }

/*  function insertTable(formName, fieldName, argument)
  {
    var width = 10
 	  var height = 10
    window.open("add_table.php", "insertWindow", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" + width + ",height=" + height);

    return true;
  }*/
		
		
		
								function insertTable() {
        var tableRows = prompt("how many ROWS would you like your table to have?");
        var tableCols = prompt("how many COLUMNS would you like your table to have?");

        var message = "";
								
								message = message + "[table]\n";
								
								message = message + buildRow();
								
								message = message + "[/table]\n";

								function buildRow() {
          var innerMessage = "";

										function buildCell() {
  										var innerMessage = "";
												for (var i = 0; i < tableCols; i++) {
														innerMessage = innerMessage + "[td][/td]\n";
												}
												return innerMessage;
										}

										for (var i = 0; i < tableRows; i++) {
            innerMessage = innerMessage + "[tr]\n";
												innerMessage = innerMessage + buildCell();
												innerMessage = innerMessage + "[/tr]\n";
          }
 									return innerMessage;
								}

						  window.replaceText(message)
//								window.close();
      }
		
		

  function manageFilesWindow() {
    var width = 800
 	  var height = 600
    window.open("manage_files.php", "manageFiles", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" + width + ",height=" + height);

    return true;
			
		}
		
  function manageUsersWindow() {
    var width = 800
 	  var height = 600
    window.open("manage_users.php", "manageUsers", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=" + width + ",height=" + height);

    return true;
			
		}