var COMMENT_URL="";var COMMENT_WINDOW_NAME="CommentWindow";var COMMENT_WINDOW_FEATURES="scrollbars=no,titlebar=no,resizable=yes,alwaysRaised=yes,menubar=no,location=no,status=no,toolbar=no,directories=no,width=570,height=300";var hitSubmit=false;function showComment(){return create_comment()}function create_comment(){var a=do_window_open(COMMENT_URL,COMMENT_WINDOW_NAME,COMMENT_WINDOW_FEATURES);return a}function goLogin(){url=document.fm.login.value;rep=new RegExp("returnto=.*error=");orig="returnto="+escape(window.opener.location)+"&error=";url=url.replace(rep,orig);do_window_open(url,"");window.close()}function finishedLoading(){reloadOriginal()}function reloadOriginalWithAnchor(a){baseurl=document.fm.baseurl.value;origtype=document.fm.origtype.value;project=document.fm.project.value;url=""+window.opener.location;wasContentSearch=document.fm.wasContentSearch.value;anchorpos=url.lastIndexOf("#");if(anchorpos!=-1){url=url.substring(0,anchorpos-1)}url=removeURLParameter(url,"cacheid");date=new Date();id=""+date.getTime();url+="&cacheid="+id;url+=a;if(url.indexOf("?")==-1){return false}if(origtype==""||origtype=="np"||origtype=="search"||origtype=="home"||wasContentSearch=="true"){return false}if(userAgentName=="iewin"){window.opener.navigate(url)}else{window.opener.location=url}setTimeout("window.close()",1000);return true}function reloadOriginal(){reloadOriginalWithAnchor("")}function replaceProject(b,c){rep=new RegExp("proj=[^&]*");str="proj="+encode_url_parameter(c);var a=b.replace(rep,str);return a}function replaceType(a){rep=new RegExp("type=[^&]*");if(a.match(rep)){a=a.replace(rep,"type=single")}else{a+="&type=single"}return a}function replaceVolume(b){var c;var a=b;if(b.indexOf("hvolume=brief")!=-1){c=new RegExp("hvolume=brief");a=b.replace(c,"hvolume=comments")}if(b.indexOf("hvolume=full")!=-1){c=new RegExp("hvolume=full");a=b.replace(c,"hvolume=comments")}if(b.indexOf("&brief=c")==-1){a=b+"&brief=c"}return a}function submit_comment(){if(hitSubmit==true){alert(i18n("comment_already_submitted_be_patient","The comment has been submitted. Please be patient."));document.fm.fb_submit.value="Multiple Submit";document.fm.submit()}else{if(document.fm.content.value==""){if(confirm(i18n("comment_confirm_blank_comment","Do you really wish to submit a blank comment?"))){hitSubmit=true;document.fm.fb_submit.value="Submit Comment";document.fm.submit()}}else{hitSubmit=true;document.fm.fb_submit.value="Submit Comment";document.fm.submit()}}}function change_view(){document.fm.fb_submit.value="Change View";document.fm.submit()}function change_project(){document.fm.fb_submit.value="";document.fm.submit()}function comment_setup_resize(){register_resize("modern_comment_",document.fm.content,document.body,1,1,100,100);window.onresize=handle_resize;handle_resize()}function checkCommentContent(b){var a=document.getElementById(b.toLowerCase()+"ac");if(isRichText){var c=new String(a.value);if(c=="
\n
"){a.value="";document.getElementById("mce_editor_"+mceIndices[b.toLowerCase()+"ac"]).contentWindow.document.body.innerHTML=""}}if(trim(a.value)==""||(isRichText&&isHTMLWhiteSpace(a.value))){alert(i18n("editformparser_error_message_no_title_and_content_comment","Please supply some content for this comment."));return false}else{return true}}function checkCommentProject(a){if(getHtmlCommentFormFromEncodedTractionId(a).edit_project.value!=""){return true}else{alert(i18n("comment_alert_message_submit_choose_project","Please select a project to which this comment should be posted."));return false}}function submitComment(a,c,b){Debug.println('submitComment("'+a+'", '+(c?"submit inline":"submit normal")+", "+(b?"display new form":"don't display new form")+")");if(c){submitInlineComment(a,b)}else{submitRegularComment(a)}}function submitInlineComment(a,c){var b=getHtmlCommentFormFromEncodedTractionId(a);if(!validateCommentInput(a)){return}if(!comment_submit(a,c)){submitRegularComment(a)}}var singletargetid;function submitRegularComment(a){singletargetid=a;var b=getHtmlCommentFormFromEncodedTractionId(a);if(b==null){return}go("Custom Action",b)}function validateCommentInput(c){var e=getHtmlCommentFormFromEncodedTractionId(c);if(isRichText){richTextCleanup("mce_editor_"+mceIndices[c.toLowerCase()+"ac"])}else{try{if(e.edit_simplify_on_submit.value!="false"){e.edit_simplify_on_submit.value="false";e.edit_format.value="text"}}catch(b){}}var d=checkCommentContent(c)&&checkCommentProject(c);if(!d){return false}if(isRichText&&e.edit_attach_urls!=null){var a=getExternalImageURLs(document.getElementById("mce_editor_"+mceIndices[c.toLowerCase()+"ac"]).contentWindow.document);if(a==null){return false}e.edit_attach_urls.value=a}return true}function waitforload_onsubmit(){return validateCommentInput(singletargetid)}function closeInlineComment(b){var a=document.getElementById(b.toLowerCase()+"ac");if(a==null){return}if(isRichText){tinyMCE.triggerSave(true,true)}var c;if(!(trim(a.value)==""||(isRichText&&isHTMLWhiteSpace(a.value)))){c=confirm(i18n("comment_alert_message_confirm_close","Are you sure you want to close this comment?"))}else{c=true}if(!c){return}commentform_remove(b)}function hasDescendantCommentForms(b){if(b==null){return false}var a=b.getElementsByTagName("textarea");return((a!=null)&&(a.length!=0))}function getHtmlCommentIdFromTractionId(a){return getHtmlIdFromTractionId(a)+"c"}function pageContainsComment(a){return(getCommentContainerFromTractionId(a)!=null)}function getCommentContainerFromTractionId(a){return document.getElementById(getHtmlCommentIdFromTractionId(a))}function getHtmlCommentFormIdFromTractionId(a){return getHtmlCommentFormIdFromEncodedTractionId(encode_url_parameter(a))}function getHtmlCommentFormFromTractionId(a){return document.getElementById(getHtmlCommentFormIdFromTractionId(a))}function getHtmlCommentFormIdFromEncodedTractionId(a){return a.toLowerCase()+"cfm"}function getHtmlCommentFormFromEncodedTractionId(a){return document.getElementById(getHtmlCommentFormIdFromEncodedTractionId(a))}function getHtmlCommentFormInsertionPointIdFromTractionId(a){return getHtmlCommentFormInsertionPointIdFromEncodedTractionId(encode_url_parameter(a))}function getHtmlCommentFormInsertionPointIdFromEncodedTractionId(a){return a.toLowerCase()+"cs"}function getHtmlCommentFormInsertionPointFromEncodedTractionId(a){return document.getElementById(getHtmlCommentFormInsertionPointIdFromEncodedTractionId(a))}function getHtmlCommentFormInsertionPointFromTractionId(a){return document.getElementById(getHtmlCommentFormInsertionPointIdFromTractionId(a))}function updateWithNewEntry(a){var b=false;var c=true;if(a.fm.edit_comment_id!=null){if(a.fm!=null&&a.fm.edit_comment_id){b=comment_popupinsert(encode_url_parameter(a.id).toLowerCase(),encode_url_parameter(a.fm.edit_comment_id.value),null);inlinecomment_.unregisterFormID(getHtmlCommentFormIdFromTractionId(a.fm.edit_comment_id.value))}}else{if(a.isupdate&&pageContainsComment(a.id)){c=!hasDescendantCommentForms(document.getElementById(getHtmlCommentIdFromTractionId(a.id)));if(c){b=comment_refresh(getHtmlIdFromTractionId(a.id),null,true)}}}if(c&&!b&&!a.refreshOpener){if(a.fm.edit_comment_id!=null&&a.fm!=null&&a.fm.baseurl!=null){b=reloadWithAnchor(a.fm,"#"+a.id+"c");if(!b&&a.parentEntryUrl!=null&&a.parentEntryUrl!=""){a.newEntryUrl=a.parentEntryUrl+"#"+a.id+"c"}}else{if(a.isupdate&&a.fm!=null&&a.fm.baseurl!=null){if(pageContainsComment(a.id)){b=reloadWithAnchor(a.fm,"#"+a.id+"c")}}}}if(!b){if(c){if(a.refreshOpener){if(a.fm&&a.fm.baseurl&&(window.location.href==a.fm.baseurl.value)){window.location.reload(true)}else{if(a.fm&&a.fm.baseurl){window.location.href=a.fm.baseurl.value}else{window.location.href=a.newEntryUrl}}}else{window.location.href=a.newEntryUrl}}else{if(a.refreshOpener){var d="";if(a.fm==null||a.fm.baseurl==null||trim(a.fm.baseurl.value)==""){d=window.location.href}else{d=a.fm.baseurl.value}window.open(d)}else{window.open(FORM_ACTION_READ_ONLY+"?type=single&rec="+a.id)}}}};