// JavaScript Document
function discardChanges(gotoURL) {
	if (document.theform) {
		if (document.theform.savebut) {
			if (document.theform.savebut.disabled == false) {
				var checkSave = confirm("Discard your changes?");
				if (checkSave) location.href=gotoURL;
			} else location.href=gotoURL;
		} else location.href=gotoURL;
	} else location.href=gotoURL;
}


function enableSave() {
		document.theform.savebut.disabled = false;
		if (document.theform.savebut.value == "SAVED") {
		document.theform.savebut.value = "SAVE CHANGES"; }
	}
	
function highlightSave() {  
		document.theform.savebut.style.color = "red";
	}
	
	
function disableSubmit (form) {
	if (form.submitted) return false;
	form.submitted = true;
	form.savebut.disabled = true;
	return true;
}

// attempt at expansion functionality. I was never able to get a straight answer from TinyMCE as to how onActivate works
function expandTextArea(ed) {
    var s = ed.settings;
    var inactive = "50PX";
    var active = "500PX";
    ed.id.style.background = inactive; //to make sure it is set if there is only one editor
    tinymce.dom.Event.add(s.content_editable ? ed.getBody() : (tinymce.isGecko ? ed.getDoc() : ed.getWin()), 'focus', function(e) {
        ed.getBody().style.height = active;
    });
    tinymce.dom.Event.add(s.content_editable ? ed.getBody() : (tinymce.isGecko ? ed.getDoc() : ed.getWin()), 'blur', function(e) {
        ed.getBody().style.height = inactive;
    });
}

      
