');
}
if (!readOnly)
{
document.writeln('');
} else {
document.writeln('');
}
if (source && !readOnly) document.writeln(' View HTML Source');
document.writeln('');
document.writeln('');
document.writeln('');
document.writeln('');
//document.writeln('');
document.writeln('');
document.getElementById('hdn' + rte).value = html;
enableDesignMode(rte, html, readOnly);
}
function calcHeight(rte_name)
{
//find the height of the internal page
var the_height= 100;
if (document.all)
{
the_height = frames[rte_name].document.body.scrollTop;
alert("height1 is "+the_height);
} else {
the_height = document.getElementById(rte_name).contentWindow.
document.body.scrollHeight;
}
if (the_height == 0)
{
the_height = 50;
}
//change the height of the iframe
document.getElementById(rte_name).height=
the_height;
}
function enableDesignMode(rte, html, readOnly) {
var frameHtml = "\n";
frameHtml += "\n";
//to reference your stylesheet, set href property below to your stylesheet path and uncomment
if (cssFile.length > 0) {
frameHtml += "\n";
} else {
frameHtml += "\n";
}
frameHtml += "\n";
frameHtml += "\n";
frameHtml += html + "\n";
frameHtml += "\n";
frameHtml += "";
if (document.all) {
var oRTE = frames[rte].document;
oRTE.open();
oRTE.write(frameHtml);
oRTE.close();
if (!readOnly) oRTE.designMode = "On";
} else {
try {
if (!readOnly) document.getElementById(rte).contentDocument.designMode = "on";
try {
var oRTE = document.getElementById(rte).contentWindow.document;
oRTE.open();
oRTE.write(frameHtml);
oRTE.close();
if (isGecko && !readOnly) {
//attach a keyboard handler for gecko browsers to make keyboard shortcuts work
oRTE.addEventListener("keypress", kb_handler, true);
}
} catch (e) {
alert("Error preloading content.");
}
} catch (e) {
//gecko may take some time to enable design mode.
//Keep looping until able to set.
if (isGecko) {
setTimeout("enableDesignMode('" + rte + "', '" + html + "', " + readOnly + ");", 10);
} else {
return false;
}
}
}
}
function updateRTEs() {
var vRTEs = allRTEs.split(";");
for (var i = 0; i < vRTEs.length; i++) {
updateRTE(vRTEs[i]);
}
}
function updateRTE(rte) {
if (!isRichText) return;
//set message value
var oHdnMessage = document.getElementById('hdn' + rte);
var oRTE = document.getElementById(rte);
var readOnly = false;
//check for readOnly mode
if (document.all) {
if (frames[rte].document.designMode != "On") readOnly = true;
} else {
if (document.getElementById(rte).contentDocument.designMode != "on") readOnly = true;
}
if (isRichText && !readOnly) {
//if viewing source, switch back to design view
if (showSource)
{
if (document.getElementById("chkSrc" + rte).checked) {
document.getElementById("chkSrc" + rte).checked = false;
toggleHTMLSrc(rte);
}
}
if (oHdnMessage.value == null) oHdnMessage.value = "";
if (document.all) {
oHdnMessage.value = stripLineBreaks(frames[rte].document.body.innerHTML);
} else {
oHdnMessage.value = stripLineBreaks(oRTE.contentWindow.document.body.innerHTML);
}
//if there is no content (other than formatting) set value to nothing
if (stripHTML(oHdnMessage.value.replace(" ", " ")) == ""
&& oHdnMessage.value.toLowerCase().search("";
var TdefRowCount=0;
var TdefColumnCount=0;
while ( TdefRowCount < TdefRows )
{
ReplaceHtml=ReplaceHtml+"
";
TdefRowCount=TdefRowCount+1;
TdefColumnCount=0;
while( TdefColumnCount < TdefCols )
{
if (isIE)
{
// IE allows you to edit with nothing in the tabledef
ReplaceHtml=ReplaceHtml+"
";
}
else
{
// Mozilla needs a blank space to work
ReplaceHtml=ReplaceHtml+"
";
}
ReplaceHtml=ReplaceHtml+"";
// alert("Html with table text: "+ReplaceHtml);
// alert("InnerHtmlTextCursorPos:"+InnerHtmlTextCursorPos+" Length:"+InnerHtmlText.length);
// alert("Rest of text: "+InnerHtmlText.substr(InnerHtmlTextCursorPos,InnerHtmlText.length));
// Add on the rest of the text
ReplaceHtml=ReplaceHtml+InnerHtmlText.substr(InnerHtmlTextCursorPos,InnerHtmlText.length);
oRTE.document.body.innerHTML=oRTE.document.body.innerHTML=ReplaceHtml;
oRTE.focus();
RemoveCursorMarker();
document.getElementById('tabd' + rte).style.visibility = "hidden";
document.getElementById('tabd' + rte).style.display = "none";
}
function locateCursor() {
var rte = currentRTE;
var oRTE = document.getElementById(currentRTE);
if (document.all) {
oRTE = frames[rte];
//get current selected range
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
//get currently selected range
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
// var parentCommand = parent.command;
oRTE.focus();
// We've got a piece of text to search for already in the html text.
// alert(oRTE.document.body.innerHTML);
// We've added in the position marger (as an image) into the raw html.
// Now, given that we know what the text starts and ends with, work out
// the actual start and end position, and the text within the HTML string
// NOTE: I'm not searching for the exact text, as different browsers may
// put minor changes into the HTML, e.g. spaces, case etc.
var MainHtml=oRTE.document.body.innerHTML;
// Uppercase is used purely for searching - but it is equivalent to the
// real html.
var MainHtmlUpper=MainHtml.toUpperCase();
// alert(MainHtmlUpper);
// First-find the start of the IMG Src
var StartTdef1=MainHtml.indexOf("TABDEF_XXX.gif");
// alert("XXX at "+StartTdef1);
var StartTdef = -1;
for (var i = StartTdef1; i >= 0 && StartTdef==-1 ; i--) {
if (MainHtmlUpper.substr(i,1)=="<")
{
StartTdef=i;
};
// alert(MainHtmlUpper.substr(i,5)+" > "+StartTdef);
}
if( StartTdef==-1 )
{
// Panic - got a problem
alert("Can't find table marker?");
}
// The start of the IMG is at StartTdef - now find end.
// alert(StartTdef);
// Html is bounded by '>'
var EndTdef=MainHtmlUpper.indexOf(">",StartTdef1);
// alert(EndTdef);
// Get the length of string to remove
var TdefStrLen=EndTdef-StartTdef+1;
// alert(TdefStrLen);
// This is the string to remove - should be the same as original.
var TdefStr=MainHtml.substr(StartTdef,TdefStrLen);
// alert("Marker str:"+TdefStr);
// Got the details - now remove the marker string from the original HTML
var MadeOrigStringStart=MainHtml.substr(0,StartTdef);
var MadeOrigStringEnd=MainHtml.substr(EndTdef+1,MainHtml.length);
// alert ("MadeOrigStringStart:'"+MadeOrigStringStart+"' End:'"+MadeOrigStringEnd+"'");
InnerHtmlTextCursorPos=MadeOrigStringStart.length;
InnerHtmlText=MadeOrigStringStart+MadeOrigStringEnd;
}
function RemoveCursorMarker() {
// As a cleanup, hunt through and remove the special marker
// used to locate the cursor.
var rte = currentRTE;
var oRTE = document.getElementById(currentRTE);
if (document.all) {
oRTE = frames[rte];
//get current selected range
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
//get currently selected range
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
// var parentCommand = parent.command;
oRTE.focus();
// We've got a piece of text to search for already in the html text.
// alert(oRTE.document.body.innerHTML);
// We've added in the position marker (as an image) into the raw html.
// Now, given that we know what the text starts and ends with, work out
// the actual start and end position, and the text within the HTML string
// NOTE: I'm not searching for the exact text, as different browsers may
// put minor changes into the HTML, e.g. spaces, case etc.
var MainHtml=oRTE.document.body.innerHTML;
// Uppercase is used purely for searching - but it is equivalent to the
// real html.
var MainHtmlUpper=MainHtml.toUpperCase();
// alert(MainHtmlUpper);
// First-find the start of the IMG Src
var StartTdef1=MainHtml.indexOf("TABDEF_XXX.gif");
// alert("XXX at "+StartTdef1);
var StartTdef = -1;
for (var i = StartTdef1; i >= 0 && StartTdef==-1 ; i--) {
if (MainHtmlUpper.substr(i,1)=="<")
{
StartTdef=i;
};
// alert(MainHtmlUpper.substr(i,5)+" > "+StartTdef);
}
if( StartTdef> -1 )
{
// Found a marker to remove
// The start of the IMG is at StartTdef - now find end.
// alert(StartTdef);
// End of image is '>'
var EndTdef=MainHtmlUpper.indexOf(">",StartTdef1);
// alert(EndTdef);
// Get the length of string to remove
var TdefStrLen=EndTdef-StartTdef+1;
// alert(TdefStrLen);
// This is the string to remove - should be the same as original.
var TdefStr=MainHtml.substr(StartTdef,TdefStrLen);
// alert(TdefStr);
// Got the details - now remove the marker string from the original HTML
var MadeOrigStringStart=MainHtml.substr(0,StartTdef);
var MadeOrigStringEnd=MainHtml.substr(EndTdef+1,MainHtml.length);
// alert ("MadeOrigStringStart:'"+MadeOrigStringStart+"' End:'"+MadeOrigStringEnd+"'");
InnerHtmlTextCursorPos=MadeOrigStringStart.length;
oRTE.document.body.innerHTML=MadeOrigStringStart+MadeOrigStringEnd;
}
}
//Function to set cell background colour
function setCellBackground(color) {
var rte = currentRTE;
var oRTE = document.getElementById(currentRTE);
locateCursor();
// alert("Text:"+InnerHtmlText+" Pos:"+InnerHtmlTextCursorPos);
if (document.all) {
oRTE = frames[rte];
//get current selected range
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
//get currently selected range
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
var parentCommand = parent.command;
oRTE.focus();
// The two standard variables used are:
// InnerHtmlText - Contains the HTML text
// InnerHtmlTextCursorPos - contains the position of the cursor within the HTML text.
// alert("SetCellColour:"+color);
var mStrPtr=InnerHtmlTextCursorPos;
// Get an upper-case version of the HTML text used for searching.
var InnerHtmlTextUpper = InnerHtmlText.toUpperCase();
// Find the cell definition
while ( InnerHtmlTextUpper.substr(mStrPtr,3) != "
=0 )
{
// Hunting for a cell definition
mStrPtr = mStrPtr-1;
}
// Now we've got the location of the cell definition - find the end of the TD
var mStrPtr2=InnerHtmlText.indexOf(">",mStrPtr);
// Get the before and after parts of the cell definition.
var ResultStrStart=InnerHtmlText.substr(0,mStrPtr);
var TDLength=mStrPtr2-mStrPtr+1;
var TDString=InnerHtmlText.substr(mStrPtr,TDLength);
var ResultStrEnd=InnerHtmlText.substr(mStrPtr+TDLength,InnerHtmlText.length);
// Got the cell definition
TDString=TDString.toUpperCase();
// alert(TDString);
// Before we add the BGCOLOR, we need to see if one already exists,
// if so, we need to remove it...
// We assume the following.
// IE: ...bgColor=#123456
// Moz: ...bgColor="#123456"
var BGColorFound=TDString.indexOf("BGCOLOR");
if (BGColorFound > -1)
{
// alert("BG found at:"+BGColorFound);
// what we need to do now, is remove the BGCOLOR element, we know the start
// now find the end (bounded by ' ' or '>'
// Get the text before the BGCOLOR
var TDString2=TDString.substr(0,BGColorFound-1);
var BGEND1 = TDString.indexOf(">",BGColorFound);
var BGEND2 = TDString.indexOf(" ",BGColorFound);
// Get whichever is first...
if (BGEND1 >=0 && BGEND2 >=0)
{
if (BGEND1 > BGEND2 )
{
var BGEND=BGEND2;
}
else
{
var BGEND=BGEND1;
}
}
else
{
if (BGEND1 >=0 )
{
var BGEND=BGEND1;
}
else
{
var BGEND=BGEND2;
}
}
TDString2=TDString2+TDString.substr(BGEND,TDString.length);
}
else
{
var TDString2=TDString;
}
// take off the trailing '>' and add on the new bgColor value.
TDString2=TDString2.substr(0,TDString2.length-1)+' bgColor="'+color+'">';
// alert("TDString2:"+TDString2);
var ReplaceHtml = ResultStrStart +TDString2+ResultStrEnd;
oRTE.document.body.innerHTML=ReplaceHtml;
oRTE.focus();
RemoveCursorMarker();
document.getElementById('tabp' + rte).style.visibility = "hidden";
document.getElementById('tabp' + rte).style.display = "none";
}
//Function to Add border size to a table
function setBorderSize(color) {
var rte = currentRTE;
var oRTE = document.getElementById(currentRTE);
locateCursor();
// alert("Text:"+InnerHtmlText+" Pos:"+InnerHtmlTextCursorPos);
if (document.all) {
oRTE = frames[rte];
//get current selected range
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
//get currently selected range
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
var parentCommand = parent.command;
oRTE.focus();
// The two standard variables used are:
// InnerHtmlText - Contains the HTML text
// InnerHtmlTextCursorPos - contains the position of the cursor within the HTML text.
// alert("SetCellColour:"+color);
var mStrPtr=InnerHtmlTextCursorPos;
// Get an upper-case version of the HTML text used for searching.
var InnerHtmlTextUpper = InnerHtmlText.toUpperCase();
// Find the cell definition
while ( InnerHtmlTextUpper.substr(mStrPtr,6) != "
=0 )
{
// Hunting for a cell definition
mStrPtr = mStrPtr-1;
}
// Now we've got the location of the table definition - find the end of the TABLE
var mStrPtr2=InnerHtmlText.indexOf(">",mStrPtr);
// Get the before and after parts of the cell definition.
var ResultStrStart=InnerHtmlText.substr(0,mStrPtr);
var TDLength=mStrPtr2-mStrPtr+1;
var TDString=InnerHtmlText.substr(mStrPtr,TDLength);
var ResultStrEnd=InnerHtmlText.substr(mStrPtr+TDLength,InnerHtmlText.length);
// Got the cell definition
TDString=TDString.toUpperCase();
// alert("Tablestring:"+TDString);
// Before we add the BORDER, we need to see if one already exists,
// if so, we need to remove it...
var BorderFound=TDString.indexOf("BORDER");
if (BorderFound > -1)
{
// alert("Border found at:"+BorderFound);
// what we need to do now, is remove the BORDER element, we know the start
// now find the end (bounded by ' ' or '>'
// Get the text before the BORDER
var TDString2=TDString.substr(0,BorderFound-1);
// alert ("TDString2 (start)"+TDString2);
var BGEND1 = TDString.indexOf(">",BorderFound);
var BGEND2 = TDString.indexOf(" ",BorderFound);
// Get whichever is first...
if (BGEND1 >=0 && BGEND2 >=0)
{
if (BGEND1 > BGEND2 )
{
var BGEND=BGEND2;
}
else
{
var BGEND=BGEND1;
}
}
else
{
if (BGEND1 >=0 )
{
var BGEND=BGEND1;
}
else
{
var BGEND=BGEND2;
}
}
// alert("Adding:"+TDString.substr(BGEND,TDString.length)+" End:"+BGEND);
TDString2=TDString2+TDString.substr(BGEND,TDString.length);
}
else
{
var TDString2=TDString;
}
// take off the trailing '>' and add on the new bgColor value.
TDString2=TDString2.substr(0,TDString2.length-1)+' border="'+color+'">';
// alert("TDString2:"+TDString2);
var ReplaceHtml = ResultStrStart +TDString2+ResultStrEnd;
oRTE.document.body.innerHTML=ReplaceHtml;
oRTE.focus();
RemoveCursorMarker();
document.getElementById('tabp2' + rte).style.visibility = "hidden";
document.getElementById('tabp2' + rte).style.display = "none";
}
//Function to Add table
function setColumnWidth(color) {
var rte = currentRTE;
var oRTE = document.getElementById(currentRTE);
locateCursor();
// alert("Text:"+InnerHtmlText+" Pos:"+InnerHtmlTextCursorPos);
if (document.all) {
oRTE = frames[rte];
//get current selected range
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
//get currently selected range
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
var parentCommand = parent.command;
oRTE.focus();
// The two standard variables used are:
// InnerHtmlText - Contains the HTML text
// InnerHtmlTextCursorPos - contains the position of the cursor within the HTML text.
// alert("SetCellColour:"+color);
var mStrPtr=InnerHtmlTextCursorPos;
// Get an upper-case version of the HTML text used for searching.
var InnerHtmlTextUpper = InnerHtmlText.toUpperCase();
// Find the cell definition
while ( InnerHtmlTextUpper.substr(mStrPtr,3) != "
=0 )
{
// Hunting for a cell definition
mStrPtr = mStrPtr-1;
}
// Now we've got the location of the cell definition - find the end of the TD
var mStrPtr2=InnerHtmlText.indexOf(">",mStrPtr);
// Get the before and after parts of the cell definition.
var ResultStrStart=InnerHtmlText.substr(0,mStrPtr);
var TDLength=mStrPtr2-mStrPtr+1;
var TDString=InnerHtmlText.substr(mStrPtr,TDLength);
var ResultStrEnd=InnerHtmlText.substr(mStrPtr+TDLength,InnerHtmlText.length);
// Got the cell definition
TDString=TDString.toUpperCase();
// alert(TDString);
// Before we add the width, we need to see if one already exists,
// if so, we need to remove it...
// We assume the following.
// IE: ...bgColor=#123456
// Moz: ...bgColor="#123456"
var WidthFound=TDString.indexOf("WIDTH");
if (WidthFound > -1)
{
// alert("Width found at:"+WidthFound);
// what we need to do now, is remove the WIDTH element, we know the start
// now find the end (bounded by ' ' or '>'
// Get the text before the WIDTH
var TDString2=TDString.substr(0,WidthFound-1);
var BGEND1 = TDString.indexOf(">",WidthFound);
var BGEND2 = TDString.indexOf(" ",WidthFound);
// Get whichever is first...
if (BGEND1 >=0 && BGEND2 >=0)
{
if (BGEND1 > BGEND2 )
{
var BGEND=BGEND2;
}
else
{
var BGEND=BGEND1;
}
}
else
{
if (BGEND1 >=0 )
{
var BGEND=BGEND1;
}
else
{
var BGEND=BGEND2;
}
}
TDString2=TDString2+TDString.substr(BGEND,TDString.length);
}
else
{
var TDString2=TDString;
}
// take off the trailing '>' and add on the new width value.
TDString2=TDString2.substr(0,TDString2.length-1)+' width="'+color+'">';
// alert("TDString2:"+TDString2);
var ReplaceHtml = ResultStrStart +TDString2+ResultStrEnd;
oRTE.document.body.innerHTML=ReplaceHtml;
oRTE.focus();
RemoveCursorMarker();
document.getElementById('tabp3' + rte).style.visibility = "hidden";
document.getElementById('tabp3' + rte).style.display = "none";
}
//Function to add image
function AddImage(rte) {
var oRTE;
if (document.all) {
oRTE = frames[rte];
//get current selected range
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
//get currently selected range
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
imagePath = prompt('Enter Image URL:', 'http://');
if ((imagePath != null) && (imagePath != "")) {
oRTE.focus();
oRTE.document.execCommand('InsertImage', false, imagePath);
oRTE.focus();
}
}
//function to perform spell check
function checkspell() {
try {
var tmpis = new ActiveXObject("ieSpell.ieSpellExtension");
tmpis.CheckAllLinkedDocuments(document);
}
catch(exception) {
if(exception.number==-2146827859) {
if (confirm("ieSpell not detected. Click Ok to go to download page."))
window.open("http://www.iespell.com/download.php","DownLoad");
} else {
alert("Error Loading ieSpell: Exception " + exception.number);
}
}
}
// Ernst de Moor: Fix the amount of digging parents up, in case the RTE editor itself is displayed in a div.
function getOffsetTop(elm, parents_up) {
var mOffsetTop = elm.offsetTop;
var mOffsetParent = elm.offsetParent;
if(!parents_up) {
parents_up = 10000; // arbitrary big number
}
while(parents_up>0 && mOffsetParent) {
mOffsetTop += mOffsetParent.offsetTop;
mOffsetParent = mOffsetParent.offsetParent;
parents_up--;
}
return mOffsetTop;
}
// Ernst de Moor: Fix the amount of digging parents up, in case the RTE editor itself is displayed in a div.
function getOffsetLeft(elm, parents_up) {
var mOffsetLeft = elm.offsetLeft;
var mOffsetParent = elm.offsetParent;
if(!parents_up) {
parents_up = 10000; // arbitrary big number
}
while(parents_up>0 && mOffsetParent) {
mOffsetLeft += mOffsetParent.offsetLeft;
mOffsetParent = mOffsetParent.offsetParent;
parents_up--;
}
return mOffsetLeft;
}
function Select(rte, selectname) {
var oRTE;
if (document.all) {
oRTE = frames[rte];
//get current selected range
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
//get currently selected range
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
var idx = document.getElementById(selectname).selectedIndex;
// First one is always a label
if (idx != 0) {
var selected = document.getElementById(selectname).options[idx].value;
var cmd = selectname.replace('_' + rte, '');
oRTE.focus();
oRTE.document.execCommand(cmd, false, selected);
oRTE.focus();
document.getElementById(selectname).selectedIndex = 0;
}
}
function kb_handler(evt) {
var rte = evt.target.id;
//contributed by Anti Veeranna (thanks Anti!)
if (evt.ctrlKey) {
var key = String.fromCharCode(evt.charCode).toLowerCase();
var cmd = '';
switch (key) {
case 'b': cmd = "bold"; break;
case 'i': cmd = "italic"; break;
case 'u': cmd = "underline"; break;
};
if (cmd) {
FormatText(rte, cmd, true);
//evt.target.ownerDocument.execCommand(cmd, false, true);
// stop the event bubble
evt.preventDefault();
evt.stopPropagation();
}
}
}
function docChanged (evt) {
alert('changed');
}
function stripHTML(oldString) {
var newString = oldString.replace(/(<([^>]+)>)/ig,"");
//replace carriage returns and line feeds
newString = newString.replace(/\r\n/g," ");
newString = newString.replace(/\n/g," ");
newString = newString.replace(/\r/g," ");
//trim string
newString = trim(newString);
return newString;
}
function stripLineBreaks(oldString) {
var newString = oldString;
//replace carriage returns and line feeds
newString = newString.replace(/\r\n/g," ");
newString = newString.replace(/\n/g," ");
newString = newString.replace(/\r/g," ");
//trim string
newString = trim(newString);
return newString;
}
function trim(inputString) {
// Removes leading and trailing spaces from the passed string. Also removes
// consecutive spaces and replaces it with one space. If something besides
// a string is passed in (null, custom object, etc.) then return the input.
if (typeof inputString != "string") return inputString;
var retValue = inputString;
var ch = retValue.substring(0, 1);
while (ch == " ") { // Check for spaces at the beginning of the string
retValue = retValue.substring(1, retValue.length);
ch = retValue.substring(0, 1);
}
ch = retValue.substring(retValue.length-1, retValue.length);
while (ch == " ") { // Check for spaces at the end of the string
retValue = retValue.substring(0, retValue.length-1);
ch = retValue.substring(retValue.length-1, retValue.length);
}
// Note that there are two spaces in the string - look for multiple spaces within the string
//while (retValue.indexOf(" ") != -1) {
// Again, there are two spaces in each of the strings
// retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length);
//}
return retValue; // Return the trimmed string back to the user
}