//Remove Lines of Text Containing... (Javascript) is Copyright 2008 My-i-p.com

function expand(){
var hgt = document.form_rli.input_output.rows;
hgt = hgt + 5;
document.form_rli.input_output.rows = hgt;}
function contract(){
var hgt = document.form_rli.input_output.rows;
hgt = hgt - 5;
document.form_rli.input_output.rows = hgt;}

function cleartext(){
document.form_rli.input_output.value = '';}

function remcon(){
var text = document.form_rli.input_output.value;
var remstr = document.form_rli.to_remove.value;
var addstr = document.form_rli.to_add.value;
var count = 0;
if (addstr.length > 0) addstr = addstr + '\n'; else addstr = '';
if (addstr.length > 0) counttype = ' lines were replaced.'; else counttype = ' lines were removed.';
var textout = new Array();
text = text.replace(/\r/g,'');
text = text.split('\n');
if (remstr.length == '0') remstr = '___EMPTY_INPUT___';
for (var x = 0; x < text.length; x++){
if (document.form_rli.case_sen.checked == false) if (text[x].toLowerCase().indexOf(remstr.toLowerCase()) == -1) textout[x] = text[x]; else {textout[x] = addstr + "___ARRAY_REMOVED___"; count++;}
if (document.form_rli.case_sen.checked == true) if (text[x].indexOf(remstr) == -1) textout[x] = text[x]; else {textout[x] = addstr + "___ARRAY_REMOVED___"; count++;}}
textout = textout.join('\n');
textout = textout.replace(/___ARRAY_REMOVED___\n/g,'');
textout = textout.replace(/\n___ARRAY_REMOVED___/g,'');
textout = textout.replace(/___ARRAY_REMOVED___/g,'');
document.form_rli.input_output.value = textout;
document.getElementById('removed').innerHTML = count + counttype;}

function remncon(){
var text = document.form_rli.input_output.value;
var remstr = document.form_rli.to_remove.value;
var addstr = document.form_rli.to_add.value;
var count = 0;
if (addstr.length > 0) addstr = addstr + '\n'; else addstr = '';
if (addstr.length > 0) counttype = ' lines were replaced.'; else counttype = ' lines were removed.';
var textout = new Array();
text = text.replace(/\r/g,'');
text = text.split('\n');
if (remstr.length == '0') remstr = '___EMPTY_INPUT___';
for (var x = 0; x < text.length; x++){
if (document.form_rli.case_sen.checked == false) if (text[x].toLowerCase().indexOf(remstr.toLowerCase()) != -1) textout[x] = text[x]; else {textout[x] = addstr + "___ARRAY_REMOVED___"; count++;}
if (document.form_rli.case_sen.checked == true) if (text[x].indexOf(remstr) != -1) textout[x] = text[x]; else {textout[x] = addstr + "___ARRAY_REMOVED___"; count++;}}
textout = textout.join('\n');
textout = textout.replace(/___ARRAY_REMOVED___\n/g,'');
textout = textout.replace(/\n___ARRAY_REMOVED___/g,'');
textout = textout.replace(/___ARRAY_REMOVED___/g,'');
count2 = textout.split('\n').length;
document.form_rli.input_output.value = textout;
document.getElementById('removed').innerHTML = count + counttype;}

function SelectAll(id) {
document.getElementById(id).focus();
document.getElementById(id).select();}
