var HighlightRanges=new Array();var SCRIPT_PATH="/annotate";var BASE_NODE_CLASS="book-content";var PopUpSettings="resizable,toolbar=no,location=no,scrollbars=no,status=no,width=251,height=225,left=0,top=0";var NoteLocation;var NoteID;var NoteOffset;var NOTE_ICON_SRC="http://static.ccel.org/pix/note.png";function annotateText(){var A="op=request&url="+window.location.pathname;var B=newXHR();B.onreadystatechange=function(){if(B.readyState==4&&B.status==200){parseAnnotations(B.responseXML)}};B.open("POST",SCRIPT_PATH,true);B.setRequestHeader("Content-Type","application/x-www-form-urlencoded");B.send(A)}function parseAnnotations(I){I=I.getElementsByTagName("annotations")[0];if(I!=null&&I.hasChildNodes()){var A=I.getElementsByTagName("aid");var G=I.getElementsByTagName("annotation");for(var F=0;F<G.length;F++){if(G[F].getElementsByTagName("type")[0].firstChild.nodeValue=="highlight"){var C=G[F].getElementsByTagName("start")[0];var E=G[F].getElementsByTagName("end")[0];var D=G[F].getElementsByTagName("color")[0].firstChild.nodeValue;var H=new Location(C.getElementsByTagName("id")[0].firstChild.nodeValue,C.getElementsByTagName("offset")[0].firstChild.nodeValue);var B=new Location(E.getElementsByTagName("id")[0].firstChild.nodeValue,E.getElementsByTagName("offset")[0].firstChild.nodeValue);HighlightRanges[A[F].firstChild.nodeValue]=Array(H,B,D);a_highlight(H,B,D)}else{var C=G[F].getElementsByTagName("start")[0];placeNote(new Location(C.getElementsByTagName("id")[0].firstChild.nodeValue,C.getElementsByTagName("offset")[0].firstChild.nodeValue),A[F].firstChild.nodeValue)}}}}function addAnnotation(G,C){var E=getPosition();if(E!=0&&E!=-1&&childOf(E.startContainer,"book-content")&&childOf(E.endContainer,"book-content")&&!childOf(E.startContainer,"mnote")&&!childOf(E.endContainer,"mnote")){var F=collapseSpacesOffset(E.startContainer,E.startOffset);var H=collapseSpacesOffset(E.endContainer,E.endOffset);var J=getPath(E.startContainer);var A=new Location(J[J.length-1].id,getOffset(J)+F);var I=J[J.length-1].tagName;J=getPath(E.endContainer);var B=new Location(J[J.length-1].id,getOffset(J)+H);var D=J[J.length-1].tagName;if(G=="highlight"){Hightlight_Color=C;submitHighlight(A,B,C);a_highlight(A,B,C)}else{if(G=="note"){if(D=="A"){alert("Note cannot be placed inside a scripture reference")}else{NoteLocation=B;popupNoteEditor(E.endContainer.parentNode,OnInsert,"")}}else{if(G=="remove"){removeHighlights(A,B)}}}}else{if(E==1){alert("Due to limitations of Internet Explorer, please either use Firefox or not begin or end selection on a blank line.")}else{alert("Please highlight text within book page and try again.")}}}function a_highlight(B,F,E){var I=B.convert();var C=I[0];var J=I[1];I=F.convert();var H=I[0];var K=I[1];var A=C;for(;;){if(A!=H&&A!=C){if(A.hasChildNodes()){var D=findNextNode(A);var G=highlightChildren(A,H,K,E);if(G){break}else{A=D;continue}break}else{A=highlightNode(A,E)}}else{if(A==C){if(C==H){A=highlightSelection(A,J,K,E);break}else{A=highlightSelection(A,J,getTextContent(A).length,E)}}else{highlightSelection(A,0,K,E);break}}A=findNextNode(A)}}function highlightChildren(G,A,D,C){var F=G.childNodes;var H=F.length;var B=false;for(var E=0;E<H;E++){if(F[E].className=="mnote"){}else{if(F[E].hasChildNodes()){B=highlightChildren(F[E],A,D,C);if(B){return true}}else{if(F[E]!=A){highlightNode(F[E],C)}else{highlightSelection(A,0,D,C);return true}}}}return B}function highlightNode(D,B){var C=getTextContent(D);if(C!=""){var A=document.createElement("span");A.className="highlight";A.style.backgroundColor=B;A.appendChild(D.cloneNode(true));D.parentNode.replaceChild(A,D);return A}else{return D}}function highlightSelection(B,H,I,E){var C=document.createElement("span");C.className="highlight";C.style.backgroundColor=E;var G=getTextContentWithSpaces(B).replace(/[\t\n\r ]+/g," ");if(H==0&&I==G.length){return highlightNode(B,E)}else{var A=G.substring(0,H);var J=G.substring(H,I);var D=G.substring(I,G.length);C.appendChild(document.createTextNode(J));if(H==0){var F=document.createTextNode(D);B.parentNode.insertBefore(C,B)}else{if(I==G.length){var F=C;B.parentNode.insertBefore(document.createTextNode(A),B)}else{var F=document.createTextNode(D);B.parentNode.insertBefore(document.createTextNode(A),B);B.parentNode.insertBefore(C,B)}}B.parentNode.replaceChild(F,B);return F}}function submitHighlight(F,B,C){var D="<annotation><type>highlight</type><start><id>"+F.id+"</id><offset>"+F.offset+"</offset></start><end><id>"+B.id+"</id><offset>"+B.offset+"</offset></end><color>"+C+"</color></annotation>";var A="op=insert&uid="+uid+"&url="+window.location.pathname+"&data="+D;var E=newXHR();E.onreadystatechange=function(){if(E.readyState==4&&E.status==200){HighlightRanges[E.responseText]=Array(F,B,C)}};E.open("POST",SCRIPT_PATH,true);E.setRequestHeader("Content-Type","application/x-www-form-urlencoded");E.send(A)}function placeNote(G,D){var E=G.convert();var B=document.createElement("img");B.setAttribute("width","11");B.setAttribute("height","11");B.className="note";B.setAttribute("src",NOTE_ICON_SRC);B.onmouseover=function(){popupNote(this,D)};B.onmouseout=function(){leaveVerse()};var C=getTextContentWithSpaces(E[0]).replace(/\s+/g," ");if(E[1]==0){E[0].parentNode.insertBefore(B,E[0])}else{if(E[1]==C.length){E[0].parentNode.insertBefore(E[0].cloneNode(true),E[0]);E[0].parentNode.replaceChild(B,E[0])}else{var F=C.substring(0,E[1]);var A=C.substring(E[1],C.length);E[0].parentNode.insertBefore(document.createTextNode(F),E[0]);E[0].parentNode.insertBefore(B,E[0]);E[0].parentNode.replaceChild(document.createTextNode(A),E[0])}}}function submitNote(C){C=C.replace(/^\s+|\s$/g,"");if(C!=""){C=replaceSpecialChars(C);var B="<annotation><type>note</type><start><id>"+NoteLocation.id+"</id><offset>"+NoteLocation.offset+"</offset></start><text>"+C+"</text></annotation>";var A="op=insert&uid="+uid+"&url="+window.location.pathname+"&data="+B;var D=newXHR();D.onreadystatechange=function(){if(D.readyState==4&&D.status==200){placeNote(new Location(NoteLocation.id,NoteLocation.offset),D.responseText)}};D.open("POST",SCRIPT_PATH,true);D.setRequestHeader("Content-Type","application/x-www-form-urlencoded");D.send(A)}closeEditor()}function updateNote(C,E){C=C.replace(/^\s+|\s$/g,"");if(C!=""){C=replaceSpecialChars(C);var B="<annotation><type>note</type><start><id>"+NoteID+"</id><offset>"+NoteOffset+"</offset></start><text>"+C+"</text></annotation>";var A="op=update&id="+E+"&data="+B;var D=newXHR();D.open("POST",SCRIPT_PATH,true);D.setRequestHeader("Content-Type","application/x-www-form-urlencoded");D.send(A)}else{deleteAnnotation(E);refreshPage()}closeEditor()}function removeHighlights(C,A){for(var B in HighlightRanges){if(C.compare(HighlightRanges[B][0])>=0){if(A.compare(HighlightRanges[B][1])>0&&A.compare(HighlightRanges[B][0])<0){submitHighlight(A,HighlightRanges[B][1],HighlightRanges[B][2]);deleteAnnotation(B)}else{if(A.compare(HighlightRanges[B][1])<=0){deleteAnnotation(B)}else{updateTimestamp(B)}}}else{if(A.compare(HighlightRanges[B][1])<=0){if(C.compare(HighlightRanges[B][0])<0&&C.compare(HighlightRanges[B][1])>0){submitHighlight(HighlightRanges[B][0],C,HighlightRanges[B][2]);deleteAnnotation(B)}else{if(C.compare(HighlightRanges[B][0])>=0){deleteAnnotation(B)}else{updateTimestamp(B)}}}else{submitHighlight(HighlightRanges[B][0],C,HighlightRanges[B][2]);submitHighlight(A,HighlightRanges[B][1],HighlightRanges[B][2]);deleteAnnotation(B)}}}refreshPage()}function deleteAnnotation(C){var A="op=delete&id="+C;var B=newXHR();B.open("POST",SCRIPT_PATH,true);B.setRequestHeader("Content-Type","application/x-www-form-urlencoded");B.send(A)}function updateTimestamp(C){var A="op=time&id="+C;var B=newXHR();B.open("POST",SCRIPT_PATH,true);B.setRequestHeader("Content-Type","application/x-www-form-urlencoded");B.send(A)}function refreshPage(){if(window.location.pathname.search("niv")==-1){var A="op=refresh&uid="+uid+"&url="+window.location.pathname;var B=newXHR();B.onreadystatechange=function(){if(B.readyState==4&&B.status==200){var F=B.responseText.indexOf("<div");var C=B.responseText.lastIndexOf("</div>");var E=B.responseText.substring(F+26,C);var D=document.getElementById("book_navbar_top");D.nextSibling.innerHTML=E;removeLeadingSpaces();annotateText();highlightSearch();reFootNote()}};B.open("POST",SCRIPT_PATH,true);B.setRequestHeader("Content-Type","application/x-www-form-urlencoded");B.send(A)}else{processXLinks()}HighlightRanges=new Array()}function reFootNote(){var B=document.getElementsByTagName("sup");for(var A=0;A<B.length;A++){if(B[A].className=="Note"){initNote(B[A].nextSibling.id)}}}function Location(B,A){this.id=B;this.offset=A;this.convert=Location_convert;this.compare=Location_compare}function Location_convert(){return findOffset(document.getElementById(this.id),this.offset)}function Location_compare(C){if(this.id==C.id){if(this.offset<C.offset){return 1}else{if(this.offset==C.offset){return 0}else{return -1}}}else{var E=getPathToBase(document.getElementById(this.id));var D=getPathToBase(document.getElementById(C.id));var B=E.length-1;var A=D.length-1;while(E[B]==D[A]){B--;A--}var F=E[B+1].firstChild;if(B<0){E[0]=this.convert()[0];B=0}if(A<0){D[0]=C.convert()[0];A=0}while(F!=E[B]&&F!=D[A]){F=F.nextSibling}if(F==E[B]){return 1}else{return -1}}}function getPosition(){var K;var H;if(navigator.appName=="Microsoft Internet Explorer"){K=document.selection;H=K.createRange();if(H.text==""){return 0}var B=H.duplicate();var F=H.duplicate();B.collapse(true);F.collapse(false);B=B.parentElement();F=F.parentElement();if(B.id=="nivChapter"||F.id=="nivChapter"){return -1}var E=getPath(B);var I=getPath(F);var J=H.duplicate();var G=H.duplicate();J.moveToElementText(B);G.moveToElementText(F);J.setEndPoint("EndToStart",H);G.setEndPoint("EndToEnd",H);var L=J.text.length;var D=G.text.length;var A=new Location(E[E.length-1].id,getOffset(E)+L);var C=new Location(I[I.length-1].id,getOffset(I)+D);aStart=A.convert();aEnd=C.convert();if(aStart[0]==aEnd[0]&&(aEnd[1]-aStart[1]==1)&&aStart[0].nodeValue.charAt(aStart[1])==" "){return 0}else{return new MozRange(aStart[0],aStart[1],aEnd[0],aEnd[1])}}else{K=window.getSelection();if(K.toString==""){return 0}else{H=K.getRangeAt(0);if(H.startContainer.hasChildNodes()){H.setStart(H.startContainer.childNodes[H.startOffset],0)}if(H.endContainer.hasChildNodes()){H.setEnd(H.endContainer.childNodes[H.endOffset],0)}return H}}}function MozRange(D,B,A,C){this.startContainer=D;this.startOffset=B;this.endContainer=A;this.endOffset=C}function findNextNode(A){for(;;){if(A.nextSibling!=null){A=A.nextSibling;if(A.className=="mnote"){return A.nextSibling}else{return A}}A=A.parentNode}}function childOf(B,A){while(B.className!=A){B=B.parentNode;if(B.tagName=="BODY"){return false}}return true}function getPathToBase(B){var C=new Array();C[0]=B;var A=0;do{C[A+1]=C[A++].parentNode}while(C[A].className!=BASE_NODE_CLASS);return C}function findOffset(E,D){var C=E.childNodes;for(var B=0;B<C.length;B++){if(C[B].nodeType==8){continue}var A=null;var F=D-getTextContent(C[B]).length;if(C[B].hasChildNodes()&&(F<=0)){A=findOffset(C[B],D)}else{if(F<=0){A=Array(C[B],D)}}D=F;if(A!=null){return A}}}function getPath(B){var C=new Array();C[0]=B;var A=0;while(C[A].nodeType==3||C[A].getAttribute("id")==null||C[A].getAttribute("id")==""||!C[A].hasChildNodes()){C[A+1]=C[A++].parentNode}return C}function getOffset(E){var D=E.length-1;var C=E[D].childNodes;var F=0;for(var B=1;B<=D;B++){var A=0;while(C[A]!=E[D-B]){if(C[A].nodeType!=8){F+=getTextContent(C[A]).length}A++}C=C[A].childNodes}return F}function replaceSpecialChars(A){A=A.replace(/</g,"&lt;");A=A.replace(/>/g,"&gt;");A=A.replace(/&/g,"%26");return A}function getTextContent(A){return stripChars(getTextContentWithSpaces(A))}function getTextContentWithSpaces(A){if(navigator.appName=="Microsoft Internet Explorer"){if(A.nodeType==3){return A.nodeValue}else{return A.outerText}}else{return A.textContent}}function collapseSpacesOffset(A,C){var B=getTextContentWithSpaces(A).substr(0,C);B=stripChars(B);return B.length}function stripChars(A){A=A.replace(/[\t\n\r ]+/g," ");A=A.replace(/^ $/g,"");A=A.replace(/<\!--.*?-->/g,"   ");return A}function removeLeadingSpaces(){if(navigator.appName!="Microsoft Internet Explorer"){var A=document.getElementById("main").childNodes[6];var B=A.getElementsByTagName("p");for(var C=0;C<B.length;C++){removeSpace(B[C])}}}function removeSpace(C){if(C.nodeType==3&&getTextContentWithSpaces(C).length>0){var A=document.createTextNode(C.nodeValue.replace(/(^[\t\n\r ]+)(.*)/g,"$2"));C.parentNode.replaceChild(A,C);return true}else{if(C.hasChildNodes()&&getTextContentWithSpaces(C).length>0){var D=false;var B=C.firstChild;while(!D){D=removeSpace(B);B=B.nextSibling}return true}else{return false}}}if(!self.addLoadEvent){function addLoadEvent(A){if(window.addEventListener){window.addEventListener("load",A,false)}else{if(window.attachEvent){window.attachEvent("onload",A)}}}}function initNote(C){if(preferences["notes"]=="hidden"){document.getElementById(C).style.display="none"}else{if(preferences["notes"]=="foot"){var B=document.getElementById(C);var A=B.cloneNode(true);B.style.display="none";B.id="old_"+B.id;addLoadEvent(function(){addFooterNote(A)})}}}function addFooterNote(B){var C=document.getElementById("book_navbar_bottom");if(!document.getElementById("footer_hr")){var A=document.createElement("hr");A.id="footer_hr";C.parentNode.insertBefore(A,C)}else{C.parentNode.insertBefore(document.createElement("br"),C)}B.className="footer_note";B.childNodes[0].href="#fna"+B.id.substring(3);C.parentNode.insertBefore(B,C)}function goBible(F,D,E,G,C,B){var A="/ccel/bible/"+preferences[F]+"."+D+"."+E+".html?scrBook="+D+"&scrCh="+E+"-"+C+"&scrV="+G+"-"+B;if(goBCBNewWin(A)){document.location.href=A}return false}function goBCBNewWin(A){if(bcb.length>0){window.open(A,"bcb_"+bcb);return false}return true}function goBCBParam(A){if(bcb.length>0){var B=A.lastIndexOf("#");var D="";if(B!=-1){D=A.substring(B);A=A.substring(0,B)}var C=A.indexOf("?");if(C==-1){A+="?"}else{A+="&"}A+="bcb="+bcb+D;document.location.href=A;return false}return true}function highlight(C){var B=C.src;var A=B.indexOf(".gif");if(B.indexOf("_hilite.gif")==-1&&A!=-1){B=B.substring(0,A);C.src=B+"_hilite.gif"}}function unhighlight(C){var B=C.src;var A=B.indexOf("_hilite.gif");if(A!=-1){B=B.substring(0,A);C.src=B+".gif"}}function toggle(B){if(preferences["notes"]=="foot"){var C=document.location.href;if(C.indexOf("#")!=-1){C=C.substring(0,C.indexOf("#"))}document.location.href=C+"#"+B}else{var A=document.getElementById(B);if(A.style.display!="none"){A.style.display="none"}else{A.style.display="inline"}}}var zoomfactor=0.15;function zoomhelper(A,B){if(parseInt(whatcache.style.width)>10&&parseInt(whatcache.style.height)>10){whatcache.style.width=parseInt(whatcache.style.width)+parseInt(whatcache.style.width)*zoomfactor*prefix;whatcache.style.height=parseInt(whatcache.style.height)+parseInt(whatcache.style.height)*zoomfactor*prefix}}function zoom(originalW,originalH,what,state){if(!document.all&&!document.getElementById){return }whatcache=eval("document.images."+what);if(parseInt(whatcache.style.width)>(originalW*3)&&state=="in"){return }if(parseInt(whatcache.style.width)<(originalW/3)&&state=="out"){return }prefix=(state=="in")?1:-1;if(whatcache.style.width==""||state=="restore"){whatcache.style.width=originalW;whatcache.style.height=originalH;if(state=="restore"){return }}zoomhelper(originalW,originalH)}function clearzoom(){if(window.beginzoom){clearInterval(beginzoom)}}function getCookie(A){if(document.cookie.length>0){begin=document.cookie.indexOf(A+"=");if(begin!=-1){begin+=A.length+1;end=document.cookie.indexOf(";",begin);if(end==-1){end=document.cookie.length}return unescape(document.cookie.substring(begin,end))}}return null}function createResizeHandle(){var C=document.createElement("td");C.id="resizehandle";C.style.cursor="e-resize";C.style.color="#999";C.style.backgroundImage="url(/pix/resizeHandle.jpg)";C.style.width="5px";C.title="Click and drag to resize area";if(C.addEventListener){C.addEventListener("mousedown",B,true)}else{if(C.attachEvent){C.attachEvent("onmousedown",B)}}C.appendChild(document.createTextNode("."));var A=document.getElementById("sidebar-left");A.parentNode.insertBefore(C,A.nextSibling);function B(D){beginDrag(C,D)}}function beginDrag(E,I){var D=document.getElementById("sidebar-left");var C=document.getElementById("tocdiv");var H=parseInt(D.offsetWidth);var B=parseInt(C.offsetWidth);var F=I.clientX;if(document.addEventListener){document.addEventListener("mousemove",G,true);document.addEventListener("mouseup",A,true)}else{if(document.attachEvent){document.attachEvent("onmousemove",G);document.attachEvent("onmouseup",A)}}if(I.stopPropagation){I.stopPropagation()}else{I.cancelBubble=true}if(I.preventDefault){I.preventDefault()}else{I.returnValue=false}function G(L){var J=L.clientX-F;var K=H+J;var M=B+J;if(K>0){D.style.width=K+"px"}if(M>0){C.style.width=M+"px"}if(L.stopPropagation){L.stopPropagation()}else{L.cancelBubble=true}}function A(J){if(document.removeEventListener){document.removeEventListener("mouseup",A,true);document.removeEventListener("mousemove",G,true)}else{if(document.detachEvent){document.detachEvent("onmouseup",A);document.detachEvent("onmousemove",G)}}if(J.stopPropagation){J.stopPropagation()}else{J.cancelBubble=true}}}function highlight(C){var B=C.src;var A=B.indexOf(".gif");if(B.indexOf("_hilite.gif")==-1&&A!=-1){B=B.substring(0,A);C.src=B+"_hilite.gif"}}function unhighlight(C){var B=C.src;var A=B.indexOf("_hilite.gif");if(A!=-1){B=B.substring(0,A);C.src=B+".gif"}}function t(D,A){var C,B;if(document.getElementById){C=document.getElementById(D);B=document.getElementById(A)}if(C.style.display=="block"){C.style.display="none";B.src="/pix/shut_hilite.gif"}else{C.style.display="block";B.src="/pix/open_hilite.gif"}}function expand_subsection(){if(document.getElementById("book_section_id")){var C=document.getElementById("book_section_id").name;if(document.getElementById("toc"+C)){var B=document.getElementById("toc"+C);if(B.nextSibling&&B.nextSibling.nodeName.toLowerCase()=="div"&&B.nextSibling.style.display!="block"){var A=B.nextSibling.id.substr(1);t("d"+A,"p"+A);if(document.getElementById("p"+A)){unhighlight(document.getElementById("p"+A))}}}}}function expand_toc(){if(document.getElementById("book_section_id")){var B=document.getElementById("book_section_id").name;if(document.getElementById("toc"+B)){var A=document.getElementById("toc"+B);A.className=A.className+" toc_selected_section";_expand_toc(A.parentNode)}}}function _expand_toc(A){if(A.style.display!="none"){return }var B=A.id.substr(1);t("d"+B,"p"+B);if(document.getElementById("p"+B)){unhighlight(document.getElementById("p"+B))}_expand_toc(A.parentNode)}function highlightScripture(E,B,I,C,L){if(isNaN(B)){B=0}if(isNaN(I)){I=0}if(isNaN(C)){C=B}if(isNaN(L)){L=I}var K=document.links;var O=true;for(var J=0;J<K.length;J++){if(K[J].name){var N=K[J].name.split(";");for(var H=0;H<N.length;H++){if(N[H].length<1){break}var M=N[H].toLowerCase().split("_");for(var G=2;G<M.length;G++){M[G]=parseInt(M[G])}if(!M[4]||M[4]==0){M[4]=M[2]}if(!M[5]||M[5]==0){M[5]=M[3]}if(E.toLowerCase()==M[1]&&(B==0||(B>=M[2]&&C<=M[4]))&&(I==0||((B!=M[2]||I<=M[3])&&(C!=M[4]||L>=M[5])))){K[J].className="scrRefHighlight";K[J].style.backgroundColor="red";K[J].style.color="white";if(O){insertAnchorAt(K[J]);O=false}}}}}E=E.replace(/1/,"i").replace(/2/,"ii").replace(/3/,"iii").replace(/4/,"iv");var P=E+"."+B+"."+I;var D=E+"."+C+"."+(L+1);var A=document.getElementById(P);if(A){insertAnchorAt(A);var F=document.getElementById(D);if(!F){F=document.getElementById("noteBottom");if(!F){F=document.getElementById("book_navbar_bottom")}}highlightUp(A.parentNode,A,F,null)}}function highlightUp(E,C,A,D){if(!E){return false}if(E==A){return true}var B;for(B=0;E.childNodes[B]!=C;B++){}for(B++;B<E.childNodes.length;B++){if(highlightDown(E.childNodes[B],A,D)==-1){return true}}return highlightUp(E.parentNode,E,A,D)}function highlightDown(E,A,D){if(!E){return false}if(E.nodeValue){if(D){return textHighlightNode(E,D)}return scriptureHighlightNode(E)}if(E==A){return -1}var B;for(var C=0;C<E.childNodes.length;C++){B=highlightDown(E.childNodes[C],A,D);C+=B;if(B==-1){return -1}}return 0}function scriptureHighlightNode(A){var C=document.createElement("span");var B=document.createTextNode(A.nodeValue);C.appendChild(B);C.style.backgroundColor="#fff3b0";A.parentNode.replaceChild(C,A);return 0}function textHighlightNode(F,H){var D=F.nodeValue.replace(/[\n\r]/g," ");var B=D.toLowerCase().indexOf(H);if(B!=-1&&(B==0||" \t\b\"'\n\r".indexOf(D.charAt(B-1))!=-1)){var E=document.createTextNode(D.substring(0,B));var A=document.createElement("span");A.id="searchHighlight";A.style.backgroundColor="yellow";var C=document.createTextNode(D.substring(B,B+H.length));A.appendChild(C);var G=document.createTextNode(D.substring(B+H.length));F.parentNode.insertBefore(E,F);F.parentNode.insertBefore(A,F);F.parentNode.replaceChild(G,F);return 1}return 0}function debug(B){var A;for(A=0;A+1000<B.length;A+=1000){alert(B.substring(A,A+1000))}alert(B.substring(A))}function highlightSearch(){info=getBookInfoFromUrl();return highlightSearchTerms(info[0],info[1],info[2],info[3])}function getBookInfoFromUrl(){var D=document.location.href;var C=D.indexOf("?");var F="";var B="",E="",A="";if(C!=-1){D=D.substring(C+1);C=D.indexOf("#");if(C!=-1){D=D.substring(0,C)}D+="&";C=D.indexOf("highlight=");if(C!=-1){var H=D.indexOf("&",C);F=D.substring(C+10,H)}C=D.indexOf("scrBook=");if(C!=-1){var H=D.indexOf("&",C);B=D.substring(C+8,H);C=D.indexOf("scrCh=");if(C!=-1){H=D.indexOf("&",C);E=D.substring(C+6,H);C=D.indexOf("scrV=");if(C!=-1){H=D.indexOf("&",C);A=D.substring(C+5,H)}}}}if(!B&&window.location.hash.length>0){var G=window.location.hash.split(/\./);if(G.length==3){B=G[0].substring(1);E=G[1];A=G[2]}}return new Array(F,B,E,A)}function highlightSearchTerms(M,G,C,D){if(!M&&!G&&!C&&!D){return true}if(!document.body||typeof (document.body.innerHTML)=="undefined"){return false}if(G){var J=G.split(",");var H=C.split(",");var N=D.split(",");for(var K=0;K<J.length;K++){var A=H[K].split("-");var L=N[K].split("-");highlightScripture(J[K],parseInt(A[0]),parseInt(L[0]),A[1]?parseInt(A[1]):NaN,L[1]?parseInt(L[1]):NaN)}}if(M){M=decodeURI(M);searchArray=M.split(",");var B=document.getElementById("book_navbar_top");var F=document.getElementById("book_navbar_bottom");var E="yellow";for(var K=0;K<searchArray.length;K++){if(searchArray[K].length>0&&B){highlightUp(B.parentNode,B,F,searchArray[K])}}var I=document.getElementById("searchHighlight");if(I){insertAnchorAt(I)}}if(!window.location.hash||window.location.hash.length<1){window.location.hash="#highlight"}else{if(window.location.hash!=""){window.location.hash=window.location.hash}}return true}function insertAnchorAt(B){var C=document.createElement("A");C.href="#highlight";C.id="highlight";C.name="highlight";var A=getLinkNodeIsIn(B);if(A){B=A}B.parentNode.insertBefore(C,B)}function getLinkNodeIsIn(A){while(A&&A.className&&A.className!="a"&&A.className!="A"){A=A.parentNode}return A}var noteObj=null;var noteDiv=null;var editorOpen=false;var editID;var OnInsert="submitNote( document.getElementById('note').value )";var OnEdit="updateNote( document.getElementById('note').value, EditID )";var verseURL="/cgi-bin/verse.cgi";var req=null;var reqTimer=null;var popupTimer=null;var hideTimer=null;var requestedVerse="";var verseObj=null;var popupDiv=null;var gotFullText=false;var popupCache=null;function requestVerse(B){var A=loadFromCache(B);if(A!=null){popupDiv.innerHTML=A;gotFullText=true}else{popupDiv.innerHTML=buildPopup("<b>Please wait</b>","Looking up verse...");if(preferences["popup"]){requestURL=verseURL+"?passage="+B+"&translation="+preferences["popup"]}else{requestURL=verseURL+"?passage="+B}req=newXHR();req.onreadystatechange=xhrStateChange;req.open("GET",requestURL,true);req.send(null)}}function xhrStateChange(){if(req.readyState==4){if(req.status==200){var A=parseXML(req.responseXML);popupDiv.innerHTML=A;saveToCache(requestedVerse,A)}else{popupDiv.innerHTML=buildPopup("<b>Error</b>","An error has occured (status "+req.status+")")}gotFullText=true;positionPopup(verseObj,popupDiv);document.getElementById("boxTop").style.cursor="default";req=null}}function loadFromCache(A){if(popupCache==null){return null}else{return popupCache[A]}}function saveToCache(A,B){if(popupCache==null){popupCache=new Array()}popupCache[A]=B}function createPopupDiv(){if(popupDiv==null){popupDiv=document.createElement("div");popupDiv.style.visibility="hidden";popupDiv.style.position="absolute";popupDiv.innerHTML=buildPopup("<b>Please wait</b>","Looking up verse...");popupDiv.onmouseover=retainPopup;popupDiv.onmouseout=leaveVerse;document.body.appendChild(popupDiv)}}function buildPopup(B,A){html="<div class=\"boxPopup\">";html+="<div class=\"boxBottom\">";html+="<div id=\"boxTop\"><div class=\"boxTitle\">"+B+"</div></div>";html+="<div class=\"boxMiddle\">";html+="<div class=\"boxContent\">"+A;html+="</div></div></div></div>";return html}function parseXML(B){var C,A;C=unescape(B.getElementsByTagName("title")[0].firstChild.nodeValue);A="";bodyNodes=B.getElementsByTagName("body")[0].childNodes;for(i=0;i<bodyNodes.length;i++){A+=unescape(bodyNodes[i].nodeValue)}return buildPopup(C,A)}function popupVerse(A,B){if(preferences["popup"]!=""){createPopupDiv();resetHideTimer();if(B!=requestedVerse){hideVerse();verseObj=A;requestedVerse=B;resetPopupTimer();popupTimer=setTimeout(onPopupTimer,500);resetReqTimer();reqTimer=setTimeout(onReqTimer,100)}}}function leaveVerse(){if(popupTimer!=null||!gotFullText){resetReqTimer();resetPopupTimer();hideVerse()}else{resetHideTimer();hideTimer=setTimeout(onHideTimer,100)}if(req!=null){req.onreadystatechange=function(){};req.abort();req=null}}function retainPopup(){resetHideTimer()}function hideVerse(){if(popupDiv!=null){popupDiv.style.visibility="hidden";requestedVerse="";gotFullText=false}}function onReqTimer(){reqTimer=null;requestVerse(requestedVerse)}function onPopupTimer(){popupTimer=null;positionPopup(verseObj,popupDiv);popupDiv.style.visibility="visible"}function onHideTimer(){hideTimer=null;hideVerse()}function resetReqTimer(){if(reqTimer!=null){clearTimeout(reqTimer)}reqTimer=null}function resetPopupTimer(){if(popupTimer!=null){clearTimeout(popupTimer)}popupTimer=null}function resetHideTimer(){if(hideTimer!=null){clearTimeout(hideTimer)}hideTimer=null}function newXHR(){if(window.XMLHttpRequest){return new XMLHttpRequest()}else{if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}}}function findPos(A){var B=curtop=0;if(A.offsetParent){B=A.offsetLeft;curtop=A.offsetTop;while(A=A.offsetParent){B+=A.offsetLeft;curtop+=A.offsetTop}}return[B,curtop]}function positionPopup(O,M){var K,G,H,A,C,B;var L=M.offsetHeight;var N=M.offsetWidth;var F=findPos(O);var J=F[0];var E=F[1];var D=O.offsetWidth;var I=O.offsetHeight;if(document.documentElement.clientHeight!=0){K=document.documentElement.scrollLeft;G=document.documentElement.scrollTop;H=document.documentElement.clientWidth;A=document.documentElement.clientHeight}else{if(document.body.clientHeight!=0){K=document.body.scrollLeft;G=document.body.scrollTop;H=document.body.clientWidth;A=document.body.clientHeight}else{if(window.innerHeight!=0){K=window.pageXOffset;G=window.pageYOffset;H=window.innerWidth;A=window.innerHeight}else{M.style.left="0px";M.style.top="0px";return }}}if(E-G>A/2){B=E-L}else{B=E+I}C=K+J+D/2-N/2;C=Math.min(K+H-N-8,C);C=Math.max(K+8,C);B=Math.min(G+A-L,B);B=Math.max(G+8,B);M.style.left=C+"px";M.style.top=B+"px"}function requestNote(B,D){var A="op=reqnote&id="+D;popupDiv.innerHTML=buildPopup("<b>Please wait</b>","Loading note...");var C=newXHR();C.onreadystatechange=function(){if(C.readyState==4&&C.status==200){popupDiv.innerHTML=parseXMLNote(C.responseXML);gotFullText=true;positionPopup(B.parentNode,popupDiv);document.getElementById("boxTop").style.cursor="default"}};C.open("POST",SCRIPT_PATH,true);C.setRequestHeader("Content-Type","application/x-www-form-urlencoded");C.send(A)}function createPopupNoteDiv(){if(noteDiv==null){noteDiv=document.createElement("div");noteDiv.style.visibility="hidden";noteDiv.style.position="absolute";noteDiv.innerHTML=buildPopup("<b>Create Note</b>","blah");document.body.appendChild(noteDiv)}}function buildNote(B){var A="<p id=\"pNote\">"+B+"</p><br />";A+="<div class=\"noteButtons\"><button class=\"b1\" onclick=\"editNote("+requestedVerse+");\">Edit</button><button class=\"b2\" onclick=\"deleteNote("+requestedVerse+");\">Delete</button></div>";return A}function buildNoteEditor(B,C){var A="<textarea id=\"note\" rows=\"5\" style=\"width: 100%\">"+C+"</textarea>";A+="<br /><br />";A+="<div class=\"noteButtons\"><button class=\"b1\" onclick=\""+B+";\">Submit</button><button class=\"b2\" onclick=\"closeEditor();\">Cancel</button></div>";return A}function editNote(A){EditID=A;popupNoteEditor(verseObj,OnEdit,getTextContent(document.getElementById("pNote")));leaveVerse()}function deleteNote(A){deleteAnnotation(A);leaveVerse();refreshPage()}function parseXMLNote(A){var B=A.getElementsByTagName("text")[0].firstChild.nodeValue;B=B.replace(/%26/g,"&");B=B.replace(/\n/g,"<br />");NoteID=A.getElementsByTagName("id")[0].firstChild.nodeValue;NoteOffset=A.getElementsByTagName("offset")[0].firstChild.nodeValue;return buildPopup("<b>Note</b>",buildNote(B))}function popupNote(A,B){createPopupDiv();resetHideTimer();if(B!=requestedVerse){hideVerse();verseObj=A;requestedVerse=B;resetPopupTimer();popupTimer=setTimeout(onPopupTimer,500);resetReqTimer();reqTimer=setTimeout(onReqTimerNote,100)}}function popupNoteEditor(B,C,E){noteObj=B;createPopupNoteDiv();if(editorOpen){var A=document.getElementById("note");A.focus();flashTextArea(A,"yellow",250,4)}else{noteDiv.innerHTML=buildPopup("<b>Create Note</b>",buildNoteEditor(C,E));positionPopup(noteObj,noteDiv);noteDiv.style.visibility="visible";var D=new YAHOO.util.DD(noteDiv);D.setHandleElId("boxTop");editorOpen=true;document.getElementById("boxTop").style.cursor="move";document.getElementById("note").focus()}}function flashTextArea(C,B,D,A){if(A>0){C.style.backgroundColor=(A%2==0)?B:"white";var E=setTimeout(function(){flashTextArea(C,B,D,A-1)},D)}}function closeEditor(){noteDiv.style.visibility="hidden";editorOpen=false}function onReqTimerNote(){reqTimer=null;requestNote(verseObj,requestedVerse)}var queue=new Array();var xlinkCache=new Array();xhr=null;function processXLinks(){var B=document.getElementsByTagName("div");var A;for(A=0;A<B.length;A++){var C=B[A];if(C.attributes.length>0&&C.attributes["xhref"]){queue.push(C);C.innerHTML="<i>Loading page...</i>"}}doNextDiv()}function doNextDiv(){if(queue.length>0){var A=queue[queue.length-1].attributes["xhref"].nodeValue;if(!xlinkCache[A]){xhr=newXHR();xhr.onreadystatechange=stateChange;xhr.open("GET",A,true);xhr.send(null)}else{var B=queue.pop();B.innerHTML=xlinkCache[A];doNextDiv()}}else{removeLeadingSpaces();annotateText();highlightSearch()}}function stateChange(){if(xhr.readyState==4){if(xhr.status==200){var C=queue.pop();var B=xhr.responseText;C.innerHTML=B;var A=C.attributes["xhref"].nodeValue;xlinkCache[A]=B}doNextDiv()}}function parseChapter(B){var A="";var C=B.getElementsByTagName("body")[0].childNodes;for(i=0;i<C.length;i++){A+=unescape(C[i].nodeValue)}return A}if(typeof YAHOO=="undefined"){var YAHOO={}}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]]}}return E};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C)}else{return false}};YAHOO.init=function(){this.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break}}if(D){A.push(B)}}}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]}}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B)}if(E){E.VERSION=H;E.BUILD=G}else{YAHOO.log("mainClass is undefined for module "+A,"warn")}};YAHOO.env=YAHOO.env||{modules:[],listeners:[],getVersion:function(A){return YAHOO.env.modules[A]||null}};YAHOO.lang={isArray:function(A){if(A&&A.constructor&&A.constructor.toString().indexOf("Array")>-1){return true}else{return YAHOO.lang.isObject(A)&&A.constructor==Array}},isBoolean:function(A){return typeof A=="boolean"},isFunction:function(A){return typeof A=="function"},isNull:function(A){return A===null},isNumber:function(A){return typeof A=="number"&&isFinite(A)},isObject:function(A){return A&&(typeof A=="object"||YAHOO.lang.isFunction(A))},isString:function(A){return typeof A=="string"},isUndefined:function(A){return typeof A=="undefined"},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B)}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B]},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.")}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E}if(C){for(var A in C){D.prototype[A]=C[A]}}},augment:function(E,D){if(!D||!E){throw new Error("YAHOO.lang.augment failed, please check that all dependencies are included.")}var C=E.prototype,F=D.prototype,A=arguments,B,G;if(A[2]){for(B=2;B<A.length;B=B+1){C[A[B]]=F[A[B]]}}else{for(G in F){if(!C[G]){C[G]=F[G]}}}}};YAHOO.init();YAHOO.util.Lang=YAHOO.lang;YAHOO.augment=YAHOO.lang.augment;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.2.2",build:"204"});if(typeof YAHOO=="undefined"){var YAHOO={}}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]]}}return E};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C)}else{return false}};YAHOO.init=function(){this.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break}}if(D){A.push(B)}}}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]}}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B)}if(E){E.VERSION=H;E.BUILD=G}else{YAHOO.log("mainClass is undefined for module "+A,"warn")}};YAHOO.env=YAHOO.env||{modules:[],listeners:[],getVersion:function(A){return YAHOO.env.modules[A]||null}};YAHOO.lang={isArray:function(A){if(A&&A.constructor&&A.constructor.toString().indexOf("Array")>-1){return true}else{return YAHOO.lang.isObject(A)&&A.constructor==Array}},isBoolean:function(A){return typeof A=="boolean"},isFunction:function(A){return typeof A=="function"},isNull:function(A){return A===null},isNumber:function(A){return typeof A=="number"&&isFinite(A)},isObject:function(A){return A&&(typeof A=="object"||YAHOO.lang.isFunction(A))},isString:function(A){return typeof A=="string"},isUndefined:function(A){return typeof A=="undefined"},hasOwnProperty:function(A,B){if(Object.prototype.hasOwnProperty){return A.hasOwnProperty(B)}return !YAHOO.lang.isUndefined(A[B])&&A.constructor.prototype[B]!==A[B]},extend:function(D,E,C){if(!E||!D){throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.")}var B=function(){};B.prototype=E.prototype;D.prototype=new B();D.prototype.constructor=D;D.superclass=E.prototype;if(E.prototype.constructor==Object.prototype.constructor){E.prototype.constructor=E}if(C){for(var A in C){D.prototype[A]=C[A]}}},augment:function(E,D){if(!D||!E){throw new Error("YAHOO.lang.augment failed, please check that all dependencies are included.")}var C=E.prototype,F=D.prototype,A=arguments,B,G;if(A[2]){for(B=2;B<A.length;B=B+1){C[A[B]]=F[A[B]]}}else{for(G in F){if(!C[G]){C[G]=F[G]}}}}};YAHOO.init();YAHOO.util.Lang=YAHOO.lang;YAHOO.augment=YAHOO.lang.augment;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.2.2",build:"204"});(function(){var C=YAHOO.util,J,H,G=0,I={};var B=navigator.userAgent.toLowerCase(),D=(B.indexOf("opera")>-1),K=(B.indexOf("safari")>-1),A=(!D&&!K&&B.indexOf("gecko")>-1),F=(!D&&B.indexOf("msie")>-1);var E={HYPHEN:/(-[a-z])/i,ROOT_TAG:/body|html/i};var L=function(M){if(!E.HYPHEN.test(M)){return M}if(I[M]){return I[M]}var N=M;while(E.HYPHEN.exec(N)){N=N.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase())}I[M]=N;return N};if(document.defaultView&&document.defaultView.getComputedStyle){J=function(M,P){var O=null;if(P=="float"){P="cssFloat"}var N=document.defaultView.getComputedStyle(M,"");if(N){O=N[L(P)]}return M.style[P]||O}}else{if(document.documentElement.currentStyle&&F){J=function(M,O){switch(L(O)){case"opacity":var Q=100;try{Q=M.filters["DXImageTransform.Microsoft.Alpha"].opacity}catch(P){try{Q=M.filters("alpha").opacity}catch(P){}}return Q/100;break;case"float":O="styleFloat";default:var N=M.currentStyle?M.currentStyle[O]:null;return(M.style[O]||N)}}}else{J=function(M,N){return M.style[N]}}}if(F){H=function(M,N,O){switch(N){case"opacity":if(YAHOO.lang.isString(M.style.filter)){M.style.filter="alpha(opacity="+O*100+")";if(!M.currentStyle||!M.currentStyle.hasLayout){M.style.zoom=1}}break;case"float":N="styleFloat";default:M.style[N]=O}}}else{H=function(M,N,O){if(N=="float"){N="cssFloat"}M.style[N]=O}}YAHOO.util.Dom={get:function(O){if(YAHOO.lang.isString(O)){return document.getElementById(O)}if(YAHOO.lang.isArray(O)){var P=[];for(var N=0,M=O.length;N<M;++N){P[P.length]=C.Dom.get(O[N])}return P}if(O){return O}return null},getStyle:function(M,O){O=L(O);var N=function(P){return J(P,O)};return C.Dom.batch(M,N,C.Dom,true)},setStyle:function(M,O,P){O=L(O);var N=function(Q){H(Q,O,P)};C.Dom.batch(M,N,C.Dom,true)},getXY:function(M){var N=function(P){if((P.parentNode===null||P.offsetParent===null||this.getStyle(P,"display")=="none")&&P!=document.body){return false}var O=null;var V=[];var Q;if(P.getBoundingClientRect){Q=P.getBoundingClientRect();var S=document;if(!this.inDocument(P)&&parent.document!=document){S=parent.document;if(!this.isAncestor(S.documentElement,P)){return false}}var R=Math.max(S.documentElement.scrollTop,S.body.scrollTop);var T=Math.max(S.documentElement.scrollLeft,S.body.scrollLeft);return[Q.left+T,Q.top+R]}else{V=[P.offsetLeft,P.offsetTop];O=P.offsetParent;var U=this.getStyle(P,"position")=="absolute";if(O!=P){while(O){V[0]+=O.offsetLeft;V[1]+=O.offsetTop;if(K&&!U&&this.getStyle(O,"position")=="absolute"){U=true}O=O.offsetParent}}if(K&&U){V[0]-=document.body.offsetLeft;V[1]-=document.body.offsetTop}}O=P.parentNode;while(O.tagName&&!E.ROOT_TAG.test(O.tagName)){if(C.Dom.getStyle(O,"display")!="inline"){V[0]-=O.scrollLeft;V[1]-=O.scrollTop}O=O.parentNode}return V};return C.Dom.batch(M,N,C.Dom,true)},getX:function(M){var N=function(O){return C.Dom.getXY(O)[0]};return C.Dom.batch(M,N,C.Dom,true)},getY:function(M){var N=function(O){return C.Dom.getXY(O)[1]};return C.Dom.batch(M,N,C.Dom,true)},setXY:function(M,P,O){var N=function(S){var R=this.getStyle(S,"position");if(R=="static"){this.setStyle(S,"position","relative");R="relative"}var U=this.getXY(S);if(U===false){return false}var T=[parseInt(this.getStyle(S,"left"),10),parseInt(this.getStyle(S,"top"),10)];if(isNaN(T[0])){T[0]=(R=="relative")?0:S.offsetLeft}if(isNaN(T[1])){T[1]=(R=="relative")?0:S.offsetTop}if(P[0]!==null){S.style.left=P[0]-U[0]+T[0]+"px"}if(P[1]!==null){S.style.top=P[1]-U[1]+T[1]+"px"}if(!O){var Q=this.getXY(S);if((P[0]!==null&&Q[0]!=P[0])||(P[1]!==null&&Q[1]!=P[1])){this.setXY(S,P,true)}}};C.Dom.batch(M,N,C.Dom,true)},setX:function(N,M){C.Dom.setXY(N,[M,null])},setY:function(M,N){C.Dom.setXY(M,[null,N])},getRegion:function(M){var N=function(O){var P=new C.Region.getRegion(O);return P};return C.Dom.batch(M,N,C.Dom,true)},getClientWidth:function(){return C.Dom.getViewportWidth()},getClientHeight:function(){return C.Dom.getViewportHeight()},getElementsByClassName:function(O,M,N){var P=function(Q){return C.Dom.hasClass(Q,O)};return C.Dom.getElementsBy(P,M,N)},hasClass:function(O,N){var M=new RegExp("(?:^|\\s+)"+N+"(?:\\s+|$)");var P=function(Q){return M.test(Q.className)};return C.Dom.batch(O,P,C.Dom,true)},addClass:function(N,M){var O=function(P){if(this.hasClass(P,M)){return }P.className=[P.className,M].join(" ")};C.Dom.batch(N,O,C.Dom,true)},removeClass:function(O,N){var M=new RegExp("(?:^|\\s+)"+N+"(?:\\s+|$)","g");var P=function(Q){if(!this.hasClass(Q,N)){return }var R=Q.className;Q.className=R.replace(M," ");if(this.hasClass(Q,N)){this.removeClass(Q,N)}};C.Dom.batch(O,P,C.Dom,true)},replaceClass:function(P,N,M){if(N===M){return false}var O=new RegExp("(?:^|\\s+)"+N+"(?:\\s+|$)","g");var Q=function(R){if(!this.hasClass(R,N)){this.addClass(R,M);return }R.className=R.className.replace(O," "+M+" ");if(this.hasClass(R,N)){this.replaceClass(R,N,M)}};C.Dom.batch(P,Q,C.Dom,true)},generateId:function(M,O){O=O||"yui-gen";M=M||{};var N=function(P){if(P){P=C.Dom.get(P)}else{P={}}if(!P.id){P.id=O+G++}return P.id};return C.Dom.batch(M,N,C.Dom,true)},isAncestor:function(N,O){N=C.Dom.get(N);if(!N||!O){return false}var M=function(Q){if(N.contains&&!K){return N.contains(Q)}else{if(N.compareDocumentPosition){return !!(N.compareDocumentPosition(Q)&16)}else{var P=Q.parentNode;while(P){if(P==N){return true}else{if(!P.tagName||P.tagName.toUpperCase()=="HTML"){return false}}P=P.parentNode}return false}}};return C.Dom.batch(O,M,C.Dom,true)},inDocument:function(M){var N=function(O){return this.isAncestor(document.documentElement,O)};return C.Dom.batch(M,N,C.Dom,true)},getElementsBy:function(S,N,O){N=N||"*";var P=[];if(O){O=C.Dom.get(O);if(!O){return P}}else{O=document}var R=O.getElementsByTagName(N);if(!R.length&&(N=="*"&&O.all)){R=O.all}for(var Q=0,M=R.length;Q<M;++Q){if(S(R[Q])){P[P.length]=R[Q]}}return P},batch:function(Q,M,P,O){var N=Q;Q=C.Dom.get(Q);var U=(O)?P:window;if(!Q||Q.tagName||!Q.length){if(!Q){return false}return M.call(U,Q,P)}var S=[];for(var R=0,T=Q.length;R<T;++R){if(!Q[R]){N=Q[R]}S[S.length]=M.call(U,Q[R],P)}return S},getDocumentHeight:function(){var N=(document.compatMode!="CSS1Compat")?document.body.scrollHeight:document.documentElement.scrollHeight;var M=Math.max(N,C.Dom.getViewportHeight());return M},getDocumentWidth:function(){var N=(document.compatMode!="CSS1Compat")?document.body.scrollWidth:document.documentElement.scrollWidth;var M=Math.max(N,C.Dom.getViewportWidth());return M},getViewportHeight:function(){var M=self.innerHeight;var N=document.compatMode;if((N||F)&&!D){M=(N=="CSS1Compat")?document.documentElement.clientHeight:document.body.clientHeight}return M},getViewportWidth:function(){var M=self.innerWidth;var N=document.compatMode;if(N||F){M=(N=="CSS1Compat")?document.documentElement.clientWidth:document.body.clientWidth}return M}}})();YAHOO.util.Region=function(C,D,A,B){this.top=C;this[1]=C;this.right=D;this.bottom=A;this.left=B;this[0]=B};YAHOO.util.Region.prototype.contains=function(A){return(A.left>=this.left&&A.right<=this.right&&A.top>=this.top&&A.bottom<=this.bottom)};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left))};YAHOO.util.Region.prototype.intersect=function(E){var C=Math.max(this.top,E.top);var D=Math.min(this.right,E.right);var A=Math.min(this.bottom,E.bottom);var B=Math.max(this.left,E.left);if(A>=C&&D>=B){return new YAHOO.util.Region(C,D,A,B)}else{return null}};YAHOO.util.Region.prototype.union=function(E){var C=Math.min(this.top,E.top);var D=Math.max(this.right,E.right);var A=Math.max(this.bottom,E.bottom);var B=Math.min(this.left,E.left);return new YAHOO.util.Region(C,D,A,B)};YAHOO.util.Region.prototype.toString=function(){return("Region {top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}")};YAHOO.util.Region.getRegion=function(D){var F=YAHOO.util.Dom.getXY(D);var C=F[1];var E=F[0]+D.offsetWidth;var A=F[1]+D.offsetHeight;var B=F[0];return new YAHOO.util.Region(C,E,A,B)};YAHOO.util.Point=function(A,B){if(A instanceof Array){B=A[1];A=A[0]}this.x=this.right=this.left=this[0]=A;this.y=this.top=this.bottom=this[1]=B};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.2.2",build:"204"});YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true)}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'")}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A)}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A))},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll()}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true}}return E},fire:function(){var A=this.subscribers.length;if(!A&&this.silent){return true}var C=[],B=true,D;for(D=0;D<arguments.length;++D){C.push(arguments[D])}var G=C.length;if(!this.silent){}for(D=0;D<A;++D){var F=this.subscribers[D];if(F){if(!this.silent){}var E=F.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var H=null;if(C.length>0){H=C[0]}B=F.fn.call(E,H,F.obj)}else{B=F.fn.call(E,this.type,C,F.obj)}if(false===B){if(!this.silent){}return false}}}return true},unsubscribeAll:function(){for(var B=0,A=this.subscribers.length;B<A;++B){this._delete(A-1-B)}return B},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj}this.subscribers.splice(A,1)},toString:function(){return"CustomEvent: '"+this.type+"', scope: "+this.scope}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=C||null;this.override=A};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj}else{return this.override}}return A};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B)}else{return(this.fn==A)}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+(this.obj||"")+", override: "+(this.override||"no")+" }"};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var J=false;var I=[];var K=[];var F=[];var D=[];var C=0;var E=[];var B=[];var A=0;var G=null;return{POLL_RETRYS:200,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,isSafari:(/KHTML/gi).test(navigator.userAgent),webkit:function(){var L=navigator.userAgent.match(/AppleWebKit\/([^ ]*)/);if(L&&L[1]){return L[1]}return null}(),isIE:(!this.webkit&&!navigator.userAgent.match(/opera/gi)&&navigator.userAgent.match(/msie/gi)),_interval:null,startInterval:function(){if(!this._interval){var L=this;var M=function(){L._tryPreloadAttach()};this._interval=setInterval(M,this.POLL_INTERVAL)}},onAvailable:function(N,L,O,M){E.push({id:N,fn:L,obj:O,override:M,checkReady:false});C=this.POLL_RETRYS;this.startInterval()},onDOMReady:function(L,N,M){this.DOMReadyEvent.subscribe(L,N,M)},onContentReady:function(N,L,O,M){E.push({id:N,fn:L,obj:O,override:M,checkReady:true});C=this.POLL_RETRYS;this.startInterval()},addListener:function(N,L,W,R,M){if(!W||!W.call){return false}if(this._isValidCollection(N)){var X=true;for(var S=0,U=N.length;S<U;++S){X=this.on(N[S],L,W,R,M)&&X}return X}else{if(typeof N=="string"){var Q=this.getEl(N);if(Q){N=Q}else{this.onAvailable(N,function(){YAHOO.util.Event.on(N,L,W,R,M)});return true}}}if(!N){return false}if("unload"==L&&R!==this){K[K.length]=[N,L,W,R,M];return true}var Z=N;if(M){if(M===true){Z=R}else{Z=M}}var O=function(a){return W.call(Z,YAHOO.util.Event.getEvent(a),R)};var Y=[N,L,W,O,Z];var T=I.length;I[T]=Y;if(this.useLegacyEvent(N,L)){var P=this.getLegacyIndex(N,L);if(P==-1||N!=F[P][0]){P=F.length;B[N.id+L]=P;F[P]=[N,L,N["on"+L]];D[P]=[];N["on"+L]=function(a){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(a),P)}}D[P].push(Y)}else{try{this._simpleAdd(N,L,O,false)}catch(V){this.lastError=V;this.removeListener(N,L,W);return false}}return true},fireLegacyEvent:function(P,N){var R=true,L,T,S,U,Q;T=D[N];for(var M=0,O=T.length;M<O;++M){S=T[M];if(S&&S[this.WFN]){U=S[this.ADJ_SCOPE];Q=S[this.WFN].call(U,P);R=(R&&Q)}}L=F[N];if(L&&L[2]){L[2](P)}return R},getLegacyIndex:function(M,N){var L=this.generateId(M)+N;if(typeof B[L]=="undefined"){return -1}else{return B[L]}},useLegacyEvent:function(M,N){if(this.webkit&&("click"==N||"dblclick"==N)){var L=parseInt(this.webkit,10);if(!isNaN(L)&&L<418){return true}}return false},removeListener:function(M,L,U){var P,S;if(typeof M=="string"){M=this.getEl(M)}else{if(this._isValidCollection(M)){var V=true;for(P=0,S=M.length;P<S;++P){V=(this.removeListener(M[P],L,U)&&V)}return V}}if(!U||!U.call){return this.purgeElement(M,false,L)}if("unload"==L){for(P=0,S=K.length;P<S;P++){var W=K[P];if(W&&W[0]==M&&W[1]==L&&W[2]==U){K.splice(P,1);return true}}return false}var Q=null;var R=arguments[3];if("undefined"==typeof R){R=this._getCacheIndex(M,L,U)}if(R>=0){Q=I[R]}if(!M||!Q){return false}if(this.useLegacyEvent(M,L)){var O=this.getLegacyIndex(M,L);var N=D[O];if(N){for(P=0,S=N.length;P<S;++P){W=N[P];if(W&&W[this.EL]==M&&W[this.TYPE]==L&&W[this.FN]==U){N.splice(P,1);break}}}}else{try{this._simpleRemove(M,L,Q[this.WFN],false)}catch(T){this.lastError=T;return false}}delete I[R][this.WFN];delete I[R][this.FN];I.splice(R,1);return true},getTarget:function(N,M){var L=N.target||N.srcElement;return this.resolveTextNode(L)},resolveTextNode:function(L){if(L&&3==L.nodeType){return L.parentNode}else{return L}},getPageX:function(M){var L=M.pageX;if(!L&&0!==L){L=M.clientX||0;if(this.isIE){L+=this._getScrollLeft()}}return L},getPageY:function(L){var M=L.pageY;if(!M&&0!==M){M=L.clientY||0;if(this.isIE){M+=this._getScrollTop()}}return M},getXY:function(L){return[this.getPageX(L),this.getPageY(L)]},getRelatedTarget:function(M){var L=M.relatedTarget;if(!L){if(M.type=="mouseout"){L=M.toElement}else{if(M.type=="mouseover"){L=M.fromElement}}}return this.resolveTextNode(L)},getTime:function(N){if(!N.time){var M=new Date().getTime();try{N.time=M}catch(L){this.lastError=L;return M}}return N.time},stopEvent:function(L){this.stopPropagation(L);this.preventDefault(L)},stopPropagation:function(L){if(L.stopPropagation){L.stopPropagation()}else{L.cancelBubble=true}},preventDefault:function(L){if(L.preventDefault){L.preventDefault()}else{L.returnValue=false}},getEvent:function(M){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break}N=N.caller}}return L},getCharCode:function(L){return L.charCode||L.keyCode||0},_getCacheIndex:function(P,Q,O){for(var N=0,M=I.length;N<M;++N){var L=I[N];if(L&&L[this.FN]==O&&L[this.EL]==P&&L[this.TYPE]==Q){return N}}return -1},generateId:function(L){var M=L.id;if(!M){M="yuievtautoid-"+A;++A;L.id=M}return M},_isValidCollection:function(L){return(L&&L.length&&typeof L!="string"&&!L.tagName&&!L.alert&&typeof L[0]!="undefined")},elCache:{},getEl:function(L){return document.getElementById(L)},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(M){if(!H){H=true;var L=YAHOO.util.Event;L._ready();if(this.isIE){L._simpleRemove(window,"load",L._load)}}},_ready:function(M){if(!J){J=true;var L=YAHOO.util.Event;L.DOMReadyEvent.fire();L._simpleRemove(document,"DOMContentLoaded",L._ready)}},_tryPreloadAttach:function(){if(this.locked){return false}if(this.isIE&&!J){return false}this.locked=true;var Q=!H;if(!Q){Q=(C>0)}var P=[];var R=function(T,U){var S=T;if(U.override){if(U.override===true){S=U.obj}else{S=U.override}}U.fn.call(S,U.obj)};var M,L,O,N;for(M=0,L=E.length;M<L;++M){O=E[M];if(O&&!O.checkReady){N=this.getEl(O.id);if(N){R(N,O);E[M]=null}else{P.push(O)}}}for(M=0,L=E.length;M<L;++M){O=E[M];if(O&&O.checkReady){N=this.getEl(O.id);if(N){if(H||N.nextSibling){R(N,O);E[M]=null}}else{P.push(O)}}}C=(P.length===0)?0:C-1;if(Q){this.startInterval()}else{clearInterval(this._interval);this._interval=null}this.locked=false;return true},purgeElement:function(O,P,R){var Q=this.getListeners(O,R);if(Q){for(var N=0,L=Q.length;N<L;++N){var M=Q[N];this.removeListener(O,M.type,M.fn)}}if(P&&O&&O.childNodes){for(N=0,L=O.childNodes.length;N<L;++N){this.purgeElement(O.childNodes[N],P,R)}}},getListeners:function(N,L){var Q=[],M;if(!L){M=[I,K]}else{if(L=="unload"){M=[K]}else{M=[I]}}for(var P=0;P<M.length;++P){var T=M[P];if(T&&T.length>0){for(var R=0,S=T.length;R<S;++R){var O=T[R];if(O&&O[this.EL]===N&&(!L||L===O[this.TYPE])){Q.push({type:O[this.TYPE],fn:O[this.FN],obj:O[this.OBJ],adjust:O[this.ADJ_SCOPE],index:R})}}}}return(Q.length)?Q:null},_unload:function(S){var R=YAHOO.util.Event,P,O,M,L,N;for(P=0,L=K.length;P<L;++P){M=K[P];if(M){var Q=window;if(M[R.ADJ_SCOPE]){if(M[R.ADJ_SCOPE]===true){Q=M[R.OBJ]}else{Q=M[R.ADJ_SCOPE]}}M[R.FN].call(Q,R.getEvent(S),M[R.OBJ]);K[P]=null;M=null;Q=null}}K=null;if(I&&I.length>0){O=I.length;while(O){N=O-1;M=I[N];if(M){R.removeListener(M[R.EL],M[R.TYPE],M[R.FN],N)}O=O-1}M=null;R.clearCache()}for(P=0,L=F.length;P<L;++P){F[P][0]=null;F[P]=null}F=null;R._simpleRemove(window,"unload",R._unload)},_getScrollLeft:function(){return this._getScroll()[1]},_getScrollTop:function(){return this._getScroll()[0]},_getScroll:function(){var L=document.documentElement,M=document.body;if(L&&(L.scrollTop||L.scrollLeft)){return[L.scrollTop,L.scrollLeft]}else{if(M){return[M.scrollTop,M.scrollLeft]}else{return[0,0]}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(N,O,M,L){N.addEventListener(O,M,(L))}}else{if(window.attachEvent){return function(N,O,M,L){N.attachEvent("on"+O,M)}}else{return function(){}}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(N,O,M,L){N.removeEventListener(O,M,(L))}}else{if(window.detachEvent){return function(M,N,L){M.detachEvent("on"+N,L)}}else{return function(){}}}}()}}();(function(){var B=YAHOO.util.Event;B.on=B.addListener;if(B.isIE){document.write("<script id=\"_yui_eu_dr\" defer=\"true\" src=\"//:\"></script>");var A=document.getElementById("_yui_eu_dr");A.onreadystatechange=function(){if("complete"==this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready()}};A=null;YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true)}else{if(B.webkit){B._drwatch=setInterval(function(){var C=document.readyState;if("loaded"==C||"complete"==C){clearInterval(B._drwatch);B._drwatch=null;B._ready()}},B.POLL_INTERVAL)}else{B._simpleAdd(document,"DOMContentLoaded",B._ready)}}B._simpleAdd(window,"load",B._load);B._simpleAdd(window,"unload",B._unload);B._tryPreloadAttach()})()}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};var D=this.__yui_events[A];if(D){D.subscribe(C,F,E)}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[]}B[A].push({fn:C,obj:F,override:E})}},unsubscribe:function(A,B,D){this.__yui_events=this.__yui_events||{};var C=this.__yui_events[A];if(C){return C.unsubscribe(B,D)}else{return false}},unsubscribeAll:function(A){return this.unsubscribe(A)},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=A.silent||null;var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback)}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override)}}}return I[G]},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(G){var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F])}return G.fire.apply(G,B)}else{return null}},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true}}return false}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A)}if(typeof B=="function"){D.subscribe(B)}else{D.subscribe(B.fn,B.scope,B.correctScope)}function E(K,J){if(!F.shift){F.shift=false}if(!F.alt){F.alt=false}if(!F.ctrl){F.ctrl=false}if(K.shiftKey==F.shift&&K.altKey==F.alt&&K.ctrlKey==F.ctrl){var H;var G;if(F.keys instanceof Array){for(var I=0;I<F.keys.length;I++){H=F.keys[I];if(H==K.charCode){D.fire(K.charCode,K);break}else{if(H==K.keyCode){D.fire(K.keyCode,K);break}}}}else{H=F.keys;if(H==K.charCode){D.fire(K.charCode,K)}else{if(H==K.keyCode){D.fire(K.keyCode,K)}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F)}this.enabled=true};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F)}this.enabled=false};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"")}};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.2.2",build:"204"});if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=function(){var A=YAHOO.util.Event;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,interactionInfo:null,init:function(){this.initialized=true},POINT:0,INTERSECT:1,STRICT_INTERSECT:2,mode:0,_execOnAll:function(D,C){for(var E in this.ids){for(var B in this.ids[E]){var F=this.ids[E][B];if(!this.isTypeOfDD(F)){continue}F[D].apply(F,C)}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true)},_onResize:function(B){this._execOnAll("resetConstraints",[])},lock:function(){this.locked=true},unlock:function(){this.locked=false},isLocked:function(){return this.locked},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:1000,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(C,B){if(!this.initialized){this.init()}if(!this.ids[B]){this.ids[B]={}}this.ids[B][C.id]=C},removeDDFromGroup:function(D,B){if(!this.ids[B]){this.ids[B]={}}var C=this.ids[B];if(C&&C[D.id]){delete C[D.id]}},_remove:function(C){for(var B in C.groups){if(B&&this.ids[B][C.id]){delete this.ids[B][C.id]}}delete this.handleIds[C.id]},regHandle:function(C,B){if(!this.handleIds[C]){this.handleIds[C]={}}this.handleIds[C][B]=B},isDragDrop:function(B){return(this.getDDById(B))?true:false},getRelated:function(F,C){var E=[];for(var D in F.groups){for(j in this.ids[D]){var B=this.ids[D][j];if(!this.isTypeOfDD(B)){continue}if(!C||B.isTarget){E[E.length]=B}}}return E},isLegalTarget:function(F,E){var C=this.getRelated(F,true);for(var D=0,B=C.length;D<B;++D){if(C[D].id==E.id){return true}}return false},isTypeOfDD:function(B){return(B&&B.__ygDragDrop)},isHandle:function(C,B){return(this.handleIds[C]&&this.handleIds[C][B])},getDDById:function(C){for(var B in this.ids){if(this.ids[B][C]){return this.ids[B][C]}}return null},handleMouseDown:function(D,C){this.currentTarget=YAHOO.util.Event.getTarget(D);this.dragCurrent=C;var B=C.getEl();this.startX=YAHOO.util.Event.getPageX(D);this.startY=YAHOO.util.Event.getPageY(D);this.deltaX=this.startX-B.offsetLeft;this.deltaY=this.startY-B.offsetTop;this.dragThreshMet=false;this.clickTimeout=setTimeout(function(){var E=YAHOO.util.DDM;E.startDrag(E.startX,E.startY)},this.clickTimeThresh)},startDrag:function(B,C){clearTimeout(this.clickTimeout);if(this.dragCurrent){this.dragCurrent.b4StartDrag(B,C);this.dragCurrent.startDrag(B,C)}this.dragThreshMet=true},handleMouseUp:function(B){if(!this.dragCurrent){return }clearTimeout(this.clickTimeout);if(this.dragThreshMet){this.fireEvents(B,true)}else{}this.stopDrag(B);this.stopEvent(B)},stopEvent:function(B){if(this.stopPropagation){YAHOO.util.Event.stopPropagation(B)}if(this.preventDefault){YAHOO.util.Event.preventDefault(B)}},stopDrag:function(B){if(this.dragCurrent){if(this.dragThreshMet){this.dragCurrent.b4EndDrag(B);this.dragCurrent.endDrag(B)}this.dragCurrent.onMouseUp(B)}this.dragCurrent=null;this.dragOvers={}},handleMouseMove:function(D){if(!this.dragCurrent){return true}if(YAHOO.util.Event.isIE&&!D.button){this.stopEvent(D);return this.handleMouseUp(D)}if(!this.dragThreshMet){var C=Math.abs(this.startX-YAHOO.util.Event.getPageX(D));var B=Math.abs(this.startY-YAHOO.util.Event.getPageY(D));if(C>this.clickPixelThresh||B>this.clickPixelThresh){this.startDrag(this.startX,this.startY)}}if(this.dragThreshMet){this.dragCurrent.b4Drag(D);this.dragCurrent.onDrag(D);this.fireEvents(D,false)}this.stopEvent(D);return true},fireEvents:function(P,H){var R=this.dragCurrent;if(!R||R.isLocked()){return }var J=YAHOO.util.Event.getPageX(P);var I=YAHOO.util.Event.getPageY(P);var K=new YAHOO.util.Point(J,I);var F=R.getTargetCoord(K.x,K.y);var C=R.getDragEl();curRegion=new YAHOO.util.Region(F.y,F.x+C.offsetWidth,F.y+C.offsetHeight,F.x);var E=[];var G=[];var B=[];var Q=[];var O=[];for(var M in this.dragOvers){var S=this.dragOvers[M];if(!this.isTypeOfDD(S)){continue}if(!this.isOverTarget(K,S,this.mode,curRegion)){G.push(S)}E[M]=true;delete this.dragOvers[M]}for(var L in R.groups){if("string"!=typeof L){continue}for(M in this.ids[L]){var D=this.ids[L][M];if(!this.isTypeOfDD(D)){continue}if(D.isTarget&&!D.isLocked()&&D!=R){if(this.isOverTarget(K,D,this.mode,curRegion)){if(H){Q.push(D)}else{if(!E[D.id]){O.push(D)}else{B.push(D)}this.dragOvers[D.id]=D}}}}}this.interactionInfo={out:G,enter:O,over:B,drop:Q,point:K,draggedRegion:curRegion,sourceRegion:this.locationCache[R.id],validDrop:H};if(H&&!Q.length){this.interactionInfo.validDrop=false;R.onInvalidDrop(P)}if(this.mode){if(G.length){R.b4DragOut(P,G);R.onDragOut(P,G)}if(O.length){R.onDragEnter(P,O)}if(B.length){R.b4DragOver(P,B);R.onDragOver(P,B)}if(Q.length){R.b4DragDrop(P,Q);R.onDragDrop(P,Q)}}else{var N=0;for(M=0,N=G.length;M<N;++M){R.b4DragOut(P,G[M].id);R.onDragOut(P,G[M].id)}for(M=0,N=O.length;M<N;++M){R.onDragEnter(P,O[M].id)}for(M=0,N=B.length;M<N;++M){R.b4DragOver(P,B[M].id);R.onDragOver(P,B[M].id)}for(M=0,N=Q.length;M<N;++M){R.b4DragDrop(P,Q[M].id);R.onDragDrop(P,Q[M].id)}}},getBestMatch:function(D){var F=null;var C=D.length;if(C==1){F=D[0]}else{for(var E=0;E<C;++E){var B=D[E];if(this.mode==this.INTERSECT&&B.cursorIsOver){F=B;break}else{if(!F||!F.overlap||(B.overlap&&F.overlap.getArea()<B.overlap.getArea())){F=B}}}}return F},refreshCache:function(C){var E=C||this.ids;for(var B in E){if("string"!=typeof B){continue}for(var D in this.ids[B]){var F=this.ids[B][D];if(this.isTypeOfDD(F)){var G=this.getLocation(F);if(G){this.locationCache[F.id]=G}else{delete this.locationCache[F.id]}}}}},verifyEl:function(C){try{if(C){var B=C.offsetParent;if(B){return true}}}catch(D){}return false},getLocation:function(G){if(!this.isTypeOfDD(G)){return null}var E=G.getEl(),J,D,C,L,K,M,B,I,F;try{J=YAHOO.util.Dom.getXY(E)}catch(H){}if(!J){return null}D=J[0];C=D+E.offsetWidth;L=J[1];K=L+E.offsetHeight;M=L-G.padding[0];B=C+G.padding[1];I=K+G.padding[2];F=D-G.padding[3];return new YAHOO.util.Region(M,B,I,F)},isOverTarget:function(J,B,D,E){var F=this.locationCache[B.id];if(!F||!this.useCache){F=this.getLocation(B);this.locationCache[B.id]=F}if(!F){return false}B.cursorIsOver=F.contains(J);var I=this.dragCurrent;if(!I||(!D&&!I.constrainX&&!I.constrainY)){return B.cursorIsOver}B.overlap=null;if(!E){var G=I.getTargetCoord(J.x,J.y);var C=I.getDragEl();E=new YAHOO.util.Region(G.y,G.x+C.offsetWidth,G.y+C.offsetHeight,G.x)}var H=E.intersect(F);if(H){B.overlap=H;return(D)?true:B.cursorIsOver}else{return false}},_onUnload:function(C,B){this.unregAll()},unregAll:function(){if(this.dragCurrent){this.stopDrag();this.dragCurrent=null}this._execOnAll("unreg",[]);for(i in this.elementCache){delete this.elementCache[i]}this.elementCache={};this.ids={}},elementCache:{},getElWrapper:function(C){var B=this.elementCache[C];if(!B||!B.el){B=this.elementCache[C]=new this.ElementWrapper(YAHOO.util.Dom.get(C))}return B},getElement:function(B){return YAHOO.util.Dom.get(B)},getCss:function(C){var B=YAHOO.util.Dom.get(C);return(B)?B.style:null},ElementWrapper:function(B){this.el=B||null;this.id=this.el&&B.id;this.css=this.el&&B.style},getPosX:function(B){return YAHOO.util.Dom.getX(B)},getPosY:function(B){return YAHOO.util.Dom.getY(B)},swapNode:function(D,B){if(D.swapNode){D.swapNode(B)}else{var E=B.parentNode;var C=B.nextSibling;if(C==D){E.insertBefore(D,B)}else{if(B==D.nextSibling){E.insertBefore(B,D)}else{D.parentNode.replaceChild(B,D);E.insertBefore(D,C)}}}},getScroll:function(){var D,B,E=document.documentElement,C=document.body;if(E&&(E.scrollTop||E.scrollLeft)){D=E.scrollTop;B=E.scrollLeft}else{if(C){D=C.scrollTop;B=C.scrollLeft}else{}}return{top:D,left:B}},getStyle:function(C,B){return YAHOO.util.Dom.getStyle(C,B)},getScrollTop:function(){return this.getScroll().top},getScrollLeft:function(){return this.getScroll().left},moveToEl:function(B,D){var C=YAHOO.util.Dom.getXY(D);YAHOO.util.Dom.setXY(B,C)},getClientHeight:function(){return YAHOO.util.Dom.getViewportHeight()},getClientWidth:function(){return YAHOO.util.Dom.getViewportWidth()},numericSort:function(C,B){return(C-B)},_timeoutCount:0,_addListeners:function(){var B=YAHOO.util.DDM;if(YAHOO.util.Event&&document){B._onLoad()}else{if(B._timeoutCount>2000){}else{setTimeout(B._addListeners,10);if(document&&document.body){B._timeoutCount+=1}}}},handleWasClicked:function(B,D){if(this.isHandle(D,B.id)){return true}else{var C=B.parentNode;while(C){if(this.isHandle(D,C.id)){return true}else{C=C.parentNode}}}return false}}}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners()}(function(){var A=YAHOO.util.Event;var B=YAHOO.util.Dom;YAHOO.util.DragDrop=function(E,C,D){if(E){this.init(E,C,D)}};YAHOO.util.DragDrop.prototype={id:null,config:null,dragElId:null,handleElId:null,invalidHandleTypes:null,invalidHandleIds:null,invalidHandleClasses:null,startPageX:0,startPageY:0,groups:null,locked:false,lock:function(){this.locked=true},unlock:function(){this.locked=false},isTarget:true,padding:null,_domRef:null,__ygDragDrop:true,constrainX:false,constrainY:false,minX:0,maxX:0,minY:0,maxY:0,deltaX:0,deltaY:0,maintainOffset:false,xTicks:null,yTicks:null,primaryButtonOnly:true,available:false,hasOuterHandles:false,b4StartDrag:function(C,D){},startDrag:function(C,D){},b4Drag:function(C){},onDrag:function(C){},onDragEnter:function(C,D){},b4DragOver:function(C){},onDragOver:function(C,D){},b4DragOut:function(C){},onDragOut:function(C,D){},b4DragDrop:function(C){},onDragDrop:function(C,D){},onInvalidDrop:function(C){},b4EndDrag:function(C){},endDrag:function(C){},b4MouseDown:function(C){},onMouseDown:function(C){},onMouseUp:function(C){},onAvailable:function(){},getEl:function(){if(!this._domRef){this._domRef=B.get(this.id)}return this._domRef},getDragEl:function(){return B.get(this.dragElId)},init:function(E,C,D){this.initTarget(E,C,D);A.on(this.id,"mousedown",this.handleMouseDown,this,true)},initTarget:function(E,C,D){this.config=D||{};this.DDM=YAHOO.util.DDM;this.groups={};if(typeof E!=="string"){E=B.generateId(E)}this.id=E;this.addToGroup((C)?C:"default");this.handleElId=E;A.onAvailable(E,this.handleOnAvailable,this,true);this.setDragElId(E);this.invalidHandleTypes={A:"A"};this.invalidHandleIds={};this.invalidHandleClasses=[];this.applyConfig()},applyConfig:function(){this.padding=this.config.padding||[0,0,0,0];this.isTarget=(this.config.isTarget!==false);this.maintainOffset=(this.config.maintainOffset);this.primaryButtonOnly=(this.config.primaryButtonOnly!==false)},handleOnAvailable:function(){this.available=true;this.resetConstraints();this.onAvailable()},setPadding:function(E,C,F,D){if(!C&&0!==C){this.padding=[E,E,E,E]}else{if(!F&&0!==F){this.padding=[E,C,E,C]}else{this.padding=[E,C,F,D]}}},setInitPosition:function(F,E){var G=this.getEl();if(!this.DDM.verifyEl(G)){return }var D=F||0;var C=E||0;var H=B.getXY(G);this.initPageX=H[0]-D;this.initPageY=H[1]-C;this.lastPageX=H[0];this.lastPageY=H[1];this.setStartPosition(H)},setStartPosition:function(D){var C=D||B.getXY(this.getEl());this.deltaSetXY=null;this.startPageX=C[0];this.startPageY=C[1]},addToGroup:function(C){this.groups[C]=true;this.DDM.regDragDrop(this,C)},removeFromGroup:function(C){if(this.groups[C]){delete this.groups[C]}this.DDM.removeDDFromGroup(this,C)},setDragElId:function(C){this.dragElId=C},setHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C)}this.handleElId=C;this.DDM.regHandle(this.id,C)},setOuterHandleElId:function(C){if(typeof C!=="string"){C=B.generateId(C)}A.on(C,"mousedown",this.handleMouseDown,this,true);this.setHandleElId(C);this.hasOuterHandles=true},unreg:function(){A.removeListener(this.id,"mousedown",this.handleMouseDown);this._domRef=null;this.DDM._remove(this)},isLocked:function(){return(this.DDM.isLocked()||this.locked)},handleMouseDown:function(F,E){var C=F.which||F.button;if(this.primaryButtonOnly&&C>1){return }if(this.isLocked()){return }this.b4MouseDown(F);this.onMouseDown(F);this.DDM.refreshCache(this.groups);var D=new YAHOO.util.Point(A.getPageX(F),A.getPageY(F));if(!this.hasOuterHandles&&!this.DDM.isOverTarget(D,this)){}else{if(this.clickValidator(F)){this.setStartPosition();this.DDM.handleMouseDown(F,this);this.DDM.stopEvent(F)}else{}}},clickValidator:function(D){var C=A.getTarget(D);return(this.isValidHandleChild(C)&&(this.id==this.handleElId||this.DDM.handleWasClicked(C,this.id)))},getTargetCoord:function(E,D){var C=E-this.deltaX;var F=D-this.deltaY;if(this.constrainX){if(C<this.minX){C=this.minX}if(C>this.maxX){C=this.maxX}}if(this.constrainY){if(F<this.minY){F=this.minY}if(F>this.maxY){F=this.maxY}}C=this.getTick(C,this.xTicks);F=this.getTick(F,this.yTicks);return{x:C,y:F}},addInvalidHandleType:function(C){var D=C.toUpperCase();this.invalidHandleTypes[D]=D},addInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C)}this.invalidHandleIds[C]=C},addInvalidHandleClass:function(C){this.invalidHandleClasses.push(C)},removeInvalidHandleType:function(C){var D=C.toUpperCase();delete this.invalidHandleTypes[D]},removeInvalidHandleId:function(C){if(typeof C!=="string"){C=B.generateId(C)}delete this.invalidHandleIds[C]},removeInvalidHandleClass:function(D){for(var E=0,C=this.invalidHandleClasses.length;E<C;++E){if(this.invalidHandleClasses[E]==D){delete this.invalidHandleClasses[E]}}},isValidHandleChild:function(F){var E=true;var H;try{H=F.nodeName.toUpperCase()}catch(G){H=F.nodeName}E=E&&!this.invalidHandleTypes[H];E=E&&!this.invalidHandleIds[F.id];for(var D=0,C=this.invalidHandleClasses.length;E&&D<C;++D){E=!B.hasClass(F,this.invalidHandleClasses[D])}return E},setXTicks:function(F,C){this.xTicks=[];this.xTickSize=C;var E={};for(var D=this.initPageX;D>=this.minX;D=D-C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true}}for(D=this.initPageX;D<=this.maxX;D=D+C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true}}this.xTicks.sort(this.DDM.numericSort)},setYTicks:function(F,C){this.yTicks=[];this.yTickSize=C;var E={};for(var D=this.initPageY;D>=this.minY;D=D-C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true}}for(D=this.initPageY;D<=this.maxY;D=D+C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true}}this.yTicks.sort(this.DDM.numericSort)},setXConstraint:function(E,D,C){this.leftConstraint=parseInt(E,10);this.rightConstraint=parseInt(D,10);this.minX=this.initPageX-this.leftConstraint;this.maxX=this.initPageX+this.rightConstraint;if(C){this.setXTicks(this.initPageX,C)}this.constrainX=true},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks()},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0},setYConstraint:function(C,E,D){this.topConstraint=parseInt(C,10);this.bottomConstraint=parseInt(E,10);this.minY=this.initPageY-this.topConstraint;this.maxY=this.initPageY+this.bottomConstraint;if(D){this.setYTicks(this.initPageY,D)}this.constrainY=true},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var D=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var C=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(D,C)}else{this.setInitPosition()}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize)}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize)}},getTick:function(I,F){if(!F){return I}else{if(F[0]>=I){return F[0]}else{for(var D=0,C=F.length;D<C;++D){var E=D+1;if(F[E]&&F[E]>=I){var H=I-F[D];var G=F[E]-I;return(G>H)?F[D]:F[E]}}return F[F.length-1]}}},toString:function(){return("DragDrop "+this.id)}}})();YAHOO.util.DD=function(C,A,B){if(C){this.init(C,A,B)}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop,{scroll:true,autoOffset:function(C,B){var A=C-this.startPageX;var D=B-this.startPageY;this.setDelta(A,D)},setDelta:function(B,A){this.deltaX=B;this.deltaY=A},setDragElPos:function(C,B){var A=this.getDragEl();this.alignElWithMouse(A,C,B)},alignElWithMouse:function(B,F,E){var D=this.getTargetCoord(F,E);if(!this.deltaSetXY){var G=[D.x,D.y];YAHOO.util.Dom.setXY(B,G);var C=parseInt(YAHOO.util.Dom.getStyle(B,"left"),10);var A=parseInt(YAHOO.util.Dom.getStyle(B,"top"),10);this.deltaSetXY=[C-D.x,A-D.y]}else{YAHOO.util.Dom.setStyle(B,"left",(D.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(B,"top",(D.y+this.deltaSetXY[1])+"px")}this.cachePosition(D.x,D.y);this.autoScroll(D.x,D.y,B.offsetHeight,B.offsetWidth)},cachePosition:function(B,A){if(B){this.lastPageX=B;this.lastPageY=A}else{var C=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1]}},autoScroll:function(J,I,E,K){if(this.scroll){var L=this.DDM.getClientHeight();var B=this.DDM.getClientWidth();var N=this.DDM.getScrollTop();var D=this.DDM.getScrollLeft();var H=E+I;var M=K+J;var G=(L+N-I-this.deltaY);var F=(B+D-J-this.deltaX);var C=40;var A=(document.all)?80:30;if(H>L&&G<C){window.scrollTo(D,N+A)}if(I<N&&N>0&&I-N<C){window.scrollTo(D,N-A)}if(M>B&&F<C){window.scrollTo(D+A,N)}if(J<D&&D>0&&J-D<C){window.scrollTo(D-A,N)}}},applyConfig:function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false)},b4MouseDown:function(A){this.setStartPosition();this.autoOffset(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A))},b4Drag:function(A){this.setDragElPos(YAHOO.util.Event.getPageX(A),YAHOO.util.Event.getPageY(A))},toString:function(){return("DD "+this.id)}});YAHOO.util.DDProxy=function(C,A,B){if(C){this.init(C,A,B);this.initFrame()}};YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var B=this;var A=document.body;if(!A||!A.firstChild){setTimeout(function(){B.createFrame()},50);return }var D=this.getDragEl();if(!D){D=document.createElement("div");D.id=this.dragElId;var C=D.style;C.position="absolute";C.visibility="hidden";C.cursor="move";C.border="2px solid #aaa";C.zIndex=999;A.insertBefore(D,A.firstChild)}},initFrame:function(){this.createFrame()},applyConfig:function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId)},showFrame:function(E,D){var C=this.getEl();var A=this.getDragEl();var B=A.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(B.width,10)/2),Math.round(parseInt(B.height,10)/2))}this.setDragElPos(E,D);YAHOO.util.Dom.setStyle(A,"visibility","visible")},_resizeProxy:function(){if(this.resizeFrame){var H=YAHOO.util.Dom;var B=this.getEl();var C=this.getDragEl();var G=parseInt(H.getStyle(C,"borderTopWidth"),10);var I=parseInt(H.getStyle(C,"borderRightWidth"),10);var F=parseInt(H.getStyle(C,"borderBottomWidth"),10);var D=parseInt(H.getStyle(C,"borderLeftWidth"),10);if(isNaN(G)){G=0}if(isNaN(I)){I=0}if(isNaN(F)){F=0}if(isNaN(D)){D=0}var E=Math.max(0,B.offsetWidth-I-D);var A=Math.max(0,B.offsetHeight-G-F);H.setStyle(C,"width",E+"px");H.setStyle(C,"height",A+"px")}},b4MouseDown:function(B){this.setStartPosition();var A=YAHOO.util.Event.getPageX(B);var C=YAHOO.util.Event.getPageY(B);this.autoOffset(A,C);this.setDragElPos(A,C)},b4StartDrag:function(A,B){this.showFrame(A,B)},b4EndDrag:function(A){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden")},endDrag:function(D){var C=YAHOO.util.Dom;var B=this.getEl();var A=this.getDragEl();C.setStyle(A,"visibility","");C.setStyle(B,"visibility","hidden");YAHOO.util.DDM.moveToEl(B,A);C.setStyle(A,"visibility","hidden");C.setStyle(B,"visibility","")},toString:function(){return("DDProxy "+this.id)}});YAHOO.util.DDTarget=function(C,A,B){if(C){this.initTarget(C,A,B)}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop,{toString:function(){return("DDTarget "+this.id)}});YAHOO.register("dragdrop",YAHOO.util.DragDropMgr,{version:"2.2.2",build:"204"})