
var isopen=false;Event.observe(window,'load',function(){bitHeight=$('pl-dbox-content').getHeight();setTimeout(function(){$('pl-dbox').show();$('pl-dbox').setStyle({'position':'fixed','bottom':'-'+bitHeight-0+'px'});},300);Event.observe($('pl-dbox').down('a.pl-dbox-title'),'click',function(){if(!isopen){isopen=true;$('pl-dbox').down('a.pl-dbox-title').addClassName('open');$('pl-dbox').down('#pl-dbox-content').addClassName('open')
$('pl-dbox').setStyle({'bottom':'0px'});}else{isopen=false;$('pl-dbox').setStyle({'bottom':'-'+bitHeight-0+'px'});$('pl-dbox').down('a.pl-dbox-title').removeClassName('open');$('pl-dbox').down('#pl-dbox-content').removeClassName('open');}});});if(!window['isEditMode'])
{document.ondblclick=function(){var sel=(document.selection&&document.selection.createRange().text)||(window.getSelection&&window.getSelection().toString());if(sel!=undefined){var selreal=sel.replace(/^\s+|\s+$/g,"");if(selreal!=''){document.getElementById('pl-dbox-search-field').value=selreal;$('pl-dbox').down('a.pl-dbox-title').addClassName('open');$('pl-dbox').down('#pl-dbox-content').addClassName('open');$('pl-dbox').setStyle({'bottom':'0px'});isopen=true;getdboxResults();}}};}
function getdboxResults(){var langs=document.getElementById('pl-dbox-glossary').value;var script_id=null;var script=document.createElement('script');script.setAttribute('type','text/javascript');script.setAttribute('src','http://dictionarybox.com/result.asp?pl-dbox-search-field='+encodeURI(document.getElementById('pl-dbox-search-field').value)+'&pl-dbox-langs='+langs);script.setAttribute('id','script_id');script_id=document.getElementById('script_id');if(script_id){document.getElementsByTagName('head')[0].removeChild(script_id);}
document.getElementsByTagName('head')[0].appendChild(script);}
function callback(data){var jdbox=document.getElementById('pl-dbox-ajax-content');jdbox.innerHTML=data['html'];dboxCursorLoc();}
function dbxChkKy(e){if(e.keyCode==13){getdboxResults();return false;}}
function dboxCursorLoc(){var txt=document.getElementById('pl-dbox-search-field');if(txt.createTextRange){var FieldRange=txt.createTextRange();FieldRange.moveStart('character',txt.value.length);FieldRange.collapse();FieldRange.select();}
else{if(!Boolean(window.chrome)){txt.focus();}
var length=txt.value.length;txt.setSelectionRange(length,length);}}
