



/* ---  WYSIWYG EDITOR STUFF ---- */
function start_editor() {
	editor.document.designMode = "On";
	setTimeout("loadText()", 500);
}

function format(text_content) {
	var textRange = editor.document.selection.createRange();
	var res = textRange.execCommand(text_content);
}



function loadText() {
	editor.document.body.innerHTML = document.update.content.value;
}

function SubmitContent() {
  	i= editor.document.body.innerHTML;
  	if (i == "") {
		alert("Please enter text");
		return false;
  	}  
	document.update.newcontent.value = editor.document.body.innerHTML;
 	value = document.update.newcontent.value;
}

function doForeCol(val){
	editor.document.execCommand('forecolor', false, val);
}

function doFontSize(val){
	editor.document.execCommand('fontsize', false, val);
}

function getImage(imgloc)  { 
	var imgSrc = imgloc; 
if(imgSrc != null)  {
	editor.document.execCommand('insertimage', false, imgSrc); 
	} 
	return;
}

function valUpload() {
	// set up variables to capture values
	var f, upload
		f = document.uploadform;
		image_file = f.image_file.value
		image_name = f.image_name.value

	if(image_name == ""){
		alert("Please enter a title or description of the image\ne.g. Boy's hockey school application");
		f.image_name.focus();
		return false;
	}
	
	// upload box cannot be empty
	if(image_file == ""){
		alert("Please select a file");
		f.image_file.focus();
		return false;
	}
}


