<?php
/**
 * @package Rjmprogramming_Multi_Lookup
 * @version 1.6
 */
/*
Plugin Name: Rjmprogramming Multi Lookup
Description: Float various lookup button links to Wikipedia, Google, Free Dictionary for highlighted text of a blog webpage.
Author: Robert James Metcalfe
Version: 1.6
Author URI: http://www.rjmprogramming.com.au/
*/


// We need some Javascript to respond to highlights
function rjmprogramming_multi_js() {

	echo "<div id='phfloater'></div>
	
	<script type='text/javascript'>
var phight=' ';	
var cbackc='';
var cookcnt=0;
var cookblank=' ';
var zoharr=[];
var mpn='', eod='', aec='', withindiv=0;

function ecmore(insg) {
 ects='<table><tr><th><b>Selection Toggle of  ...</b></th><th><input type=button onclick=\"bold_all(this);\" value=\"Bold\"></input></th><th><input type=button onclick=\"bold_all(this);\" value=\"StrikeThrough\"></input></th><th><input type=button onclick=\"bold_all(this);\" value=\"SubScript\"></input></th><th><input type=button onclick=\"bold_all(this);\" value=\"SuperScript\"></input></th><th><input type=button onclick=\"bold_all(this);\" title=\"olive\" value=\"BackColor\"></input></th><th><input type=button onclick=\"bold_all(this);\" title=\"red\" value=\"ForeColor\"></input></th></tr><tr><th><input type=button onclick=\"bold_all(this);\" value=\"InsertHorizontalRule\"></input></th><th><input type=button onclick=\"bold_all(this);\" title=\"&#128292;\" value=\"InsertText\"></input></th><th><input type=button onclick=\"bold_all(this);\" title=\"32px\" value=\"FontSize\"></input></th><th><input type=button onclick=\"bold_all(this);\" title=\"Arial\" value=\"FontName\"></input></th><th><input type=button onclick=\"bold_all(this);\" value=\"InsertParagraph\"></input></th><th><input type=button onclick=\"bold_all(this);\" value=\"InsertLineBreak\"></input></th><th><input type=button onclick=\"bold_all(this);\" title=\"http://www.rjmprogramming.com.au\" value=\"CreateLink\"></input></th><th><input type=button style=\"background-color:orange;\" onclick=\"bold_all(this);\" title=\"Email this blog posting\" value=\"Ask Email\"></input></th></tr></table>';
 return insg + ects;
}

function bold_all(ibut) {
  if (ibut.value.replace(' ','').toLowerCase() == 'askemail') {
  dbihis='';
  var etois=prompt('Please enter email address to forward this blog ' + document.URL.split(':')[0] + ':' + document.getElementById('emailform').action + ' webpage to (and optionally comma separate an email from address for collaboration)', '');
  if (etois != null) {
    if (etois.indexOf('@') != -1) {
     var ees=etois.split(',');
     var xfbmore='';
     if (ees.length > 1) {
       xfbmore=\"<form style='background-color:#e0e0e0;border:5px solid orange;padding:12px 12px 12px 12px;' action=\" + document.URL.replace('http:','https:') + \" method=GET><span style=vertical-align:top;>Optional feedback to \" + ees[1] + \": </span><textarea style='width:500px;background-color:#f0f0f0;' rows=4 cols=50 maxlength=200 placeholder='Optional feedback to \" + ees[1] + \" ...' name=replyis value=''></textarea><br><input type=hidden value='\" + ees[1] + \"' name=replyto></input><input type=hidden value='\" + ees[0] + \"' name=replyfrom></input><input type=hidden value='\" + document.title + \"' name=replysubject></input><input type=hidden value='\" + document.URL + \"' name=replyurl></input> <input style=background-color:yellow; type=submit value='Email \" + ees[1] + \"'></input></form><br>\";
     }
     document.getElementById('emailform').action='//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php';
     document.getElementById('tdsubj').value=document.title; 
     document.getElementById('tdhuhta').value=preface('<body>' + String.fromHtmlEntities(xfbmore + document.body.innerHTML) + '</body>');
     document.getElementById('iinline').value=encodeURIComponent(document.getElementById('tdhuhta').value); 
     document.getElementById('tdto').value=ees[0];
     document.getElementById('fsubm').click(); 
    }
  }
  } else {
  document.designMode='on';
  document.execCommand(ibut.value.toLowerCase(),true,('' + ibut.title));
  }
}

function plfhlater() {
   var aswq=document.getElementsByTagName(\"a\");
   for (var iaswq=0; iaswq<aswq.length; iaswq++) {
     if (aswq[iaswq].innerHTML == 'Long hover help available.') {
       aswq[iaswq].innerHTML='Highlighting and long hover help.';
       aswq[iaswq].title+=' ... also note that Highlighting Webpage Contents allows for Wikipedia, Google Translate, Free Dictionary and Google Search functionalities to appear';
     }
   }
}

function cookiePutHVal(indv) {
    var expireDate = new Date();
    var opis='';
    expireDate.setMonth(expireDate.getMonth()+6);
    expireDate.setDate(expireDate.getDate()-1);
    if (indv == '') {
      cookcnt=0;
      cbackc='';
      document.cookie = 'linktoothers' + '=' + cbackc + ';expires=' + expireDate.toGMTString();
    } else {
    var pvalis=prompt('Enter absolute URL prefix#Title ... where two blank Title prefix replaces value blanks for - and one blank Title prefix replaces value blanks for +', '');
    if (pvalis == null) { pvalis=''; }
    if (pvalis.indexOf('//') != -1) {
          var otit='Other Link';
          if (pvalis.indexOf('#') != -1) {
            otit=pvalis.split('#')[eval(-1 + pvalis.split('#').length)].trim();
          }
          if (pvalis.split('#')[eval(-1 + pvalis.split('#').length)].indexOf('  ') == 0) {
            opis=phight.replace(/\ /g,' + \"'-'\" + ');
            document.getElementById('phfloater').innerHTML+='' + otit + ' <a style=\"inline-block;\" href=\"' + pvalis.replace('#' + pvalis.split('#')[eval(-1 + pvalis.split('#').length)],'').trim() + '\" title=\"' + pvalis.replace('#' + pvalis.split('#')[eval(-1 + pvalis.split('#').length)],'').trim() + '\" target=_blank onmouseover=\"this.href=this.title + hopis(String.fromCharCode(45));\" ontouchstart=\"this.href=this.title + hopis(String.fromCharCode(45));\" id=b_phfloater_' + cookcnt + '>' + phight + '</a><br>';
          } else if (pvalis.split('#')[eval(-1 + pvalis.split('#').length)].indexOf(' ') == 0) {
            opis=phight.replace(/\ /g,' + \"'+'\" + ');
            document.getElementById('phfloater').innerHTML+='' + otit + ' <a style=\"inline-block;\" href=\"' + pvalis.replace('#' + pvalis.split('#')[eval(-1 + pvalis.split('#').length)],'').trim() + '\" title=\"' + pvalis.replace('#' + pvalis.split('#')[eval(-1 + pvalis.split('#').length)],'').trim() + '\" target=_blank onmouseover=\"this.href=this.title + hopis(String.fromCharCode(43));\" ontouchstart=\"this.href=this.title + hopis(String.fromCharCode(43));\" id=b_phfloater_' + cookcnt + '>' + phight + '</a><br>';
          } else {
            document.getElementById('phfloater').innerHTML+='' + otit + ' <a style=\"inline-block;\" href=\"' + pvalis.replace('#' + pvalis.split('#')[eval(-1 + pvalis.split('#').length)],'').trim() + '\" title=\"' + pvalis.replace('#' + pvalis.split('#')[eval(-1 + pvalis.split('#').length)],'').trim() + '\" target=_blank onmouseover=\"this.href=this.title + encodeURIComponent(phight);\" ontouchstart=\"this.href=this.title + encodeURIComponent(phight);\" id=b_phfloater_' + cookcnt + '>' + phight + '</a><br>';         
          }
     if (cbackc != '') {
      document.cookie = 'linktoothers' + '=' + cbackc + '|' + encodeURIComponent(pvalis) + ';expires=' + expireDate.toGMTString();
     } else {
      cbackc=encodeURIComponent(pvalis);
      document.cookie = 'linktoothers' + '=' + encodeURIComponent(pvalis) + ';expires=' + expireDate.toGMTString();
     }
     cookcnt++;
    }
    }
}

function cookieHVal(cName) {
  if (document.cookie != '') {
   var tCookie=document.cookie.split('; ');
   for (var j=0; j<tCookie.length; j++) {
    if (cName == tCookie[j].split('=')[0]) {
      return decodeURIComponent(tCookie[j].split('=')[1]);
    }
   }
  }
  return '';
}

function hopis(inop) {
  return hight.replace(/\ /g, inop);
}

function emaileeis(inideais) {
  var presm='', postsm='';
  if (inideais.indexOf(':') != -1) {
    presm=inideais.split(':')[0] + ':';
    postsm=inideais.replace(presm,'');
  } else if (inideais.indexOf('?to=') != -1) {
    presm=inideais.split('?to=')[0] + '?to=';
    if (inideais.indexOf('&') != -1) {
    postsm=inideais.replace(presm,'').replace(inideais.split('?to=')[1].split('&')[0],'');
    } 
  } else if (inideais.indexOf('&') != -1) {
    presm=inideais.split('&')[0] + '&';
    postsm=inideais.replace(presm,'');
  } else {
    presm=inideais.split('?')[0];
    postsm=inideais.replace(presm,'');
  }
  if (eod == '') { 
    if (inideais.indexOf('?to=') != -1) {
      eod=inideais.split('?to=')[1].split('&')[0];
    }
    var pwithindiv=withindiv;
    withindiv=9000;
    eod=prompt('Enter email address', eod);  
    if (pwithindiv == 0) {
    withindiv=0.9999;
    } else {
    withindiv=pwithindiv;
    }
    if (eod == null) { 
      eod=''; 
    } 
  } 
  return presm + encodeURIComponent(eod) + postsm;
}  


function smsee(inideais) {
  var presm='', postsm='';
  if (inideais.indexOf(':') != -1) {
    presm=inideais.split(':')[0] + ':';
  }
  if (inideais.indexOf('&') != -1) {
    postsm='&' + inideais.split('&')[1];
  }
  if (mpn == '') { 
    if (inideais.indexOf(':') != -1) {
      mpn=inideais.split(':')[1].split('&')[0];
    }
    var pwithindiv=withindiv;
    withindiv=9000;
    mpn=prompt('Enter phone number for SMS (or Cancel to do it at the Messager app', mpn);  
    if (pwithindiv == 0) {
    withindiv=0.9999;
    } else {
    withindiv=pwithindiv;
    }
    if (mpn == null) { 
      mpn=''; 
    } 
  } 
  return presm + mpn + postsm;
}  


function iftoolongpost(prefixu, restsub, restu) {
  var prefixrest=prefixu.replace('&body=', encodeURIComponent(restsub) + '&body=') + restu;
  if ((prefixrest).length > 900) {
  // dynamic form
  var xhr = new XMLHttpRequest();
  var form=new FormData();
  form.append('to', decodeURIComponent(prefixrest.split('to=')[1].split('&')[0]));
  form.append('subject', decodeURIComponent(prefixrest.split('subject=')[1].split('&')[0]));
  form.append('body',  decodeURIComponent(prefixrest.split('body=')[1].split('&')[0]));  
  xhr.open('post', '//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php', true);
  xhr.send(form);  
  // end of dynamic form
  location.href='#phfloater';
  } else {
  document.getElementById('aeciframe').src=prefixrest;
  }
} 

function plookforhighlight() {
  var usualdelay=2000, oRange=null, oRect=null, s_top='0px', s_left='5px', opis='', fourhundred=300, isfx='0', otit='';
  if (phight == ' ') {
    setTimeout(plfhlater, 5000);
    phight='';
    cbackc=cookieHVal('linktoothers');
    if (cbackc != '') {
      zoharr=cbackc.split('|');
    }
  }
  if (('' + withindiv).indexOf('.') != -1) {
    setTimeout(plookforhighlight, eval(('' + withindiv).split('.')[1]));
    withindiv=eval(('' + withindiv).split('.')[0]);
    return;
  } else if (withindiv != 0) { 
    setTimeout(plookforhighlight, withindiv);
    return;  
  } else {
    setTimeout(plookforhighlight, usualdelay);
  }
  var xsel=window.getSelection().toString(); 
  if (xsel.length == 0) {
    try {
    xsel=document.selection.createRange().htmlText;
    xsel=xsel.replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ');
    xsel=xsel.replace(String.fromCharCode(13),' ').replace(String.fromCharCode(13),' ').replace(String.fromCharCode(13),' ').replace(String.fromCharCode(13),' ');
    } catch(ertw) {
    xsel='';
    }
  } else {
    xsel=xsel.replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ').replace(String.fromCharCode(10),' ');
    xsel=xsel.replace(String.fromCharCode(13),' ').replace(String.fromCharCode(13),' ').replace(String.fromCharCode(13),' ').replace(String.fromCharCode(13),' ');
    if (xsel != phight && xsel != '') {
     oRange = window.getSelection().getRangeAt(0); //get the text range
     oRect = oRange.getBoundingClientRect();
     s_top = ('' + oRect.top).replace('px','') + 'px';
     s_left = ('' + oRect.left).replace('px','') + 'px';
     if (s_top != '0px') { 
        fourhundred=eval('' + s_top.replace('px',''));
        s_top='0px';
        var dse='', dde='';
        if (document.scrollingElement) {
          if (document.scrollingElement.scrollTop) {
            dse=('' + document.scrollingElement.scrollTop);
          }
        }
        if (document.documentElement) {
          if (document.documentElement.scrollTop) {
            dde=('' + document.documentElement.scrollTop);
          }
        }
        if (dse != '') {
          fourhundred+=eval('' + dse.replace('px',''));
          isfx='0';
        } else if (dde != '') {
          fourhundred+=eval('' + dde.replace('px',''));
          isfx='0';
        } else if (('' + window.scrollY) != '') {
          fourhundred+=eval('' + ('' + window.scrollY).replace('px',''));
          isfx='0';
        } else if (('' + window.pageYOffset) != '') {
          fourhundred+=eval('' + ('' + window.pageYOffset).replace('px',''));
          isfx='0';
        } else {
          isfx=('' + document.body.scrollTop).replace('px','');
          if (isfx.replace('0','') == '') {
            isfx=('' + document.scrollingElement.scrollTop).replace('px','');
            if (isfx.replace('0','') == '') {
               isfx=('' + window.scrollY).replace('px','');
               if (isfx.replace('0','') == '') {
                  isfx=('' + window.pageYOffset).replace('px','');
               }
            }
          }
        }
        fourhundred+=120;
     }
    }
  }
  if (xsel != phight && xsel != '' && eval('' + xsel.length) <= 500) {
    phight=xsel;
    if (s_top == '0px') { s_top = ('' + eval(fourhundred + eval('' + isfx))) + 'px'; }
    if (aec == '') {
          aec='&nbsp;&#128231;&nbsp;<div id=daec contenteditable=true onblur=\"withindiv=0;\" onchange=\"withindiv=9000;\" onclick=\"withindiv=9000; event.stopPropagation();\">&nbsp;&nbsp;</div>';
    } else if (document.getElementById('daec') && document.getElementById('b_phfloater_annotated_email')) {
          aec=document.getElementById('b_phfloater_annotated_email').innerHTML;
    }
    if (aec.indexOf('<mark>' + phight + '</mark>') == -1) {
          if (('              ' + aec).slice(-14).substring(0,1).replace('?','.').replace('!','.') == '.') {
           aec=aec.replace('</div>', '&nbsp;&nbsp;&nbsp;<mark>' + phight + '</mark></div>');
          } else {
           aec=aec.replace('</div>', '&nbsp;<mark>' + phight + '</mark></div>');
          }
    }
    if (document.getElementById('phfloater')) {  
      if (document.getElementById('phfloater').innerHTML == '') {
        document.getElementById('phfloater').style.position='absolute';
        document.getElementById('phfloater').style.top=s_top;
        document.getElementById('phfloater').style.left=s_left;
        document.getElementById('phfloater').style.zIndex='85';
        document.getElementById('phfloater').style.backgroundColor='rgba(0,255,165,0.9)'; 
        document.getElementById('phfloater').style.border='1px solid purple'; 
        document.getElementById('phfloater').style.padding='2px 2px 2px 2px'; 
        document.getElementById('phfloater').style.display='block'; 
        document.getElementById('phfloater').innerHTML='<b>Wikipedia <a class=\"hlclass\" style=\"inline-block;\" href=\"//wikipedia.org/wiki/Main_Page\" title=\"//wikipedia.org/wiki/\" target=_blank onmouseover=\"this.href=this.title + phight.replace(/\ /g,' + \"'_'\" + ');\" ontouchstart=\"this.href=this.title + phight.replace(/\ /g,' + \"'_'\" + ');\" id=b_phfloater_wikipedia>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Google Translate <a class=\"hlclass\" style=\"inline-block;\" href=\"//translate.google.com\" title=\"//translate.google.com/#view=home&op=translate&sl=auto&tl=en&text=\" target=_blank onmouseover=\"this.href=this.title + encodeURIComponent(phight);\" ontouchstart=\"this.href=this.title + encodeURIComponent(phight);\" id=b_phfloater_google_translate>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Free Dictionary <a class=\"hlclass\" style=\"inline-block;\" href=\"//www.thefreedictionary.com/\" title=\"//www.thefreedictionary.com/\" target=_blank onmouseover=\"this.href=this.title + phight.replace(/\ /g,' + \"'+'\" + ');\" ontouchstart=\"this.href=this.title + phight.replace(/\ /g,' + \"'+'\" + ');\" id=b_phfloater_free_dictionary>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Google Search <a class=\"hlclass\" style=\"inline-block;\" href=\"//www.google.com/\" title=\"//www.google.com/search?q=\" target=_blank onmouseover=\"this.href=this.title + phight.replace(/\ /g,' + \"'+'\" + ');\" ontouchstart=\"this.href=this.title + phight.replace(/\ /g,' + \"'+'\" + ');\" id=b_phfloater_google_search>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Tag Search <a class=\"hlclass\" style=\"inline-block;\" href=\"//www.rjmprogramming.com.au/ITblog/\" title=\"//www.rjmprogramming.com.au/ITblog/tag/\" target=_blank onmouseover=\"this.href=this.title + phight.replace(/\ /g,' + \"'-'\" + ');\" ontouchstart=\"this.href=this.title + phight.replace(/\ /g,' + \"'-'\" + ');\" id=b_phfloater_tag_search>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Category Search <a class=\"hlclass\" style=\"inline-block;\" href=\"//www.rjmprogramming.com.au/ITblog/\" title=\"//www.rjmprogramming.com.au/ITblog/category/\" target=_blank onmouseover=\"this.href=this.title + phight.replace(/\ /g,' + \"'-'\" + ');\" ontouchstart=\"this.href=this.title + phight.replace(/\ /g,' + \"'-'\" + ');\" id=b_phfloater_category_search>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Tag First Word Search <a class=\"hlclass\" style=\"inline-block;\" href=\"//www.rjmprogramming.com.au/ITblog/\" title=\"//www.rjmprogramming.com.au/ITblog/tag/\" target=_blank onmouseover=\"this.href=this.title + phight.replace(/\ /g,' + \"'-'\" + ').replace(' + \"'-','/?wopenall='\" + ');\" ontouchstart=\"this.href=this.title + phight.replace(/\ /g,' + \"'-'\" + ').replace(' + \"'-','/?wopenall='\" + ');\" id=b_phfloater_tag_first_word_search>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+=ecmore('<b>' + 'Posting Title Search <a class=\"hlclass\" style=\"inline-block;\" href=\"//www.rjmprogramming.com.au/itblog/match/mapper.php\" title=\"//www.rjmprogramming.com.au/itblog/match/mapper.php?pm=\" target=_blank onmouseover=\"this.href=this.title + encodeURIComponent(phight);\" ontouchstart=\"this.href=this.title + encodeURIComponent(phight);\" id=b_phfloater_posting_title_search>' + phight + '</a></b>') + '<br>';

        document.getElementById('phfloater').innerHTML+='<b>Email <a class=\"hlclass\" style=\"inline-block;\" href=\"mailto:?subject=Re%3a%20' + encodeURIComponent(document.title.split('|')[0]) + '%20%28' + encodeURIComponent(document.URL) + '%29&body=\" title=\"mailto:?subject=Re%3a%20' + encodeURIComponent(document.title.split('|')[0]) + '%20%28%20' + encodeURIComponent(document.URL) + '%20%29&body=\" target=_blank onmouseover=\"this.href=emaileeis(this.title) + encodeURIComponent(phight);\" ontouchstart=\"this.href=emaileeis(this.title) + encodeURIComponent(phight);\" id=b_phfloater_email>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Annotated Email <a class=\"hlclass\" style=\"inline-block;cursor:pointer;text-decoration:none;\" onclick=\"iftoolongpost(this.title, encodeURIComponent((this.innerText || this.contentWindow || this.contentDocument)), encodeURIComponent(this.innerHTML.substring(this.innerHTML.indexOf(String.fromCharCode(60)))));\" data-href=\"//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php?to=&subject=Re%3a%20' + encodeURIComponent(document.title.split('|')[0]) + '%20%28' + encodeURIComponent(document.URL) + '%29%0a&body=\" title=\"//www.rjmprogramming.com.au/HTMLCSS/emailhtml.php?to=&subject=Re%3a%20' + encodeURIComponent(document.title.split('|')[0]) + '%20%28%20' + encodeURIComponent(document.URL) + '%20%29%0a&body=\" target=aeciframe onmouseover=\"this.title=emaileeis(this.title);\" ontouchstart=\"this.title=emaileeis(this.title);\" id=b_phfloater_annotated_email>' + aec + '</a></b><iframe id=aeciframe name=aeciframe style=display:none; src=#></iframe><br>';
        document.getElementById('phfloater').innerHTML+='<b>SMS <a class=\"hlclass\" style=\"inline-block;\" href=\"sms:&body=\" title=\"sms:&body=\" target=_blank onmouseover=\"this.href=smsee(this.title) + encodeURIComponent(phight);\" ontouchstart=\"this.href=smsee(this.title) + encodeURIComponent(phight);\" id=b_phfloater_sms>' + phight + '</a></b><br>';

        document.getElementById('phfloater').innerHTML+='<b>Navigate to Link About <a class=\"hlclass\" style=\"inline-block;text-decoration:underline;cursor:pointer;\" title=\" \" onclick=\"thisasearch(phight,this);\" onmouseover=\"thisasearch(phight,this);\" ontouchstart=\"thisasearch(phight,this);\" id=b_phfloater_posting_a_search>' + phight + '</a></b><br>';
        document.getElementById('phfloater').innerHTML+='<b>Display/Copy Link About <a class=\"hlclass\" style=\"inline-block;text-decoration:underline;cursor:pointer;\" title=\" \" onclick=\"thisacopysearch(phight,this);\" onmouseover=\"thisacopysearch(phight,this);\" ontouchstart=\"thisacopysearch(phight,this);\" id=b_phfloater_posting_a_copy_search>' + phight + '</a></b><br>';
        if (zoharr.length >= 1) {
         for (var ioharr=0; ioharr<zoharr.length; ioharr++) {
          otit='Other Link ' + eval(1 + ioharr);
          if (zoharr[ioharr].indexOf('#') != -1) {
            otit=zoharr[ioharr].split('#')[1].trim();
          }
          if (zoharr[ioharr].split('#')[1].indexOf('  ') == 0) {
            opis=phight.replace(/\ /g,' + \"'-'\" + ');
            document.getElementById('phfloater').innerHTML+='' + otit + ' <a style=\"inline-block;\" href=\"' + zoharr[ioharr].split('#')[0].trim() + '\" title=\"' + zoharr[ioharr].split('#')[0].trim() + '\" target=_blank onmouseover=\"this.href=this.title + hopis(String.fromCharCode(45));\" ontouchstart=\"this.href=this.title + hopis(String.fromCharCode(45));\" id=b_phfloater_' + cookcnt + '>' + phight + '</a><br>';
          } else if (zoharr[ioharr].split('#')[1].indexOf(' ') == 0) {
            opis=phight.replace(/\ /g,' + \"'+'\" + ');
            document.getElementById('phfloater').innerHTML+='' + otit + ' <a style=\"inline-block;\" href=\"' + zoharr[ioharr].split('#')[0].trim() + '\" title=\"' + zoharr[ioharr].split('#')[0].trim() + '\" target=_blank onmouseover=\"this.href=this.title + hopis(String.fromCharCode(43));\" ontouchstart=\"this.href=this.title + hopis(String.fromCharCode(45));\" id=b_phfloater_' + cookcnt + '>' + phight + '</a><br>';
          } else {
            document.getElementById('phfloater').innerHTML+='' + otit + ' <a style=\"inline-block;\" href=\"' + zoharr[ioharr].split('#')[0].trim() + '\" title=\"' + zoharr[ioharr].split('#')[0].trim() + '\" target=_blank onmouseover=\"this.href=this.title + encodeURIComponent(phight);\" ontouchstart=\"this.href=this.title + encodeURIComponent(phight);\" id=b_phfloater_' + cookcnt + '>' + phight + '</a><br>';         
          }
          cookcnt++;
         }
        }
        document.getElementById('phfloater').innerHTML+='<input title=\"Add your own into HTTP Cookies\" type=button onclick=cookiePutHVal(cookblank); value=+></input>&nbsp;<input title=\"Remove all HTTP Cookie URLs\" type=button onclick=cookiePutHVal(cookblank.trim()); value=-></input><br>';
      } else {
        document.getElementById('b_phfloater_wikipedia').innerHTML=phight;
        document.getElementById('b_phfloater_google_translate').innerHTML=phight;
        document.getElementById('b_phfloater_free_dictionary').innerHTML=phight;
        document.getElementById('b_phfloater_google_search').innerHTML=phight;
        document.getElementById('b_phfloater_tag_search').innerHTML=phight;
        document.getElementById('b_phfloater_category_search').innerHTML=phight;
        document.getElementById('b_phfloater_tag_first_word_search').innerHTML=phight;
        document.getElementById('b_phfloater_posting_title_search').innerHTML=phight;

        document.getElementById('b_phfloater_email').innerHTML=phight;
        document.getElementById('b_phfloater_annotated_email').innerHTML=aec;
        document.getElementById('b_phfloater_sms').innerHTML=phight;

        document.getElementById('b_phfloater_posting_a_search').innerHTML=phight;
        document.getElementById('b_phfloater_posting_a_copy_search').innerHTML=phight;
        if (cookcnt > 0) {
          for (var icook=0; icook<cookcnt; icook++) {
            document.getElementById('b_phfloater_' + icook).innerHTML=phight;
          }
        }
        document.getElementById('phfloater').style.top=s_top;
        document.getElementById('phfloater').style.left=s_left;
        document.getElementById('phfloater').style.display='block'; 
      }  
    } 
  } else if (xsel == '') {
    if (document.getElementById('phfloater')) {  
      document.getElementById('phfloater').style.display='none';   
    }
    phight='';
  }
}

function thisasearch(swhat,owhato) {
  if (owhato) {
  if (owhato.title) {
  if (owhato.title != swhat) {
  owhato.title=swhat;
  var acss=document.getElementsByTagName('a'), acssdone=false, ahuhc='', sparehref='';
  for (var iacss=0; iacss<acss.length; iacss++) {
    if (acss[iacss].innerHTML.toLowerCase().replace(/\<i\>/g,'').replace(/\<\/i\>/g,'').replace(/\<b\>/g,'').replace(/\<\/b\>/g,'') == swhat.toLowerCase() && !acssdone && acss[iacss].outerHTML.indexOf(' class=\"hlclass\"') == -1) {
      if (('' + acss[iacss].href) != '') {
        if (('' + acss[iacss].href + ' ').substring(0,1) == '#') {
          acssdone=true;
          location.href=acss[iacss].href;
          owhato.title=' ';
        } else if (acss[iacss].href.replace('/cat/','/tag/').replace('?category=','/tag/').replace('?cat=','/tag/').replace('?tag=','/tag/').indexOf('/tag/') != -1) {
          sparehref=acss[iacss].href;
        } else {
          acssdone=true;
          window.open(acss[iacss].href, '_blank');
          owhato.title=' ';
        }
      }
    }
  }
  if (!acssdone) {
    if (sparehref != '') {
          acssdone=true;
          window.open(sparehref, '_blank');
          owhato.title=' ';
    } else {
          var pwithindiv=withindiv;
          withindiv=9000;
          alert('Sorry, no links like that found.');
    if (pwithindiv == 0) {
    withindiv=0.9999;
    } else {
    withindiv=pwithindiv;
    }
          owhato.title=' ';
    }
  }
  }
  }
  }
}

function thisacopysearch(swhat,owhato) {
  if (owhato) {
  if (owhato.title) {
  if (owhato.title != swhat) {
  owhato.title=swhat;
  var acss=document.getElementsByTagName('a'), acssdone=false, ahuhc='', sparehref='';
  for (var iacss=0; iacss<acss.length; iacss++) {
    if (acss[iacss].innerHTML.toLowerCase().replace(/\<i\>/g,'').replace(/\<\/i\>/g,'').replace(/\<b\>/g,'').replace(/\<\/b\>/g,'') == swhat.toLowerCase() && !acssdone && acss[iacss].outerHTML.indexOf(' class=\"hlclass\"') == -1) {
      if (('' + acss[iacss].href) != '') {
        if (('' + acss[iacss].href + ' ').substring(0,1) == '#') {
          acssdone=true;
          ahuhc=prompt('Chance to copy link below into the clipboard.  Then Cancel finishes and OK navigates to href of what you have left.', acss[iacss].outerHTML);
          if (ahuhc == null) {
             ahuhc='';
          } else if (ahuhc == acss[iacss].outerHTML) {
             owhato.title=' ';
             thisasearch(swhat,owhato);
          } else if (ahuhc.indexOf(' href=\"') != -1) {
             window.open(ahuhc.split(' href=\"')[1].split('\"')[0], '_blank');
          } else if (ahuhc.indexOf(\" href='\") != -1) {
             window.open(ahuhc.split(\" href='\")[1].split(\"'\")[0], '_blank');
          } else if (ahuhc.indexOf(\" href=\") != -1) {
             window.open(ahuhc.split(\" href=\")[1].split(\" \")[0].split(\">\")[0], '_blank');
          }
          owhato.title=' ';
        } else if (acss[iacss].href.replace('/cat/','/tag/').replace('?category=','/tag/').replace('?cat=','/tag/').replace('?tag=','/tag/').indexOf('/tag/') != -1) {
          sparehref=acss[iacss].outerHTML;
        } else {
          acssdone=true;
          ahuhc=prompt('Chance to copy link below into the clipboard.   Then Cancel finishes and OK navigates to href of what you have left.', acss[iacss].outerHTML);
          if (ahuhc == null) {
             ahuhc='';
          } else if (ahuhc == acss[iacss].outerHTML) {
             owhato.title=' ';
             thisasearch(swhat,owhato);
          } else if (ahuhc.indexOf(' href=\"') != -1) {
             window.open(ahuhc.split(' href=\"')[1].split('\"')[0], '_blank');
          } else if (ahuhc.indexOf(\" href='\") != -1) {
             window.open(ahuhc.split(\" href='\")[1].split(\"'\")[0], '_blank');
          } else if (ahuhc.indexOf(\" href=\") != -1) {
             window.open(ahuhc.split(\" href=\")[1].split(\" \")[0].split(\">\")[0], '_blank');
          }
          owhato.title=' ';
        }
      }
    }
  }
  if (!acssdone) {
    if (sparehref != '') {
          acssdone=true;
          ahuhc=prompt('Chance to copy link below into clipboard.  Then Cancel finishes and OK navigates to href of what you have left.', sparehref);
          if (ahuhc == null) {
             ahuhc='';
          } else if (ahuhc == sparehref) {
             owhato.title=' ';
             thisasearch(swhat,owhato);
          } else if (ahuhc.indexOf(' href=\"') != -1) {
             window.open(ahuhc.split(' href=\"')[1].split('\"')[0], '_blank');
          } else if (ahuhc.indexOf(\" href='\") != -1) {
             window.open(ahuhc.split(\" href='\")[1].split(\"'\")[0], '_blank');
          } else if (ahuhc.indexOf(\" href=\") != -1) {
             window.open(ahuhc.split(\" href=\")[1].split(\" \")[0].split(\">\")[0], '_blank');
          }
          owhato.title=' ';
    } else {
          var pwithindiv=withindiv;
          withindiv=9000;
          alert('Sorry, no links like that found.');
    if (pwithindiv == 0) {
    withindiv=0.9999;
    } else {
    withindiv=pwithindiv;
    }
          owhato.title=' ';
    }
  }
  }
  }
  }
}


plookforhighlight();

	</script>
	";
}

add_action( 'wp_footer', 'rjmprogramming_multi_js' );

?>
