var RRTUtils={getCurrentTime:function(){var A;A=new Date();return A.getTime()},openWindow:function(A){window.open(A.href);return false},redirectTo:function(A){document.location.href=A},disableOnClick:function(B){var A=null;if(B){B=$(B);A=B.onclick;B.onclick=function(){return false}}return A},restoreOnClick:function(obj,script){if(obj){obj=$(obj);obj.onclick=function(){eval(script)}}},clearDefaultValue:function(A){if(A.defaultValue==A.value){A.value=""}},toggleElementInnerHTMLById:function(A,D,C){var B=document.getElementById(A);if(B!=null){if(B.innerHTML==D){B.innerHTML=C}else{B.innerHTML=D}}},toggleElementById:function(A){var C="0";var B=document.getElementById(A);if(B!=null){if(Element.visible(B)){C="0"}else{C="1"}Element.toggle(B)}return C},disableFormsByClassName:function(C){var A=document.getElementsByClassName(C);for(var B=0;B<A.length;B++){Form.disable(A[B])}},enableFormsByClassName:function(C){var A=document.getElementsByClassName(C);for(var B=0;B<A.length;B++){Form.enable(A[B])}},countElementsByClassName:function(A){var B=document.getElementsByClassName(A);return B.length},showElementsByClassName:function(B){var C=document.getElementsByClassName(B);for(var A=0;A<C.length;A++){Element.show(C[A])}},hideElementsByClassName:function(B){var C=document.getElementsByClassName(B);for(var A=0;A<C.length;A++){Element.hide(C[A])}},removeClassNameFromElements:function(B){var C=document.getElementsByClassName(B);for(var A=0;A<C.length;A++){Element.removeClassName(C[A],B)}},swapElementClassNames:function(B,C,A){var D=document.getElementById(B);if(D!=null){Element.removeClassName(D,C);Element.addClassName(D,A)}},displayOffElementById:function(B,A){var C=document.getElementById(B);if(C!=null){if(Element.visible(C)){if((A)&&(A==true)){Effect.Fade(C)}else{Element.toggle(C)}}}},displayOnElementById:function(B,A){var C=document.getElementById(B);if(C!=null){if(!Element.visible(C)){if((A)&&(A==true)){Effect.Appear(C)}else{Element.toggle(C)}}}},getPropertyById:function(B,A){var C=document.getElementById(B);if(C!=null){if(C.style){C=C.style;if(C[A]){return C[A]}else{return null}}else{return null}}},removeInlineStyles:function(A){var B=$(A);if(B!=null){B.removeAttribute("style")}},toggleElement:function(C,B,A){RRTUtils.toggleElementById(C);RRTUtils.toggleElementById(A);RRTUtils.toggleElementById(B)},centerElement:function(B){var E=$(B);if(E!=null){var F=WindowUtilities.getWindowScroll(document.body);var A=WindowUtilities.getPageSize(document.body);var D=(A.windowHeight-E.getHeight())/2;D+=F.top;var C=(A.windowWidth-E.getWidth())/2;C+=F.left;E.setStyle({top:D+"px"});E.setStyle({left:C+"px"})}},scrollElementToVisible:function(E){var D=document.getElementById(E);var A=D.offsetLeft;var B=D.offsetTop;var F=D.offsetParent;while(F!=null){A+=F.offsetLeft;B+=F.offsetTop;F=F.offsetParent}var I=null;if(window.innerHeight){I=[window.innerWidth-10,window.innerHeight-10,window.pageXOffset,window.pageYOffset]}else{if(document.documentElement.clientHeight){I=[document.documentElement.clientWidth-10,document.documentElement.clientHeight-10,document.documentElement.scrollLeft,document.documentElement.scrollTop]}else{I=[document.body.clientWidth,document.body.clientHeight,document.body.scrollLeft,document.body.scrollTop]}}var C=I[3];var G=((B+D.offsetHeight+20));var H=I[1]+C;if(G>H){window.scroll(0,C+G-H)}if(B<C){window.scroll(0,B-20)}},highlight:function(A,B){if(B==null){B={}}B.afterFinish=function(C){C.element.style.backgroundColor="";C.element.style.backgroundImage=""};new Effect.Highlight(A,B)},limitInput:function(C,B,D){if((B>0)&&(C.value.length>B)){C.value=C.value.substring(0,B)}if(D){var A=$(D);A.innerHTML=RRTUtils.formatWithThousandsSeparator(C.value.length)}},clearCharCount:function(B){var A=$(B);if(A){A.innerHTML="0"}},refreshPage:function(){location.reload(true)},getFirstValue:function(C){var B=null;var A=$(C);if(A.options.length>0){B=A.options[0].value}return B},getSelectedValue:function(C){var B=null;var A=$(C);if(A&&A.selectedIndex>=0){B=A.options[A.selectedIndex].value}return B},setSelectedValue:function(F,E,A){var B=false;var C=$(F);if(C){for(var D=0;D<C.length;D++){if(C.options[D].value==E){C.selectedIndex=D;B=true;break}}if(!B&&A){C.selectedIndex=A}}},selectAll:function(D,B){var A=$(D);if(A){if(A.type=="select-multiple"){for(var C=0;C<A.options.length;C++){A.options[C].selected=true}}if(B){A.focus()}}},checkAll:function(B,A){RRTUtils.setAllCheckBoxes(B,A,true)},uncheckAll:function(B,A){RRTUtils.setAllCheckBoxes(B,A,false)},setAllCheckBoxes:function(G,F,E){var C=new RegExp("^"+F);var D=Form.getElements(G);for(var B=0;(B<D.length);B++){var A=D[B].name.search(C);if(A>=0){D[B].checked=E}}},disableElement:function(A){var B=$(A);if(B!=null){B.disabled=true}},enableElement:function(A){var B=$(A);if(B!=null){B.disabled=false}},sortSelectOptionsAlphabetically:function(B){var A=function(D,C){return(D.text<C.text)?-1:(D.text>C.text)?1:0};B.sort(A)},getSelectedLabels:function(D,C){var E="";var A=$(D);if(A){if(C==null){C=","}for(var B=0;B<A.options.length;B++){if(A.options[B].selected){if(E!=""){E+=C}E+=A.options[B].text}}}return E},getElementValue:function(A){var C=null;var B=document.getElementById(A);if(B!=null){C=B.innerHTML}return C},forceToNumber:function(A){return(+A)},getHiddenNumber:function(A){return RRTUtils.forceToNumber(RRTUtils.getHiddenValue(A))},getHiddenValue:function(B){var C=null;var A=document.getElementById(B);if(A){C=A.value}return C},setHiddenValue:function(C,B){var A=document.getElementById(C);if(A){A.value=B}},setHiddenFormValue:function(D,C,B){var A=RRTUtils.getFormElement(D,C);if(A){A.value=B}},getFormElement:function(E,A){var C=null;var D=Form.getElements(E);for(var B=0;((B<D.length)&&(C==null));B++){if(D[B].id==A){C=D[B]}}return C},focusFirstElement:function(B){B=$(B);var A=B.findFirstElement();if(A!=null){A.activate()}return B},focusFirstFormTextElement:function(D,B){var A=null;var C=Form.getInputs(D,"text");if(C&&(C.length>0)){A=C[0]}else{A=Form.findFirstElement(D)}RRTUtils.focusFormTextElement(A,B)},focusFormTextElement:function(B,C,A){B=$(B);Form.Element.focus(B);if((C!=null)&&(C==true)){Form.Element.select(B)}else{if((A!=null)&&(A>=0)){RRTUtils.setSelectionRange(B,A,0)}}},moveTextAreaCursorToEnd:function(C){var B=$(C);var D=B.value.length;if(B.setSelectionRange){B.setSelectionRange(D,D)}else{if(B.createTextRange){var A=B.createTextRange();A.collapse(true);A.moveEnd("character",D);A.moveStart("character",D);A.select()}}},setSelectionRange:function(B,D,C){if(B.setSelectionRange){B.setSelectionRange(D,D+C)}else{if(B.createTextRange){var A=B.createTextRange();A.moveStart("character",D);A.moveEnd("character",D+C);A.select()}}},addParam:function(C,A,B){if(B!=null){if((C==null)||(C.length==0)){C="?"}else{C+="&"}C+=A+"="+B}return C},findElementAbsolutePosition:function(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]},formatWithThousandsSeparator:function(G,F,E){if(F==null){F=","}if(E==null){E="."}G=parseInt(G,10)+"";var A=G.split(E);var D=A[0];var B=A.length>1?E+A[1]:"";var C=/(\d+)(\d{3})/;while(C.test(D)){D=D.replace(C,"$1"+F+"$2")}return D+B},isInteger:function(B){var A;for(A=0;A<B.length;A++){var C=B.charAt(A);if(((C<"0")||(C>"9"))){return false}}return true},stripCharsInBag:function(C,D){var B;var A="";for(B=0;B<C.length;B++){var E=C.charAt(B);if(D.indexOf(E)==-1){A+=E}}return A}};var RRTDateUtils={dtCh:"-",minYear:1800,maxYear:2200,daysInFebruary:function(A){return(((A%4==0)&&((!(A%100==0))||(A%400==0)))?29:28)},getDaysArray:function(B){for(var A=1;A<=B;A++){this[A]=31;if(A==4||A==6||A==9||A==11){this[A]=30}if(A==2){this[A]=29}}return this},isDate:function(B){var A=convertStringToDate(B);return(A!=null)},convertStringToDate:function(D){var A=RRTDateUtils.getDaysArray(12);var E=D.indexOf(RRTDateUtils.dtCh);var C=D.indexOf(RRTDateUtils.dtCh,E+1);var H=D.substring(0,E);var G=D.substring(E+1,C);var F=D.substring(C+1);strYr=F;if(G.charAt(0)=="0"&&G.length>1){G=G.substring(1)}if(H.charAt(0)=="0"&&H.length>1){H=H.substring(1)}for(var B=1;B<=3;B++){if(strYr.charAt(0)=="0"&&strYr.length>1){strYr=strYr.substring(1)}}month=parseInt(H);day=parseInt(G);year=parseInt(strYr);if(E==-1||C==-1){return null}if(H.length<1||month<1||month>12){return null}if(G.length<1||day<1||day>31||(month==2&&day>RRTDateUtils.daysInFebruary(year))||day>A[month]){return null}if(F.length!=4||year==0||year<RRTDateUtils.minYear||year>RRTDateUtils.maxYear){return null}if(D.indexOf(RRTDateUtils.dtCh,C+1)!=-1||RRTUtils.isInteger(RRTUtils.stripCharsInBag(D,RRTDateUtils.dtCh))==false){return null}return new Date(year,month,day)}};var g_className="riverock";var g_dialogActive=false;var g_formDialogActive=false;var g_confirmDialogActive=false;var g_enterKeyOverriden=false;var g_escKeyOverriden=false;var g_dialogOptions=null;var RRTDialog={_formDialogButtonOnClicks:null,showDialog:function(G,B,D,C,F){if(g_dialogActive){return }g_dialogActive=true;var E={url:B,options:{method:"get"}};var A={className:g_className,width:D,draggable:true,showEffect:Element.show,hideEffect:Element.hide};E.options.onFailure=function(H){g_dialogActive=false;A.onClose();if(F!=null){F(H)}};RRTDialog.replaceOnClickDuringDialog(G,A);FullWeb.showAjaxMessage();E.options.onComplete=function(H){FullWeb.hideAjaxMessage()};if(C&&C.onEnterKey){g_enterKeyOverriden=true}else{g_enterKeyOverriden=false}if(C&&C.onEscKey){g_escKeyOverriden=true}else{g_escKeyOverriden=false}g_dialogOptions=C;Dialog.confirm(E,A);observer={onShow:function(H,I){formElement=$("form");if(formElement!=null){if(C&&C.focusElement){RRTUtils.focusFormTextElement(C.focusElement,C.selectText,C.cursorPosition)}else{RRTUtils.focusFirstElement("form")}}},onDestroy:function(H,I){Windows.removeObserver(this)}};Windows.addObserver(observer)},showFormDialog:function(G,A,H,D,C,F){if(g_formDialogActive){return }g_formDialogActive=true;_formDialogButtonOnClicks=null;var E={url:A,options:{method:"get",evalScripts:true}};var B={className:g_className,width:D,draggable:true,showEffect:Element.show,hideEffect:Element.hide,onCancel:function(I){if(C&&C.onCancel){C.onCancel()}},onOk:function(J){if(C&&C.onBeforeSubmit){C.onBeforeSubmit()}RRTDialog.disableFormDialog();if(C&&C.normal){$("form").submit()}else{var I={showAjaxMessage:false};I.onCompleteCallback=function(K){if(C&&C.onAfterSubmit){C.onAfterSubmit()}};I.onFailureCallback=function(K){RRTDialog.enableFormDialog()};FullWeb.submitFormRemote(H,"form",I)}return false}};E.options.onFailure=function(I){g_formDialogActive=false;B.onClose();if(F!=null){F(I)}};RRTDialog.replaceOnClickDuringDialog(G,B);FullWeb.showAjaxMessage();E.options.onComplete=function(I){FullWeb.hideAjaxMessage()};Dialog.confirm(E,B);observer={onShow:function(I,K){var L=$("milestone_dialog_footer");var J=L.getElementsByClassName("close_button");if(J==null||J.length==0){if(C&&C.focusElement){if(C.moveCursorToEnd){RRTUtils.focusFormTextElement(C.focusElement,C.selectText);RRTUtils.moveTextAreaCursorToEnd(C.focusElement)}else{RRTUtils.focusFormTextElement(C.focusElement,C.selectText,C.cursorPosition)}}else{RRTUtils.focusFirstElement("form")}}},onDestroy:function(I,J){Windows.removeObserver(this)}};Windows.addObserver(observer)},disableFormDialog:function(A){FullWeb.disableGlobalKeyboardShortcuts();_formDialogButtonOnClicks=new Array();var C=document.getElementsByClassName("dialog_button");for(var B=0;B<C.length;B++){_formDialogButtonOnClicks[B]=RRTUtils.disableOnClick(C[B]);Element.addClassName(C[B],"disabled")}if(A){Element.hide("milestone_dialog_saving_message");Element.show("milestone_dialog_loading_message")}else{Element.hide("milestone_dialog_loading_message");Element.show("milestone_dialog_saving_message")}Element.show("milestone_dialog_working_message")},enableFormDialog:function(){FullWeb.enableGlobalKeyboardShortcuts();var B=document.getElementsByClassName("dialog_button");for(var A=0;A<B.length;A++){B[A].onclick=_formDialogButtonOnClicks[A];Element.removeClassName(B[A],"disabled")}_formDialogButtonOnClicks=null;Element.hide("milestone_dialog_working_message")},showConfirmDialog:function(F,B,D,C){if(g_confirmDialogActive){return }g_confirmDialogActive=true;var E={url:B,options:{method:"get"}};var A={className:g_className,width:D,draggable:true,showEffect:Element.show,hideEffect:Element.hide,onOk:function(G){if(C&&C.onOk){C.onOk()}g_confirmDialogActive=false;return true},onCancel:function(G){if(C&&C.onCancel){C.onCancel()}g_confirmDialogActive=false}};E.options.onFailure=function(G){g_confirmDialogActive=false;A.onClose()};if(F!=null){RRTDialog.replaceOnClickDuringDialog(F,A)}FullWeb.showAjaxMessage();E.options.onComplete=function(G){FullWeb.hideAjaxMessage()};Dialog.confirm(E,A);observer={onShow:function(H,I){var G=$("default_confirm_button");if(G){G.focus()}if(C&&C.focusElement){RRTUtils.focusFormTextElement(C.focusElement)}},onDestroy:function(G,H){Windows.removeObserver(this)}};Windows.addObserver(observer)},replaceOnClickDuringDialog:function(obj,options){var old_onclick=RRTUtils.disableOnClick(obj);if(old_onclick){var body="obj.onclick ="+old_onclick.toString();options.onClose=function(win){eval(body)}}},saveComplete:function(A){RRTDialog.closeDialog(A);FullWeb.enableGlobalKeyboardShortcuts()},saveAndAddComplete:function(){RRTDialog.enableFormDialog();RRTUtils.focusFirstElement("form")},saveDialog:function(){Dialog.okCallback()},cancelDialog:function(){g_formDialogActive=false;g_dialogActive=false;g_confirmDialogActive=false;g_enterKeyOverriden=false;g_escKeyOverriden=false;g_dialogOptions=null;Dialog.cancelCallback()},closeDialog:function(A){g_formDialogActive=false;g_dialogActive=false;g_confirmDialogActive=false;g_enterKeyOverriden=false;g_escKeyOverriden=false;g_dialogOptions=null;var B=Windows.focusedWindow;if(B!=null){$$("#"+B.getId()+" input").each(function(C){C.onclick=null});B.close()}if((A!=null)&&(A==true)){RRTUtils.refreshPage()}},updateDialogHeight:function(){var A=Windows.focusedWindow;A.setSize(A.width,A.content.scrollHeight,false)},setSaveAddField:function(A){RRTUtils.setHiddenValue("save_add",A)},dialogActive:function(){return g_dialogActive},formDialogActive:function(){return g_formDialogActive},confirmDialogActive:function(){return g_confirmDialogActive},enterKeyOverriden:function(){return g_enterKeyOverriden},processEnterKey:function(){if(g_dialogOptions&&g_dialogOptions.onEnterKey){g_dialogOptions.onEnterKey()}},escKeyOverriden:function(){return g_escKeyOverriden},processEscKey:function(){if(g_dialogOptions&&g_dialogOptions.onEscKey){g_dialogOptions.onEscKey()}}};Windows.overlayShowEffectOptions={duration:0};Windows.overlayHideEffectOptions={duration:0};Window.keepMultiModalWindow=true;Ajax.PeriodicalRequest=Class.create(Ajax.Base,{initialize:function($super,B,A){$super(A);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.request={};this.url=B;this.start()},start:function(){this.options.onComplete=this.requestComplete.bind(this);this.onTimerEvent()},stop:function(){this.request.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},requestComplete:function(A){if(this.options.decay&&(this.options.decay>1)){this.decay=(A.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=A.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.request=new Ajax.Request(this.url,this.options)}})