function onload(){document.getElementById("txtComment").setAttribute('onpaste','charsLeft(this,1000,"comLim")');document.getElementById("txtComment").setAttribute('onkeyup','charsLeft(this,1000,"comLim")');document.getElementById("txtComment").setAttribute('oninput','charsLeft(this,1000,"comLim")');}
function charsLeft(t,l,s){var length=t.value.length;var s=document.getElementById(s);var left=l-length;t.value=t.value.substring(0,l);s.innerHTML=left+" characters left.";}
function validate_required(field,alerttxt){with(field){if(value==null||value==""){alert(alerttxt);return false;}else return true;}}
function validate_form(thisform){with(thisform){
if(validate_required(txtName,"You must provide a name.")==false){txtName.focus();return false;}
else if(validate_required(txtComment,"You must provide a comment.")==false){txtComment.focus();return false;}
else return true;}
}

function swapTextAreas() {
tinyMCE.init({
// General options
mode : "textareas",
theme : "advanced",
plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",

// Theme options
theme_advanced_buttons1 : "fontselect,fontsizeselect,|,save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,preview",
theme_advanced_buttons3 : "forecolor,backcolor,|,hr,removeformat,visualaid,|,sub,sup,|,iespell,media,advhr,|,fullscreen,|,spellchecker,|,del,ins,|,nonbreaking,blockquote,pagebreak,|,insertfile,insertimage",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : false,
 
// Example content CSS (should be your site CSS)
content_css : "css/example.css",
 
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js",
external_link_list_url : "js/link_list.js",
external_image_list_url : "js/image_list.js",
media_external_list_url : "js/media_list.js",
 
// Replace values for the template plugin
template_replace_values : {
username : "Alejandro",
staffid : "00001"
}});}
