<!-- /*<![CDATA[*/
mycursor = 0;
var ls="";
var dq='"';
var sq="'";
var rr="\r";
function jsPars () {
ls=document.editor.area.value; 
if (ls=="") {
alert("I'm sorry.  I don't find any text pasted into the text window");
}
else {
htmlPar () ;
  }
}
function htmlPar () {
document.editor.area.value="Working......." ;
pos=ls.indexOf (dq) ;
pos1=ls.indexOf (sq) ;
if ((pos>-1)&&(pos1>-1)) {
reWrt () ;
}
if (pos>-1) {
qt=sq;  
}
else {
qt=dq;  
}
while (ls.indexOf (rr)>-1) {
lc=ls.indexOf (rr) ;
ls=ls.substring (0,lc)+""+ls.substring (lc+1,ls.length) ;  
}
nls="<SCRIPT LANGUAGE="+qt+"JavaScript"+qt+">"+rr+"<!-- Hide from JavaScript-Impaired Browsers"+rr+"document.write("+qt+ls.substring(0,36)+qt;
ls=ls.substring (36,ls.length);
lsl=ls.length;
pp=50;
if (pp>lsl) {
pp=lsl ;
}
while (lsl>0) {
nls+="\r+"+qt+ls.substring(0,pp)+qt;
ls=ls.substring(pp,lsl);
lsl=ls.length;
if (pp>lsl) {
pp=lsl ;
  }
}
nls+=");"+rr+"// End Hiding -->"+rr+"</SC"+"RIPT>";
document.editor.area.value=nls+rr+"<!-- Size:"+nls.length+" bytes --> "+rr;
}
function reWrt () {
pos=-1 ;
while (ls.indexOf (dq)>-1) {
lc=ls.indexOf (dq) ;
ls=ls.substring (0,lc)+sq+ls.substring(lc+1,ls.length);
  }
}
function iA(){
this.length=iA.arguments.length ; 
for (var i=0;ithis.length;i++)  {  
this[i]=iA.arguments[i] ; 
   } 
}
fm = 0;
se = 0;
otb = 0; // open table
ctd = 0;
otbr = 0;
ctb = 0; // close table
function star()   {
document.editor.area.value += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n<html>\n<head>\n<title></title>\n<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\n<style type="text/css">\nbody \{ background\: white\; color\: black\;\}\na\:link \{ color\: red\; \}\na\:visited \{ color\: maroon\; \}\na\:active \{ color\: fuchsia\; \}\n</style>\n</head>\n<'+'b'+'ody>\n';
}
function end()     {
document.editor.area.value += '\n</body>\n</html>\n';
}
function bgs()     {
emb = '<embed src="" name="firstsound" hidden="true" autostart="true" loop="-1">';
 if (mycursor == 0) { insertAtCursor(emb); } 
 else { document.editor.area.value += emb; }
}
function img()     {
im = '<img src="" width="" height="" border="0" alt="">';
 if (mycursor == 0) { insertAtCursor(im); }
 else { document.editor.area.value += im; }
 }
function fnt()     {
 fnt = '<font color="" size="">';
 if (mycursor == 0) { insertAtCursor(fnt); }
 else { document.editor.area.value += fnt; }
}
function cfnt()     {
 if (mycursor == 0) { insertAtCursor('</font>'); }
 else { document.editor.area.value += '</font>'; }
}
function cen()      {
 if (mycursor == 0) { insertAtCursor('<center>'); }
 else { document.editor.area.value += '<center>'; }
}
function ecen()      {
 if (mycursor == 0) { insertAtCursor('</center>'); }
 else { document.editor.area.value += '</center>'; }
}
function br()      {
 if (mycursor == 0) { insertAtCursor('<'+'b'+'r>'); }
 else { document.editor.area.value += '<'+'b'+'r>'; }
}
function par()      {
 if (mycursor == 0) { insertAtCursor('<p>'); }
 else { document.editor.area.value += '<p>'; }
}
function endpar() {
 if (mycursor == 0) { insertAtCursor('</p>'); }
 else { document.editor.area.value += '</p>'; }
}
function lnk()  {
var linkt = '<a href="" title=""></a>';
 if (mycursor == 0) { insertAtCursor(linkt); }
 else { document.editor.area.value += linkt; }
}
function tbl()  {
 tab = '<table bgColor="" width="" border="" cellspacing="0" cellpadding="0">\n<tr valign="middle">\n<td align="left">';
 if (mycursor == 0) { insertAtCursor(tab); }
 else { document.editor.area.value += tab; }
otb++;
}
function trc()  {
 if (otb != 0) {
 if (mycursor == 0) { insertAtCursor('\n</tr>'); }
 else { document.editor.area.value += '\n</tr>'; }
 }
 else {
  if(confirm("You Have Not Opened A Table In This Session, Do You Wish to Open One?")) {
       otb++;
       tbl();
     }
  else {
     otb++;
     trc();
    }
  }
}
function tdc()  {
  if (otb != 0) {
 if (mycursor == 0) { insertAtCursor('</td>\n'); }
 else { document.editor.area.value += '</td>\n'; }
  }
 else {
  if(confirm("You Have Not Opened A Table In This Session, Do You Wish to Open One?")) {
       otb++;
       tbl();
     }
  else {
       otb++;
       tdc();
     }
  }
}
function tro()  {
  if (otb != 0) {
 if (mycursor == 0) { insertAtCursor('\n<tr valign="middle">'); }
 else { document.editor.area.value += '\n<tr valign="middle">'; }
  }
 else {
  if(confirm("You Have Not Opened A Table In This Session, Do You Wish to Open One?")) {
       otb++;
       tbl();
     }
   else {
       otb++;
       tro();
     }
  }
}
function tdo()  { 
  if (otb != 0) {
 if (mycursor == 0) { insertAtCursor('\n<td align="left">'); }
 else { document.editor.area.value += '\n<td align="left">'; }
  }
 else {
  if(confirm("You Have Not Opened A Table In This Session, Do You Wish to Open One?")) {
       otb++;
       tbl();
     }
    else {
       otb++;
       tdo();
     }
  }
}
function tblc()  {
  if (otb != 0) {
 if (mycursor == 0) { insertAtCursor('\n</td>\n</tr>\n</table>'); }
 else { document.editor.area.value += '\n</td>\n</tr>\n</table>'; }
   otb--;
   ctb++;
 }
 else {
  if(confirm("You Have Not Opened A Table In This Session, Do You Wish to Open One?")) {
       otb++;
       tbl();
       tblc();
     }
   else {
       otb++;
       tblc();
     }
  }
}
frmt = '<form name="" method="post" action="" enctype="application/x-www-form-urlencoded">';
function frm()  {
 if (fm == 1) {
        alert("You Must Close An Open Form Before You Begin a New One");
     }
  else {
       fm = 1;
       if (mycursor == 0) { insertAtCursor(frmt); }
       else { document.editor.area.value += frmt; }
     }
}
function hidd() {
   impt = '\n<input type="hidden" name="" value="">';
  if (fm ==1) {
     if (mycursor == 0) { insertAtCursor(impt); }
     else { document.editor.area.value += impt; }
  }
   else {
if(confirm("You Have Not Opened A Form In This Session,  Do You Wish to Open One Before Adding The Hidden Input Field?")) {
       fm = 1;
       if (mycursor == 0) { insertAtCursor(frmt); }
       else { document.editor.area.value += frmt; }
       hidd();
      } 
else {
      fm = 1;
       hidd();
      }
   }
}
function tarea()  {
 tare = '\n<textarea name="" cols="" rows=""></textarea>';
  if (fm == 1) {
     if (mycursor == 0) { insertAtCursor(tare); }
     else { document.editor.area.value += tare; }
   }
  else {
    if (confirm("You Have Not Opened A Form In This Session, Do You Wish to Open One?")) {
       fm = 1;
       if (mycursor == 0) { insertAtCursor(frmt + tare); }
       else { document.editor.area.value += frmt + tare; }
      }
    else {
       fm = 1;
       tarea();
       }
   }
}
function but1()  {
  bsub = '\n<input type="submit" name="" value="Submit">';
  brset = '\n<input type="reset" name="" value="Reset">';
  bbut = '\n<input type="button" name="" value="" onClick="">';
if (fm == 1) {
var ty = prompt("Enter Type : S for Submit\nR for Reset and B for Button","");
   if (ty == 'S') {
     if (mycursor == 0) { insertAtCursor(bsub); }
     else { document.editor.area.value += bsub; }
     }
   else if ((ty == 'R') || (ty == 'r')) {
     if (mycursor == 0) { insertAtCursor(brset); }
     else { document.editor.area.value += brset; }
     }
   else if ((ty == 'B') || (ty == 'b')) {
   if (mycursor == 0) { insertAtCursor(bbut); }
   else { document.editor.area.value += bbut; }
     }
   else {
    if (mycursor == 0) { insertAtCursor(bsub); }
    else { document.editor.area.value += bsub; }
   }
 }
 else {
if(confirm("You Have Not Opened A Form In This Session, Do You Wish to Open One?")) {
      fm = 1;
      if (mycursor == 0) { insertAtCursor(frmt); }
      else { document.editor.area.value += frmt; }
       but1();
     }
    else {
        fm = 1;
        but1();
     }
  }
}
function rad()  {
 radb = '\n<input type="radio" name="" onClick="">';
  if (fm == 1) {
  if (mycursor == 0) { insertAtCursor(radb); }
  else { document.editor.area.value += radb; }
 }
else {
if(confirm("You Have Not Opened A Form In This Session, Do You Wish to Open One?")) {
       fm = 1;
       document.editor.area.value += frmt;
       rad();
     }
     else {
       fm = 1;
       rad();
     }
  }
} 
function tfeld()  {
 tfld = '<input type="text" name="" value="" size="">\n';
if (fm == 1) {
  if (mycursor == 0) { insertAtCursor(tfld); }
  else { document.editor.area.value += tfld; }
 }
else {
if(confirm("You Have Not Opened A Form In This Session, Do You Wish to Open One?")) {
       fm = 1;
     if (mycursor == 0) { insertAtCursor(frmt); }
     else { document.editor.area.value += frmt; }
       tfeld();
     }
    else {
       fm = 1;
       tfeld();
     }
  }
} 
function ck()  {
  cbx = '<input type="checkbox" value="" name="" onClick="">\n';
   if (fm == 1) {
     if (mycursor == 0) { insertAtCursor(cbx); }
     else { document.editor.area.value += cbx; }
 }
else {
if(confirm("You Have Not Opened A Form In This Session, Do You Wish to Open One?")) {
       fm = 1;
       if (mycursor == 0) { insertAtCursor(frmt); }
       else { document.editor.area.value += frmt; }
       ck();
     }
   else {
       fm = 1;
       ck();
     }
  }
}
function sel() {
 selm = '<select name="jump" size="1" onChange="location.href=(this.options[this.selectedIndex].value)">\n';
  if (se == 1) {
alert("You Must Close the Current Select Menu Before Opening Another");
  }
 else if (fm == 1) {
  if (mycursor == 0) { insertAtCursor(selm); }
  else { document.editor.area.value += selm; }
se = 1;
 }
 else {
if(confirm("You Must Open A Form to Use Select, Do You Wish to Open One")) {
       document.editor.area.value += frmt;
       fm = 1;
       sel();
     }
   else {
       fm = 1;
       se = 0;
       sel();
      }
  }
}
function opt() {
 optm = '<option value=""></option>\n';
  if (se == 1) {
   if (mycursor == 0) { insertAtCursor(optm); }
   else { document.editor.area.value += optm; }
 }
else {
if(confirm("You Must Open A Form and Select Menu, Do You Wish to Open Them")) {
       fm = 1;
       se = 1;
     if (mycursor == 0) { insertAtCursor(frmt + selm); }
     else { document.editor.area.value += frmt + selm; }
       opt();
     }
    else {
       fm = 1;
       se = 1;
       opt();
     }
   }
}
function endsel() {
  if (se == 1) {
     if (mycursor == 0) { insertAtCursor('</select>'); }
     else { document.editor.area.value += '</select>'; }
      se = 0;
    }
   else if (fm == 1) {
if(confirm("You Must Open A Select Menu and Option, Do You Wish to Open Them")) {
       if (mycursor == 0) { insertAtCursor(selm + optm + '</select>'); }
       else { document.editor.area.value += selm + optm + '</select>'; }
     }
   }
   else  {
if(confirm("You Must Open A Form, Select Menu, and Option, Do You Wish to Open Them")) {
      if (mycursor == 0) { insertAtCursor(frmt + selm + optm + '</select>'); }
      else { document.editor.area.value += frmt + selm + optm + '</select>'; }
     }
   else {
      if (mycursor == 0) { insertAtCursor('</select>'); }
      else { document.editor.area.value += '</select>'; }
      se = 0;
      }
   }
}
function endForm() {
  if (fm == 1) {
     if (mycursor == 0) { insertAtCursor('\n</form>'); }
     else { document.editor.area.value += '\n</form>'; }
      fm = 0;
    }
  else {
     if (confirm("You Must Begin a Form Before You Can End a Form, Do You Wish to Begin One")) {
      if (mycursor == 0) { insertAtCursor(frmt); }
      else { document.editor.area.value += frmt; }
      fm = 1;
      endForm();
      }
    else {
      fm = 1;
      endForm();
     }
  }
}
function Jstart() {
document.editor.area.value += '\n<script type="text/javascript">\n<'+'!--\n';
}
function Jend() {
document.editor.area.value += '\n// --'+'>\n</'+'script>\n';
}
function ehCook()  {
document.editor.area.focus();
document.editor.area.select();
}
var timerID = null;
var timerRunning = false;
function stopclock ()  {
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var timeValue = "" + ((hours >12) ? hours -12 :hours)
if (timeValue == "0") timeValue = 12;
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " P.M." : " A.M."
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true;
}
function startclock() {
stopclock();
showtime();
}
function preview() { 
look = document.editor.area.value;
if (look == "") { 
alert ('The test area is empty. Please enter a script')
return false;
}
else  {
if ( navigator.appCodeName == "bowser" ) { WebTV(); }
else { Comp(); }
    }
}
function WebTV() {
location.href='#tb';
document.open();
document.write(look);
document.close();
}
function Comp() {
preWindow=open("","preWindow","status=yes,toolbar=no,menubar=yes,resizable=yes,scrollbars=yes");
preWindow.document.open();
preWindow.document.write(look);
preWindow.document.close();
preWindow.focus();
}
function Clr() {
if (confirm('Do you REALLY want to CLEAR the Workarea?')) {
document.editor.area.value="\n\n";
document.editor.area.value="";
document.editor.area2.value="";
document.editor.leng.value="";
document.editor.ExpDate.value="";
fm = 0;
se = 0;
otb = 0;
ctb = 0;
  }
}
function Ch() {
window.status='';
return true;
}
function AbcSort()  {
quant = document.editor.area.value.toString();
div_quant = quant.split(' ');
exhdst = div_quant.sort();
squa = exhdst.length;
document.editor.area.value = '';
  for (i=0; i<squa; i++)  {
        document.editor.area.value += exhdst[i]+' ';  }
}
function myMail() {
if ( document.editor.area.value == '') {
alert("You Must Have Some Data In the Text Area to Use Mail");
}
else {
to = prompt("To : ","");
if ((to == 'null') || (to == '') || (to == 'undef')) {
alert("Ending Mail");
    }
else {
sub = "Expanding Head Editor 1";
document.editor.action="mailto:"+to+"?no_signature=true&subject="+sub+"";
document.editor.submit();
    }
 return false;
  }
}
// Maginify Text 
magstate = 0;
wteev = (navigator.appCodeName == 'bowser') ? 2:1;
function Mag() {
if (magstate < 1) {
  if (wteev==2) document.editor.area.fontsize='5';
  else { document.getElementById('area').style.fontSize='16pt';
         document.getElementById('area').style.height='65%'; }
  magstate = 1;
 }
else {
  if (wteev==2) document.editor.area.fontsize='3';
  else { document.getElementById('area').style.fontSize='10pt';
         document.getElementById('area').style.height='70%'; }
  magstate = 0;
 }
}
function lower() {
document.editor.area.value = document.editor.area.value.toLowerCase();
}
function caps() {
document.editor.area.value = document.editor.area.value.toUpperCase();
}
function DoA() {
document.editor.area.value = escape(document.editor.area.value);
}
function UnA() {
document.editor.area.value = unescape(document.editor.area.value);
}
// Mr Speedy July 2001 http://js.junerin.net
/*A note of thanks to the people from the comp.lang.javascript newsgroup Gaylen http://home.earthlink.net/~gfraley5/
for: .split method, debugging specialChar function
Matt Burland <mcbst34+@pitt.edu>
  for: for loop in specialChar function
*/
//array of special chars
xspecialChar = new Array('[',']','(',')','*')
function specialChar(charIs){
//checks if a char needs a backslash \ before it
//this for loop with the help of Matt Burland
// <mcbst34+@pitt.edu> 
 for (var i=0; i<xspecialChar.length;i++) {
      if(charIs==xspecialChar[i]) {
      return true;
      }
    }
return false;
}
function replace(form){
var look4 = document.editor.lookfor.value;
var newLookFor = "";
var origText = document.editor.area.value;
var replaceWith = document.editor.replacewith.value;
var delim = (document.editor.caseSens.checked) ? "/g" : "/gi";
var resultIs = "";
   for (var i=0;i<look4.length;i++) {
     var speChar = specialChar(look4.charAt(i))
         var charToReplace = look4.charAt(i)
         if(speChar){
         newLookFor += "\\" + charToReplace
         }else{
         newLookFor += charToReplace
         }
   }
var myString = new String(newLookFor);
var mySeparator = ',';
var arrayName = myString.split(mySeparator);
for (var i=0;i<arrayName.length;i++) {
   if(i==0)
  resultIs = origText.replace(eval("/"+arrayName[i]+delim), replaceWith);
  if(i!==0)
  resultIs = resultIs.replace(eval("/"+arrayName[i]+delim), replaceWith);
  }
document.editor.area.value = resultIs;
}
function myF() {
setTimeout('Cnt()', 1000);
}
function myFind() {
window.status=document.show.results.value.length;
}
function win(fileName,width,height) {
     myFloater = window.open('','myWindow','scrollbars=no,status=no,width='+width+',height='+height)
     myFloater.location.href = fileName;
}
function myFind() {
line_number = prompt('Enter Line Number You Wish To View','');
if (line_number == '') {
    alert('Line Number Was Not Entered');
    return;
}
in_text = document.editor.area.value;
my_data = in_text.split("\n");
total_lines = my_data.length;
if (line_number > total_lines) {
 alert('Total Lines\: '+total_lines+'\n\n'+line_number+' exceeds this value');
 return false;
 }
else {
 alert('Total Lines\: '+total_lines+'\n \n Line '+line_number+': '+my_data[line_number-1]);
 // if (navigator.appName != 'Netscape') {
 my_line= my_data[line_number-1];
 GoTo(my_line);
 // }
 }
}
var pos = 0;
function GoTo(txt) {
if ((!txt) || (txt == '\r')) {
 alert("The Line Number"+line_number+" is Blank\nEnter Another Line Number");
 return;
}
var found = false;
  if (navigator.appName == 'Netscape') {
    if (!window.find(txt))
      while(window.find(txt, false, true))
        pos=1;
    else
        pos=1;
  }
  else    {
        var text = document.editor.area.createTextRange();
        for (var i=0; i<=pos && (found=text.findText(txt)) != false; i++) {
            text.moveStart("character", 1);
            text.moveEnd("textedit");
        }
     }
        if (found) {
            text.moveStart("character", -1);
            text.findText(txt);
            text.select();
            text.scrollIntoView();
            // pos++;
            pos=0;
        }
        else {
            if (pos == '0') alert('"' + txt +'" was not found on this page.');
            pos=0;
        }
    }
function insertAtCursor(myValue) {
  if (document.selection) { // IE support
    document.editor.area.focus();
    ssel = document.selection.createRange();
    ssel.text = myValue;
  }                         // MOZILLA/NETSCAPE support
    else if (document.editor.area.selectionStart || document.editor.area.selectionStart == 0) {
    var startPos = document.editor.area.selectionStart;
    var endPos = document.editor.area.selectionEnd;
    document.editor.area.value = document.editor.area.value.substring(0, startPos) + myValue + document.editor.area.value.substring(endPos,document.editor.area.value.length);
  }
  else {
    document.editor.area.value += myValue;
  }
myValue='';
}
/*]]>*/
// -->
