function construction() {
	alert('This feature is Under Construction');
}

function popWindow(filename){
	popup = window.open(filename,"myWindow",
	"height=400,width=450,left=120,top=100,menubar=no,status=yes,scrollbars=yes,scrollable=yes,resizable=1");
}

// main menu functions:
function menuOn(cell) {
	cell.style.background="#993366";
	cell.style.color="#FFFFFF";
}
function menuOff(cell) {
	cell.style.background="#FFFFFF";
	cell.style.color="#993366";
}

// textarea editing functions:
var myhistory = new Array(20);
var h_index = 0;

function save_history() {
	myhistory[h_index] = document.myForm.s_pagecontent.value;
}

function format_sel(v) {
  var myspace = '';
  var str = document.selection.createRange().text;
  document.myForm.s_pagecontent.focus();
  var sel = document.selection.createRange();
  // move space at right of selection to outside of tags
  if (str.charAt(str.length-1) == " ") {
  	str = str.replace( /\s*$/, "" );
	myspace = ' ';
  	}
  sel.text = "<" + v + ">" + str + "</" + v + ">" + myspace;
  h_index = h_index + 1;
  save_history();
  return;
}

function bullet_list() {
  var str = document.selection.createRange().text;
  document.myForm.s_pagecontent.focus();
  var sel = document.selection.createRange();
  var pattern = /\r\n/g;
  sel.text = "<ul><li>" + sel.text.replace(pattern,"</li>\r<li>") + "</li></ul>";
  h_index = h_index + 1;
  save_history();
  return;
}

function insert_image(id,align) {
  if (id != 0) {
  var str = document.selection.createRange().text;
  document.myForm.s_pagecontent.focus();
  var sel = document.selection.createRange();
  var pattern = /\r\n/g;
  sel.text = "<" + id + align + ">";
  h_index = h_index + 1;
  save_history();
  return;
  }
}

function insert_link(my_link,foldername) {
  var myspace = '';
  var str = document.selection.createRange().text;
  document.myForm.s_pagecontent.focus();
  if (my_link == null) {
  	my_link = prompt("Enter URL:","http://");
  	}
  else  {
  	if (foldername != null) {
  		my_link = foldername + my_link;
		}
    }
  if (my_link != null) {
    var sel = document.selection.createRange();
	// move space at right of selection to outside of tags
	  if (str.charAt(str.length-1) == " ") {
	  	str = str.replace( /\s*$/, "" );
		myspace = ' ';
	  	}
	sel.text = "<a href=\"" + my_link + "\">" + str + "</a>" + myspace;
  }
  h_index = h_index + 1;
  save_history();
  return;
}

function undo() {
	if ( h_index > 0 ) { 
		h_index = h_index - 1; 
		document.myForm.s_pagecontent.value = myhistory[h_index];
		document.selection.empty();
	}
	return;
}
// ---------- end ---------------


function popHelp(ID){
	var thisURL = "help.cfm?blobID=" + ID;
	popup = window.open(thisURL,"myWindow","height=400,width=400,left=100,top=20,scrollbars=yes,scrollable=yes,resizable=1");
	}

