
/* Merged Plone Javascript file
 * This file is dynamically assembled from separate parts.
 * Some of these parts have 3rd party licenses or copyright information attached
 * Such information is valid for that section,
 * not for the entire composite file
 * originating files are separated by - filename.js -
 */

/* - input-label.js - */
// http://www.rappahannocklibrary.org/portal_javascripts/input-label.js?original=1
var ploneInputLabel={focus: function(e){var t=jq(e.target);if(t.hasClass('inputLabelActive')&&t.val()==t.attr('title'))
t.val('').removeClass('inputLabelActive')},blur: function(e){var t=jq(e.target);if(!t.val())
t.addClass('inputLabelActive').val(t.attr('title'))},submit: function(e){jq('input[title].inputLabelActive').filter(function(){return jq(this).val()==this.title}).val('').removeClass('inputLabelActive')}};jq(function(){jq('form:has(input[title].inputLabel)').submit(ploneInputLabel.submit);jq('input[title].inputLabel').each(function(){jq(this).focus(ploneInputLabel.focus).blur(ploneInputLabel.blur);if(!jq(this).val())
jq(this).val(this.title).removeClass('inputLabel').addClass('inputLabelActive')})});

/* - kupuspellchecker.js - */
// http://www.rappahannocklibrary.org/portal_javascripts/kupuspellchecker.js?original=1
function KupuSpellChecker(buttonid,scripturl,spanstyle,winwidth,winheight,skip_tags){this.button=document.getElementById(buttonid);this.scripturl=scripturl;this.spanstyle=spanstyle||'color: red; '+'text-decoration: underline;';this.winwidth=winwidth||'600';this.winheight=winheight||'400';this.skip_tags=skip_tags||['head','script']};KupuSpellChecker.prototype=new KupuTool;KupuSpellChecker.prototype.initialize=function(editor){this.editor=editor;if(this.button){addEventHandler(this.button,'click',this.check,this)}};KupuSpellChecker.prototype.check=function(){var request=new XMLHttpRequest();request.open('POST',this.scripturl,true);request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');request.onreadystatechange=new ContextFixer(this.stateChangeHandler,this,request).execute;var result=this.getCurrentContents();result=encodeURIComponent(result.reduceWhitespace().strip());request.send('text='+result)};KupuSpellChecker.prototype.stateChangeHandler=function(request){if(request.readyState==4){if(request.status=='200'){var result=request.responseXML;result=this.xmlToMapping(result);if(!result){alert(_('There were no errors.'))} else{this.displayUnrecognized(result)}} else{alert(_('Error loading data, status ${status}',{'status':request.status}))}}};KupuSpellChecker.prototype.getCurrentContents=function(){var doc=this.editor.getInnerDocument().documentElement;var iterator=new NodeIterator(doc);var bits=[];while(true){var node=iterator.next();if(!node||node.nodeName.toLowerCase()=='body'){break};while(this.skip_tags.contains(node.nodeName.toLowerCase())){node=node.nextSibling;iterator.setCurrent(node)};if(node.nodeType==3){bits.push(node.nodeValue)}};return bits.join(' ')};KupuSpellChecker.prototype.displayUnrecognized=function(mapping){var doc=this.editor.getInnerDocument();var docel=doc.documentElement;var win=window.open('kupublank.html','spellchecker','width='+this.winwidth+','+'height='+this.winheight+',toolbar=no,'+'menubar=no,scrollbars=yes,status=yes');if(!win){alert(_('This feature requires pop-ups to be enabled on your browser!'));return};var html=docel.innerHTML;html=html.replace(/<meta[^>]*http-equiv="[Cc]ontent-[Tt]ype"[^>]*>/gm,'');win.document.write('<html>'+html+'</html>');win.deentitize=function(str){return str.deentitize()};win.document.close();if(!win.document.getElementsByTagName('body').length){addEventHandler(win,'load',this.continueDisplay,this,win,mapping)} else{this.continueDisplay(win,mapping)}};KupuSpellChecker.prototype.continueDisplay=function(win,mapping){timer_instance.registerFunction(this,this.continueDisplayHelper,1000,win,mapping)};KupuSpellChecker.prototype.continueDisplayHelper=function(win,mapping){var body=win.document.getElementsByTagName('body')[0];body.setAttribute('contentEditable','false');var iterator=new NodeIterator(body);var node=iterator.next();timer_instance.registerFunction(this,this.displayHelperNodeLoop,10,iterator,node,win,mapping)};KupuSpellChecker.prototype.displayHelperNodeLoop=function(iterator,node,win,mapping){if(!node||node.nodeName.toLowerCase()=='body'){return};var next=iterator.next();if(node.nodeType==3){if(win.closed){return};var span=win.document.createElement('span');var before=node.nodeValue;var after=this.colourText(before,mapping);if(before!=after){span.innerHTML=after;var last=span.lastChild;var parent=node.parentNode;parent.replaceChild(last,node);while(span.hasChildNodes()){parent.insertBefore(span.firstChild,last)}}} else if(node.nodeType==1&&node.nodeName.toLowerCase()=='a'){var cancelEvent=function(e){if(e.preventDefault){e.preventDefault()} else{e.returnValue=false};return false};addEventHandler(node,'click',cancelEvent);addEventHandler(node,'mousedown',cancelEvent);addEventHandler(node,'mouseup',cancelEvent)};timer_instance.registerFunction(this,this.displayHelperNodeLoop,10,iterator,next,win,mapping)};KupuSpellChecker.prototype.colourText=function(text,mapping){var currtext=text;var newtext='';for(var word in mapping){var replacements=mapping[word];replacements=replacements.entitize();replacements=replacements.replace(/\'/g,"&apos;");var reg=new RegExp('^(.*\\\W)?('+word+')(\\\W.*)?$','mg');while(true){var match=reg.exec(currtext);if(!match){newtext+=currtext;currtext=newtext;newtext='';break};var m=(match[1]||'')+match[2];newtext+=currtext.substr(0,currtext.indexOf(m));newtext+=(match[1]||'')+'<span style="'+this.spanstyle+'" '+'onclick="alert(deentitize(\''+replacements+'\'));" '+'title="'+replacements+'">'+match[2]+'</span>';currtext=currtext.substr(currtext.indexOf(m)+m.length)}};return currtext};KupuSpellChecker.prototype.xmlToMapping=function(docnode){var docel=docnode.documentElement;var result={};var incorrect=docel.getElementsByTagName('incorrect');for(var i=0;i<incorrect.length;i++){var word=incorrect[i].firstChild.firstChild.nodeValue;var replacements='';if(incorrect[i].lastChild.hasChildNodes()){replacements=incorrect[i].lastChild.firstChild.nodeValue};result[word]=replacements};return result};

/* - tabberoptions.js - */
// http://www.rappahannocklibrary.org/portal_javascripts/tabberoptions.js?original=1
var tabberOptions={manualStartup:true};

/* - tabber-minimizer.js - */
// http://www.rappahannocklibrary.org/portal_javascripts/tabber-minimizer.js?original=1
function tabberObj(argsObj){var arg;this.div=null;this.classMain="tabber";this.classMainLive="tabberlive";this.classTab="tabbertab";this.classTabDefault="tabbertabdefault";this.classNav="tabbernav";this.classTabHide="tabbertabhide";this.classNavActive="tabberactive";this.titleElements=['h2','h3','h4','h5','h6'];this.titleElementsStripHTML=true;this.removeTitle=true;this.addLinkId=true;this.linkIdFormat='<tabberid>nav<tabnumberone>';for(arg in argsObj){this[arg]=argsObj[arg]}
this.REclassMain=new RegExp('\\b'+this.classMain+'\\b','gi');this.REclassMainLive=new RegExp('\\b'+this.classMainLive+'\\b','gi');this.REclassTab=new RegExp('\\b'+this.classTab+'\\b','gi');this.REclassTabDefault=new RegExp('\\b'+this.classTabDefault+'\\b','gi');this.REclassTabHide=new RegExp('\\b'+this.classTabHide+'\\b','gi');this.tabs=new Array();if(this.div){this.init(this.div);this.div=null}}
tabberObj.prototype.init=function(e){var childNodes,i,i2,t,defaultTab=0,DOM_ul,DOM_li,DOM_a,aId,headingElement;if(!document.getElementsByTagName){return false}
if(e.id){this.id=e.id}
this.tabs.length=0;childNodes=e.childNodes;for(i=0;i<childNodes.length;i++){if(childNodes[i].className&&childNodes[i].className.match(this.REclassTab)){t=new Object();t.div=childNodes[i];this.tabs[this.tabs.length]=t;if(childNodes[i].className.match(this.REclassTabDefault)){defaultTab=this.tabs.length-1}}}
DOM_ul=document.createElement("ul");DOM_ul.className=this.classNav;for(i=0;i<this.tabs.length;i++){t=this.tabs[i];t.headingText=t.div.title;if(this.removeTitle){t.div.title=''}
if(!t.headingText){for(i2=0;i2<this.titleElements.length;i2++){headingElement=t.div.getElementsByTagName(this.titleElements[i2])[0];if(headingElement){t.headingText=headingElement.innerHTML;if(this.titleElementsStripHTML){t.headingText.replace(/<br>/gi," ");t.headingText=t.headingText.replace(/<[^>]+>/g,"")}
break}}}
if(!t.headingText){t.headingText=i+1}
DOM_li=document.createElement("li");t.li=DOM_li;DOM_a=document.createElement("a");DOM_a.appendChild(document.createTextNode(t.headingText));DOM_a.href="javascript:void(null);";DOM_a.title=t.headingText;DOM_a.onclick=this.navClick;DOM_a.tabber=this;DOM_a.tabberIndex=i;if(this.addLinkId&&this.linkIdFormat){aId=this.linkIdFormat;aId=aId.replace(/<tabberid>/gi,this.id);aId=aId.replace(/<tabnumberzero>/gi,i);aId=aId.replace(/<tabnumberone>/gi,i+1);aId=aId.replace(/<tabtitle>/gi,t.headingText.replace(/[^a-zA-Z0-9\-]/gi,''));DOM_a.id=aId}
DOM_li.appendChild(DOM_a);DOM_ul.appendChild(DOM_li)}
e.insertBefore(DOM_ul,e.firstChild);e.className=e.className.replace(this.REclassMain,this.classMainLive);this.tabShow(defaultTab);if(typeof this.onLoad=='function'){this.onLoad({tabber:this})}
return this};tabberObj.prototype.navClick=function(event){var rVal,a,self,tabberIndex,onClickArgs;a=this;if(!a.tabber){return false}
self=a.tabber;tabberIndex=a.tabberIndex;a.blur();if(typeof self.onClick=='function'){onClickArgs={'tabber':self,'index':tabberIndex,'event':event};if(!event){onClickArgs.event=window.event}
rVal=self.onClick(onClickArgs);if(rVal===false){return false}}
self.tabShow(tabberIndex);return false};tabberObj.prototype.tabHideAll=function(){var i;for(i=0;i<this.tabs.length;i++){this.tabHide(i)}};tabberObj.prototype.tabHide=function(tabberIndex){var div;if(!this.tabs[tabberIndex]){return false}
div=this.tabs[tabberIndex].div;if(!div.className.match(this.REclassTabHide)){div.className+=' '+this.classTabHide}
this.navClearActive(tabberIndex);return this};tabberObj.prototype.tabShow=function(tabberIndex){var div;if(!this.tabs[tabberIndex]){return false}
this.tabHideAll();div=this.tabs[tabberIndex].div;div.className=div.className.replace(this.REclassTabHide,'');this.navSetActive(tabberIndex);if(typeof this.onTabDisplay=='function'){this.onTabDisplay({'tabber':this,'index':tabberIndex})}
return this};tabberObj.prototype.navSetActive=function(tabberIndex){this.tabs[tabberIndex].li.className=this.classNavActive;return this};tabberObj.prototype.navClearActive=function(tabberIndex){this.tabs[tabberIndex].li.className='';return this};
function tabberAutomatic(tabberArgs){var tempObj,divs,i;if(!tabberArgs){tabberArgs={}}
tempObj=new tabberObj(tabberArgs);divs=document.getElementsByTagName("div");for(i=0;i<divs.length;i++){if(divs[i].className&&divs[i].className.match(tempObj.REclassMain)){tabberArgs.div=divs[i];divs[i].tabber=new tabberObj(tabberArgs)}}
return this}
function tabberAutomaticOnLoad(tabberArgs){var oldOnLoad;if(!tabberArgs){tabberArgs={}}
oldOnLoad=window.onload;if(typeof window.onload!='function'){window.onload=function(){tabberAutomatic(tabberArgs)}}
else{window.onload=function(){oldOnLoad();tabberAutomatic(tabberArgs)}}}
if(typeof tabberOptions=='undefined'){tabberAutomaticOnLoad()}else{if(!tabberOptions['manualStartup']){tabberAutomaticOnLoad(tabberOptions)}}

/* - tabber_inline.js - */
// http://www.rappahannocklibrary.org/portal_javascripts/tabber_inline.js?original=1
var tabberOptions={manualStartup:true};/* \x3C is the hexcode for 'less than'(&lt;) \x3E is the hexcode for 'greater than'(&gt;) it's needed for proper XHTML validation */ document.write('\x3Cstyle type="text/css"\x3E.tabber{display:none}\x3C/style\x3E');

