/*<![CDATA[*/
/* Script copyright 2007 r wedge expandinghead.net */
// cursor setup
var mycursor = 0;
if (navigator.appCodeName == "bowser") { mycursor = 1; }
// JS Conversion
var ls="";
var dq='"';
var sq="'";
var rr="\r";
var fm = 0;
var se = 0;
var edit_area = edit_area= document.getElementById('area');
var frmOpen = '\n<'+'f'+'orm id="" name="" method="post" action="" enctype="multipart/form-data">';
function jsPars () {
ls=document.getElementById('area').value; 
if (ls=="") {
alert("No Data Found. The text area is empty.");
}
else {
htmlPar () ;
  }
}
function htmlPar () {
edit_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="<s"+"cript type="+qt+"text/javascript"+qt+">"+rr+"<\!"+"-- <!\[CDATA\["+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+"// --"+">\]\]>"+rr+"</sc"+"ript>";
edit_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] ; 
   } 
}
// XHTML Generator
fm = 0;
se = 0;
function star() {
 var opent = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml">\n<head>\n<title></title>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\n<style type="text/css">\n/*<!\[CDATA\[*/\nbody \{ background\: #FFFFFF\; color\: #000000\;\}\na\:link \{ color\: #FF0000\; \}\na\:visited \{ color\: #0000CC\; \}\na\:active \{ color\: #FFFF00\; \}\n/*\]\]>*/\n</style>\n</head>\n<b'+'ody>\n';
 if (mycursor == 0) { insertAtCursor(opent); }
 else { edit_area.value += opent; }
}
function end() {
edit_area.value += '\n</body>\n</html>\n';
}
function bgs() {
var objt = '<object type="" data="" id="firstObj" classid="" width="" height="">\n<param value="" />\n<param value="" />\n<param value="" />\n</object>';
 if (mycursor == 0) { insertAtCursor(objt); }
 else { edit_area.value += objt; }
}
function img() {
var imgt = '<img src="" width="" height="" border="0" alt="" />';
 if (mycursor == 0) { insertAtCursor(imgt); } 
 else { edit_area.value += imgt; }
}
function fnt() {
var divt =  '<d'+'iv id="" class="" style="">';
 if (mycursor == 0) { insertAtCursor(divt); }
 else { edit_area.value += divt; }
}
function cfnt() {
 if (mycursor == 0) { insertAtCursor('</d'+'iv>'); }
 else { edit_area.value += '</d'+'iv>'; }
}
function cen() {
spant = '<span id="" class="">';
 if (mycursor == 0) { insertAtCursor(spant); }
 else { edit_area.value += spant; }
}
function ecen() {
 if (mycursor == 0) { insertAtCursor('</span>'); }
 else { edit_area.value += '</span>'; }
}
function br() {
 if (mycursor == 0) { insertAtCursor('<'+'b'+'r />'); }
 else { edit_area.value += '<'+'b'+'r />'; }
}
function par() {
 if (mycursor == 0) { insertAtCursor('<p>'); }
 else { edit_area.value += '<p>'; }
}
function endpar() {
 if (mycursor == 0) { insertAtCursor('</p>'); }
 else { edit_area.value += '</p>'; }
}
function lnk() {
var linkt = '<a href="" title=""></a>';
 if (mycursor == 0) { insertAtCursor(linkt); }
 else { edit_area.value += linkt; }
}
function tbl() {
var tblt = '<table width="" border="0" cellspacing="0" cellpadding="0">\n<tbody>\n<tr valign="middle">\n<td align="left">';
 if (mycursor == 0) { insertAtCursor(tblt); }
 else { edit_area.value += tblt; }
}
function trc() {
 if (mycursor == 0) { insertAtCursor('\n</tr>'); }
 else { edit_area.value += '\n</tr>'; }
}
function tdc() {
 if (mycursor == 0) { insertAtCursor('\n</td>'); }
 else { edit_area.value += '\n</td>'; }
}
function tro() {
 if (mycursor == 0) { insertAtCursor('\n<tr valign="middle">'); }
 else { edit_area.value += '\n<tr valign="middle">'; }
}
function tdo() {
 if (mycursor == 0) { insertAtCursor('\n<td align="left">'); }
 else { edit_area.value += '\n<td align="left">'; }
}
function tblc()  {
 var ctblt = '\n</td>\n</tr>\n</tbody>\n</table>';
 if (mycursor == 0) { insertAtCursor(ctblt); }
 else { edit_area.value += ctblt; }
}
function frm() {
 if (fm == 0) {
    fm = 1;
    if (mycursor == 0) { insertAtCursor(frmOpen); }
    else { edit_area.value += frmOpen; }
   }
 else { if(confirm("You Must Close An Open Form Before You Begin a New One, Do You Wish to Close a Form")) {
    fm = 1;
    var cfrmt = '\n</form>'+frmOpen;
    if (mycursor == 0) { insertAtCursor(cfrmt); }
    else { edit_area.value += cfrmt; }
    }
   else {
    if (mycursor == 0) { insertAtCursor(frmOpen); }
    else { edit_area.value += frmOpen; }
    fm = 1;
    }
  }
}
function hidd() {
  if (fm == 1) {
 var inpt = '\n<input type="hidden" id="" name="" value="" />';
    if (mycursor == 0) { insertAtCursor(inpt); }
    else { edit_area.value += inpt; }
  }
   else {
if(confirm("You Must Open A Form to Use a Hidden Field, Do You Wish to Open One")) {
       fm = 1;
       var frmtt = '\n<'+'f'+'orm id="" method="post" action="" enctype="application/x-www-form-urlencoded">';
       if (mycursor == 0) { insertAtCursor(frmtt); }
       else { edit_area.value += frmtt; }
       hidd();
      }
 else {
       fm = 1;
       hidd();
     } 
   }
}
function tarea() {
  if (fm == 1) {
   var tareat = '\n<textarea id="" name="" cols="" rows=""></textarea>';
     if (mycursor == 0) { insertAtCursor(tareat);
    } else {
         edit_area.value += tareat;
    }
  } else {
  if(confirm("You Must Open A Form to Use a Text Area, Do You Wish to Open One")) {
      fm = 1;
      if (mycursor == 0) {
           insertAtCursor(frmOpen);
      } else {
           edit_area.value += frmOpen;
      }
      tarea();
      } else {
      fm = 1;
      tarea();
     }
  }
}
function but1() {
if (fm == 1) {
var ty = prompt("Enter Type : S for Submit\nR for Reset and B for Button","");
   if ((ty == 'S') || (ty == 's')) {
    var sb = '\n<input type="submit" id="" name="" value="Submit" />';
    if (mycursor == 0) {
         insertAtCursor(sb);
    } else {
          edit_area.value += sb; }
    }
    else if ((ty == 'R') || (ty == 'r')) {
      var frb = '\n<input type="reset" id="" name="" value="Reset" />';
        if (mycursor == 0) {
               insertAtCursor(frb);
        } else {
             edit_area.value += frb;
        }
    }
   else if ((ty == 'B') || (ty == 'b')) {
     var fbb = '\n<input type="button" id="" name="" value="" onclick="" />';
        if (mycursor == 0) { insertAtCursor(fbb);
        } else {
           edit_area.value += fbb;
        }
   } else { 
       var dbf = '\n<input type="submit" id="" name="" value="Submit" />';
         if (mycursor == 0) {
             insertAtCursor(dbf);
         } else {
              edit_area.value += dbf;
         }
    }
} else {
 if(confirm("You Must Open A Form to Use a Button, Do You Wish to Open One")) {
    if (mycursor == 0) {
          insertAtCursor(frmOpen);
    } else {
         edit_area.value += frmOpen;
    }
   fm = 1;
   but1();
    } else {
       fm = 1;
       but1();
    }
 }
}
function rad()  {
var radt = '\n<input type="radio" id="" name="" value="" onclick="" />';
   if (fm == 0) {
      if(confirm("You Must Open A Form to Use a Radio Button, Do You Wish to Open One")) {
      fm = 1;
         if (mycursor == 0) { insertAtCursor(frmOpen+radt); }
         else { edit_area.value += frmOpen + radt; } 
         }
      else {
         if (mycursor == 0) { insertAtCursor(radt); }
         else { edit_area.value += radt; }
         fm = 1;
         }
      }
  else {
      if (mycursor == 0) { insertAtCursor(radt); }
      else { edit_area.value += radt; }
  }
}
function tfeld()  {
if (fm == 1) {
var tfdt = '\n<input type="text" id="" name="" value="" size="" maxlength="300" />';
  if (mycursor == 0) { insertAtCursor(tfdt); }
  else { edit_area.value += tfdt; }
 }
else {
 if(confirm("You Must Open A Form to Use a Text Field, Do You Wish to Open One")) {
       fm = 1;
       if (mycursor == 0) { insertAtCursor(frmOpen); }
       else { edit_area.value += frmOpen; }
       tfeld();
     }
 else {
       fm = 1;
       tfeld();
    }
  }
} 
function ck()  {
   if (fm == 1) {
  var ckt = '\n<input type="checkbox" id="" name="" value="" onclick="" />';
    if (mycursor == 0) { insertAtCursor(ckt); }
    else { edit_area.value += ckt; }
 }
else {
if(confirm("You Must Open A Form to Use a Check Box, Do You Wish to Open One")) {
       fm = 1;
       if (mycursor == 0) { insertAtCursor(frmOpen); }
       else { edit_area.value += frmOpen; }
       ck();
     }
 else {
       fm = 1;
       ck();
    }
  }
}
var selt = '\n<select id="" name="" size="1" onchange="location.href=\(this.options[this.selectedIndex].value\)">';
function sel() {
 if (fm == 0) {
   if(confirm("You Must Open A Form to Use Select, Do You Wish to Open One")) {
    if (mycursor == 0) { insertAtCursor(frmOpen+selt); }
    else { edit_area.value += frmOpen+selt; }
    se = 1;
    fm = 1;
   }
   else {
    if (mycursor == 0) { insertAtCursor(selt); }
    else { edit_area.value += selt; }
    se = 1;
    fm = 1;
   }
  }
else if (se == 1) {
  if(confirm("You Must Close the Current Select Menu Before Opening Another, Do You Wish to Close One")) {
    if (mycursor == 0) { insertAtCursor('\n</select>\n'+selt); }
    else { edit_area.value += '\n</select>\n'+selt; }
   }
  else {
    if (mycursor == 0) { insertAtCursor(selt); }
    else { edit_area.value += selt; }
   }     
 }
 else {
  if (mycursor == 0) { insertAtCursor(selt); }
  else { edit_area.value += selt; }
  se = 1;
  }
}
function opt() {
  if (se == 1) {
 var optt = '\n<option id="" name="" value=""></option>';
   if (mycursor == 0) { insertAtCursor(optt); }
   else { edit_area.value += optt; } 
 }
else {
 if(confirm("You Must Open A Form and Select Menu, Do You Wish to Open Them")) {
     fm = 1;
     se = 1;
     var optfrm = frmOpen+selt;
       if (mycursor == 0) { insertAtCursor(optfrm);
       } else {
          edit_area.value += optfrm;
       }
     opt();
  } else {
      fm = 1;
      se = 1;
      opt();
   }
 }
}
function endsel() {
  if (se == 1) {
    if (mycursor == 0) { insertAtCursor('</select>'); }
    else { edit_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")) {
 var selm = '\n'+selt+'\n<option value=""></option>\n</select>';
       if (mycursor == 0) { insertAtCursor(selm); }
       else { edit_area.value += selm; } 
     }
 else {
       if (mycursor == 0) { insertAtCursor('</select>'); }
       else { edit_area.value += '</select>'; }
       se = 0;
    }
   }
   else  {
if(confirm("You Must Open A Form, Select Menu, and Option, Do You Wish to Open Them")) {
       fm = 1;
  var frmsel = '\n'+frmOpen+'\n<select id="" name="" size="1" onchange="location.href=(this.options[this.selectedIndex].value)">\n<option value=""></option>\n</select>';
      if (mycursor == 0) { insertAtCursor(frmsel); }
      else { edit_area.value += frmsel; }
     }
    else {
       fm = 1;
       se = 1;
       endsel();
     }
   }
}
function endForm() {
  if (fm == 1) {
      if (se == 1) {
        if (confirm("Did you forget a closing Select tag?\nDo You Wish to Close One")) {
       se = 0;
       fm = 0;
       if (mycursor == 0) { insertAtCursor('</select>\n</form>'); }
       else { edit_area.value += '</select>\n</form>'; }
       }
      }
      else {
       if (mycursor == 0) { insertAtCursor('\n</form>'); }
       else { edit_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(frmOpen); }
      else { edit_area.value += frmOpen; }
      fm = 1;
      }
     else {
      fm = 1;
      endForm();
      }
   }
}
function Jstart() {
 var sjs = '<s'+'cript type="text/javascript">\n/*<!\[CDATA\[*/\n';
   if (mycursor == 0) { insertAtCursor(sjs); }
   else { edit_area.value += sjs; }
}
function Jend() {
 var ejs = '\n/*\]\]>*/\n</'+'script>';
 if (mycursor == 0) { insertAtCursor(ejs); }
 else { edit_area.value += ejs; }
}
function ehCook()  {
edit_area.focus();
edit_area.select();
}
// Begin Clock 
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();
}
// Begin View Results 
function preview() {
var look = edit_area.value;
if (look == "") { 
alert ('No data found. The text area is empty.')
return false;
 }
else  {
if (wteev==2) {
location.href='#tb';
document.open();
document.write(look);
document.close(); } 
else {
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();
  }
 }
}
// Clear Form
function Clr() {
if (confirm('Do you REALLY want to CLEAR the Workarea?')) {
edit_area.value="\n\n";
edit_area.value="";
document.getElementById('area2').value="";
document.editor.leng.value="";
document.editor.ExpDate.value="";
fm = 0;
se = 0;
  }
}
// Clear Status Bar
function Ch() {
window.status='';
return true;
}
// Sort 
function AbcSort()  {
quant = edit_area.value.toString();
div_quant = quant.split(' ');
exhdst = div_quant.sort();
squa = exhdst.length;
edit_area.value = '';
for (i=0; i<squa; i++)  {
    edit_area.value += exhdst[i]+' ';
   }
}
// Email
function myMail() {
if ( edit_area.value == '') {
alert("You Must Have Data In the Text Area Before You Can Use Mail");
return false;
}
else {
to = prompt("To:","");
 if (to == '') {
    alert("Ending Mail");
    return false;
    }
 else {
    sub = "Expanding Head Editor Five";
    document.editor.action="mailto:"+to+"?no_signature=true&subject="+sub+"";
    document.editor.submit();
    }
  }
}
// Maginify Text 
magstate = 0;
function Mag() {
if (magstate < 1) {
  if (wteev==2) edit_area.fontsize='5';
  else { document.getElementById('area').style.fontSize='16pt';
         document.getElementById('area').style.height='65%'; }
  magstate = 1;
 }
else {
  if (wteev==2) edit_area.fontsize='3';
  else { document.getElementById('area').style.fontSize='10pt';
         document.getElementById('area').style.height='70%'; }
  magstate = 0;
 }
}
// Case Conversion
function lower() {
edit_area.value = edit_area.value.toLowerCase();
}
function caps() {
edit_area.value = edit_area.value.toUpperCase();
}
function DoA() {
edit_area.value = escape(edit_area.value);
}
function UnA() {
edit_area.value = unescape(edit_area.value);
}
// Search and Replace
// 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 = edit_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);
  }
edit_area.value = resultIs;
}
// Character Count
function myF() {
setTimeout('Cnt()', 1000);
}
function Cnt() {
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 = edit_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) {
var found = false;
if ((!txt) || (txt == '\r')) {
 alert("The Line Number"+line_number+" is Blank\nEnter Another Line Number");
 return;
}
  if (navigator.appName == 'Netscape') {
    if (!window.find(txt))
      while(window.find(txt, false, true))
        pos = 1;
    else
        pos = 1;
  }
  else    {
        var text = edit_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
    edit_area.focus();
    ssel = document.selection.createRange();
    ssel.text = myValue;
  }   // MOZILLA/NETSCAPE support
    else if (edit_area.selectionStart || edit_area.selectionStart == 0) {
    var startPos = edit_area.selectionStart;
    var endPos = edit_area.selectionEnd;
    edit_area.value = edit_area.value.substring(0, startPos) + myValue + edit_area.value.substring(endPos,edit_area.value.length);
  }
  else {
    edit_area.value += myValue;
  }
myValue='';
}
/*]]>*/
