// JavaScript Document
  function insertFile(formName, fieldName, argument, location)
  {
    var width = 1024
 	  var height = 600
    if (argument != '') {
	     argument = '?action=' + argument;
	   }
    window.open(location + "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 insertFlash() {
								var flashURI    = prompt("what is the URL of the Flash object?");
								if (!flashURI) {return;}
        var flashWidth  = prompt("how many pixels WIDE is the Flash object?");
								if (!flashWidth) {return;}
        var flashHeight = prompt("how many pixels TALL is the Flash object?");
								if (!flashHeight) {return;}

        var message = "";
								
								message = message + "[flash="+flashWidth+","+flashHeight+"]"+flashURI+"[/flash]\n";

						  window.replaceText(message);
      }		

  function manageFilesWindow(type) {
    var width = 1024
 	  var height = 600
    window.open(type, "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 = 1024
 	  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;
			
		}
