var http = getHTTPObject(); function toggle_comment_form() { oForm = document.getElementById("fComment"); if (oForm) { oForm.style.display = ''; oLink = document.getElementById("LeftLink"); if (oLink) oLink.id = "LeftLink_off"; oLink = document.getElementById("RightLink"); if (oLink) oLink.id = "RightLink_off"; } } function check_comment(obj) { if (!check_text(obj.Comment,"COMMENT")) return false; vAuthType = getCheckedValue(obj.AuthType); if (vAuthType==1) { if (!check_text(obj.Name,"NAME")) return false; if ((!isBlank(obj.Email.value))||(obj.Notify.checked)) if (!check_email(obj.Email,"EMAIL")) return false; if (!check_text(obj.Code,"CODE")) return false; } else if (vAuthType==2) { if (!check_text(obj.NameOpenID,"OpenID")) return false; if ((!isBlank(obj.EmailOpenID.value))||(obj.Notify.checked)) if (!check_email(obj.EmailOpenID,"Email")) return false; } else if (vAuthType==3) { if (!check_text(obj.NameLJ,"LiveJournal ID")) return false; if ((!isBlank(obj.EmailLJ.value))||(obj.Notify.checked)) if (!check_email(obj.EmailLJ,"Email")) return false; } if (obj.Save.checked) { ttl = 14; createCookie("comment_Public",unescape(obj.Public.checked),ttl); createCookie("comment_Notify",unescape(obj.Notify.checked),ttl); createCookie("comment_Save",unescape(obj.Save.checked),ttl); createCookie("comment_AuthType",unescape(vAuthType),ttl); if (vAuthType==1) { createCookie("comment_Name",unescape(obj.Name.value),ttl); createCookie("comment_Email",unescape(obj.Email.value),ttl); } else if (vAuthType==2) { createCookie("comment_Name",unescape(obj.NameOpenID.value),ttl); createCookie("comment_Email",unescape(obj.EmailOpenID.value),ttl); } else if (vAuthType==3) { createCookie("comment_Name",unescape(obj.NameLJ.value),ttl); createCookie("comment_Email",unescape(obj.EmailLJ.value),ttl); } } else { eraseCookie("comment_Public"); eraseCookie("comment_Notify"); eraseCookie("comment_Save"); eraseCookie("comment_AuthType"); eraseCookie("comment_Name"); eraseCookie("comment_Email"); } return true; } function reloadCaptcha() { http.open("GET","/cfc/security.cfc?method=generateCaptcha",true); http.onreadystatechange = handle_captcha; http.send(null); return false; } function handle_captcha() { if (http.readyState == 4) { if (http.status == 200) { if (document.all) des = new WddxDeserializerForIE; else des = new WddxDeserializer; var xml = des.deserialize(http.responseText); oImg = document.getElementById("Captcha"); oImg.src = "/go/captcha/"+xml+"/"; oForm = document.getElementById("fComment"); oForm.Captcha.value = xml; } else { alert("There was a problem retrieving the XML data: \n" + http.statusText); } } } function toggle_auth() { divOne = document.getElementById("divAuthOne"); divTwo = document.getElementById("divAuthTwo"); divThree = document.getElementById("divAuthThree"); oForm = document.getElementById("fComment"); vAuthType = getCheckedValue(oForm.AuthType); if (vAuthType==1) { divOne.style.display = ""; divTwo.style.display = "none"; divThree.style.display = "none"; } else if (vAuthType==2) { divOne.style.display = "none"; divTwo.style.display = ""; divThree.style.display = "none"; } else if (vAuthType==3) { divOne.style.display = "none"; divTwo.style.display = "none"; divThree.style.display = ""; } } function getCheckedValue(radioObj) { if(!radioObj) return ""; var radioLength = radioObj.length; if(radioLength == undefined) if(radioObj.checked) return radioObj.value; else return ""; for(var i = 0; i < radioLength; i++) { if(radioObj[i].checked) { return radioObj[i].value; } } return ""; }