var show_up_level = 3 ;var header_up_level = 2 ;var is_debug_log_enabled = 0; var sz_is_auto_layout = 1; var sz_high_sibling = 0; var sz_low_sibling = 0; SezWho = { Version: '1.3.0' } ; SezWho.Utils = {} ; // class for rendering the sezwho UI for each comment SezWho.PluginCore = new function () { try { this.szManageEmbedUI = function () { SezWho.Utils.log("info", "called SezWho.PluginCore.szManageEmbedUI "); if (window.sz_global_config_params == null || document.getElementById('cpEmbedPageTableid') || window.sz_comment_config_params == null || window.sz_comment_config_params.comment_number == null) { return; } var post_id = sz_comment_config_params.post_id ; var sortScore = sz_comment_config_params.sortOrder ; var isErrorShown = "false" ; if (sortScore == '') sortScore = 0 ; if (sz_comment_config_params.comment_number != sz_comment_config_params.sz_comment_data.length) sz_comment_config_params.comment_number = sz_comment_config_params.sz_comment_data.length; if (sz_comment_config_params.sz_auto_option_bar) { var fb = get_show_comment_dropdown_div(); var fbph = document.getElementById('szOptionBarPlaceHolder'); fbph.parentNode.replaceChild(fb, fbph); } else { var cn = SezWho.BlogPlatformCallbackJS.get_top_of_first_comment(sz_comment_config_params.sz_comment_data[0].comment_id); var showCommentDiv = get_show_comment_dropdown_div(); try { if (cn && cn.parentNode) cn.parentNode.insertBefore(showCommentDiv, cn); } catch (e) { if (isErrorShown == "false" ) { SezWho.Utils.log("error", "We could not handle this theme, please use the manual modification of theme as outlined in http://www.SezWho.com/FAQ.php."); isErrorShown = "true" ; return ; } } } // loop over the comment score information passed and populate the comment header and footer var hn, fn, ccd; for (var co2 = 0 ; co2 < sz_comment_config_params.comment_number; co2++) { if (typeof(sz_comment_config_params.sz_comment_data[co2]) == "undefined") continue; if (sz_comment_config_params.sz_comment_data[co2].comment_score == 0) continue; hn = null; fn = null; ccd = null; if (sz_comment_config_params.sz_auto_comment){ try { var hnode = document.getElementById('szCommentHeaderPlaceHolder:'+co2); var hnp = hnode; ccd = get_composite_div(co2); // In case there are no siblings where the hnode is (case of a div around comment header) while (!hnp.nextSibling) hnp = hnp.parentNode; while (hnp && hnp.nextSibling) ccd.appendChild(hnp.nextSibling); if (hnp && hnp.parentNode) hnp.parentNode.appendChild(ccd); // Now handle the header hn = get_comment_header_div(co2, sz_comment_config_params.sz_comment_data[co2].comment_score, get_commenter_display(co2)); hnode.parentNode.replaceChild(hn, hnode); // Footer var fnode = document.getElementById('szCommentFooterPlaceHolder:'+co2); if (fnode){ fn = get_comment_footer_div(co2); fnode.parentNode.replaceChild(fn, fnode); } } catch (e) { if (isErrorShown == "false") { SezWho.Utils.log("error", "We could not handle this theme, please use the manual modification of theme as outlined in http://www.SezWho.com/FAQ.php ."); isErrorShown = "true" ; return ; } } } else { var comment_node = SezWho.BlogPlatformCallbackJS.get_comment_node(sz_comment_config_params.sz_comment_data[co2].comment_id); if (!comment_node) comment_node = SezWho.BlogPlatformCallbackJS.get_comment_node_by_calc(sz_comment_config_params.sz_comment_data[co2].comment_id,1); if (!comment_node) continue; try { hn = get_comment_header_div(co2, sz_comment_config_params.sz_comment_data[co2].comment_score, get_commenter_display(co2)); fn = get_comment_footer_div(co2); //first insert the footer elements comment_node.insertBefore(fn, null); //Next create the composite Div and insert it ccd = get_composite_div(co2); while (comment_node.firstChild) ccd.appendChild(comment_node.firstChild); comment_node.appendChild(ccd); // Last insert the comment header node. comment_node.insertBefore(hn,ccd); } catch (e) { if (isErrorShown == "false") { SezWho.Utils.log("error", "We could not handle this theme, please use the manual modification of theme as outlined in http://www.SezWho.com/FAQ.php ."); isErrorShown = "true" ; return ; } } } // Now setup the event handlers var ll = null; if (hn){ var pl = null; ll = hn.getElementsByTagName("A"); for (var i = 0; i < ll.length; i++) if (ll[i].className == 'cpEmbedPageProfileLinkCustom') {pl = ll[i]; break;} if (pl){ sz_cp_proto.observe(pl,"mouseover", SezWho.Utils.cpProfileEventHandler); sz_cp_proto.observe(pl,"mouseout", function(ev) { SezWho.DivUtils.cancelPopUp(); }); sz_cp_proto.observe(pl,"mousedown", SezWho.Utils.cpProfileEventHandler); } ll = hn.getElementsByTagName("IMG"); for (var i = 0; i < ll.length; i++) if (ll[i].className == 'cpEmbedImageUserh') {pl = ll[i]; break;} if (pl){ sz_cp_proto.observe(pl,"mouseover", SezWho.Utils.cpProfileEventHandler); sz_cp_proto.observe(pl,"mouseout", function(ev) { SezWho.DivUtils.cancelPopUp(); }); } } if (fn) { ll = fn.getElementsByTagName("INPUT"); for (var i = 0; i < ll.length; i++) if (SezWho.Utils.isOpera() || ((/Safari|Konqueror|KHTML/gi).test(navigator.userAgent) && !(/Safari\/5/gi).test(navigator.userAgent))) sz_cp_proto.observe(ll[i],"click", SezWho.Utils.szHandleRatingButtonClicks); else sz_cp_proto.observe(ll[i],"mousedown", SezWho.Utils.szHandleRatingButtonClicks); } if (ccd) { var n = unescape(sz_comment_config_params.sz_comment_data[co2].comment_author); var els = ccd.getElementsByTagName("*"); var re = new RegExp("(^\\s*)" + n + "(\\s*$)") ; for(var i=0,j=els.length; i What is this?

"; if (navigator.userAgent.match(/msie (5\.5|6)/i)&&navigator.platform=="Win32") //PNG fix iHtml = iHtml+""; else iHtml = iHtml+""; iHtml = iHtml+""; var div = document.createElement("div"); div.innerHTML = iHtml; return div; } function get_commenter_display(i) { var comment_author_anchor ; var comment_author = unescape(sz_comment_config_params.sz_comment_data[i].comment_author); var comment_author_url = sz_comment_config_params.sz_comment_data[i].comment_author_url; if (comment_author_url && comment_author_url.length > 0 && comment_author_url != "http://") comment_author_anchor = ""+comment_author+"" ; else comment_author_anchor = comment_author ; return comment_author_anchor; } function get_comment_header_div(i, cScore, comment_author) { if (cScore == 0) return ""; var iHtml = ""; if (sz_comment_config_params.sz_show_commenter_pic != 1) iHtml = iHtml+ "" iHtml = iHtml+"
"+unescape(sz_comment_config_params.sz_comment_data[i].comment_author)+""+comment_author+" (Check me out!)
"+SezWho.Utils.get_star_rating(cScore, "comment")+"
" ; var div = document.createElement("div"); div.innerHTML = iHtml; return div; } function get_comment_footer_div(i) { var iHtml = "

Was this comment useful to you ?

"; var div = document.createElement("div"); div.innerHTML = iHtml; return div; } function get_composite_div(i) { SezWho.Utils.log("info" , "get_composite_div called with i = "+i); var commentCompositeDiv = document.createElement("div") ; commentCompositeDiv.id = "sz_comment_collapse_div:"+i ; commentCompositeDiv.className = "cpEmbedPageCommentBodyCollapseDivCustom"; if (sz_comment_config_params.sz_show_commenter_pic==1) commentCompositeDiv.innerHTML = ""; return commentCompositeDiv ; } } catch (e) { } }; /* End of SezWho.PluginCore class */ /* Start PopupWindow class */ function PopupWindow() { if (!window.popupWindowIndex) { window.popupWindowIndex = 0; } if (!window.popupWindowObjects) { window.popupWindowObjects = new Array(); } if (!window.listenerAttached) { window.listenerAttached = true; PopupWindow_attachListener(); } this.index = popupWindowIndex++; popupWindowObjects[this.index] = this; this.divName = null; this.popupWindow = null; this.event = new function() {this.type=null,this.ClientX=0,this.ClientY=0;ScreenX=0;ScreenY=0;}; this.visible = false; this.autoHideEnabled = false; this.contents = ""; if (arguments.length>0) { this.type="DIV"; this.divName = arguments[0]; } this.use_gebi = false; this.use_css = false; this.use_layers = false; if (document.getElementById) { this.use_gebi = true; } else if (document.all) { this.use_css = true; } else if (document.layers) { this.use_layers = true; } else { this.type = "WINDOW"; } // Method mappings this.refresh = PopupWindow_refresh; this.showPopup = PopupWindow_showPopup; this.hidePopup = PopupWindow_hidePopup; this.isClicked = PopupWindow_isClicked; this.autoHide = PopupWindow_autoHide; this.hideIfNotClicked = PopupWindow_hideIfNotClicked; this.updateEvent = PopupWindow_updateEvent; // Refresh the displayed contents of the popup function PopupWindow_refresh() { if (this.divName != null) { // refresh the DIV object document.getElementById(this.divName).innerHTML = this.contents; } } // Position and show the popup, relative to an anchor object function PopupWindow_showPopup() { this.x = this.event.ScreenX + this.offsetX; this.y = this.event.ScreenY + this.offsetY; if (!this.populated && (this.contents != "")) { this.populated = true; this.refresh(); } if (this.divName != null) { // Show the DIV object document.getElementById(this.divName).style.left = this.x + "px"; document.getElementById(this.divName).style.top = this.y + "px"; document.getElementById(this.divName).style.visibility = "visible"; } } // Hide the popup function PopupWindow_hidePopup() { if (this.divName != null) { SezWho.DivUtils.closediv(this.divName); } } // Check an onMouseDown event to see if we should hide function PopupWindow_hideIfNotClicked(e) { if (this.autoHideEnabled && !this.isClicked(e)) { this.hidePopup(); } } // Call this to make the DIV disable automatically when mouse is clicked outside it function PopupWindow_autoHide() { this.autoHideEnabled = true; } // Pass an event and return whether or not it was the popup DIV that was clicked function PopupWindow_isClicked(e) { if (this.divName != null) { var t = sz_cp_proto.element(e); while (t && t.parentNode) { if (t.id==this.divName) return true; t = t.parentNode; } return false; } return false; } // This global function checks all PopupWindow objects onmouseup to see if they should be hidden function PopupWindow_hidePopupWindows(e) { for (var i=0; i vp_height - div_height) { top_viewport_y = vp_height - div_height - 1; } if (top_viewport_x < 0) { top_viewport_x = 1; } if (top_viewport_x > vp_width - div_width) { top_viewport_x = vp_width - div_width - 1; } var co_ords = new Object(); co_ords[0] = shift_offset_x + (top_viewport_x - start_top_x); co_ords[1] = shift_offset_y + (top_viewport_y - start_top_y); SezWho.Utils.log("info" , "SezWho.PopupPositionUtils.get_offsets returning co-ordinates : x = "+co_ords[0]+" : y = "+co_ords[1]); return co_ords ; } function getViewportHeight() { var h=-1; var m=document.compatMode; if((m || SezWho.Utils.isIE()) && ! SezWho.Utils.isOpera()) { switch(m) { case "CSS1Compat":h=document.documentElement.clientHeight; break; default:h=document.body.clientHeight; } } else { //h=self.innerHeight; h=self.innerHeight>document.documentElement.clientHeight ? document.documentElement.clientHeight : self.innerHeight ; } return h; } function getViewportWidth() { var w=-1; var m=document.compatMode; if(m || SezWho.Utils.isIE()) { switch(m) { case "CSS1Compat":w=document.documentElement.clientWidth; break; default:w=document.body.clientWidth; } } else { w=self.innerWidth; } return w; } } ; /* end PopupPositionUtils class */ /* start SezWho.DivUtils class */ SezWho.DivUtils = new function () { this.createRatingsDiv = function () { var ratingDiv = document.createElement("div"); ratingDiv.id = "ratingDiv"; ratingDiv.className = "cpPopupWrapper"; ratingDiv.innerHTML = "

Rate Comment

Please enter your email address. Your identification helps us score the comment better. Your address will be kept private and will not be shown to other users.

Email:
"; var bodyTag = document.getElementsByTagName("body")[0]; bodyTag.appendChild(ratingDiv); return ratingDiv; } this.createProfileDiv = function () { var profileDiv = document.createElement("div"); profileDiv.id = "profilepopup"; profileDiv.className = "cpPopupWrapper"; profileDiv.innerHTML = "

Public Profile

loading
"; var bodyTag = document.getElementsByTagName("body")[0]; bodyTag.appendChild(profileDiv); return profileDiv; } this.submitRatingForm = function(form, setcookieflag) { SezWho.Utils.log("info" , "submitRatingForm called with : cppluginurl = "+sz_global_config_params.cppluginurl); var req = null; var ratingIncrement= form.ratingIncrement.value ; var postID= form.postID.value; var i= form.commentID.value; var emailID= form.emailID.value; var index1 = emailID.indexOf("@"); var index2 = emailID.indexOf("."); var index3 = emailID.indexOf(" "); if (index1 <= 0 || index2 <= 0 || index3 > 0 ) { alert("Please enter a valid email address."); document.getElementById("ratingDiv").style.display = 'none' ; return ; } //Setup wait state document.getElementById("sz_comment_score:"+i).innerHTML = "loading"; // now set cookie if (setcookieflag) SezWho.Utils.setCookie("SZ_EMAIL_COOKIE" , emailID, 100); var formParam = 'ratingIncrement='+escape(ratingIncrement)+'&postID='+escape(postID)+'&commentID='+escape(sz_comment_config_params.sz_comment_data[i].comment_id)+'&emailID='+encodeURIComponent(emailID)+'&msec='+SezWho.Utils.getTimeStamp()+'&__mode=cp_comment_rating_submit'; var comment_rating_submit_path = sz_comment_config_params.comment_rating_submit_path ; if(sz_comment_config_params.use_cross_domain_posting) { SezWho.Utils.makeJSCall(sz_global_config_params.cppluginurl+comment_rating_submit_path+"?return_js=true&"+formParam); } else { var req = null; if(window.XMLHttpRequest) req = new XMLHttpRequest(); else if (window.ActiveXObject) req = new ActiveXObject("Microsoft.XMLHTTP"); req.onreadystatechange = function() { if(req.readyState == 4) { if(req.status == 200) { var response = req.responseText; //alert(response); SezWho.DivUtils.handleCommentRating(response); } } }; req.open('POST', cppluginurl+comment_rating_submit_path , true); req.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8"); req.send(formParam); } } this.handleBadgeData = function(sz_badge_data_params) { var html_output; if (navigator.userAgent.match(/msie (5\.5|6)/i)&&navigator.platform=="Win32") //PNG fix html_output = ""; else html_output = "
"; var widget_placeholder = "sezwho_badge_" + sz_badge_data_params['widget_no'] + "_placeholder"; var currentLength = sz_badge_data_params['widget_no']; sz_badge_config_params.sz_badge_data[currentLength] = sz_badge_data_params; html_output = html_output + ""; html_output = html_output + ""; html_output = html_output + ""; html_output = html_output + ""; html_output = html_output + ""; html_output = html_output + "
" + sz_badge_config_params.sz_badge_data[currentLength]['formatted_name'] + "
Star Power:
" + SezWho.Utils.get_star_rating(sz_badge_config_params.sz_badge_data[currentLength]['sz_score'], "badge") + "
"; document.getElementById(widget_placeholder).innerHTML = html_output; } this.handleRedCarpetData = function(sz_rc_data_params, sz_rc_input_params) { var html_output = ''; sz_rc_config_params.sz_rc_data = sz_rc_data_params; html_output = html_output + ""; if (navigator.userAgent.match(/msie (5\.5|6)/i)&&navigator.platform=="Win32") //PNG fix html_output = html_output + ""; else html_output = html_output + ""; for(var i=0; i"; if (sz_rc_input_params['sz_use_blog_catalog_for_rc']==1) { if (sz_rc_config_params.sz_rc_data[i]['comment_author_url'] && sz_rc_config_params.sz_rc_data[i]['comment_author_url'].length > 0) html_output = html_output + ""; else html_output = html_output + ""; } else { if (sz_rc_config_params.sz_rc_data[i]['comment_author_url'] && sz_rc_config_params.sz_rc_data[i]['comment_author_url'].length > 0) html_output = html_output + ""; else html_output = html_output + ""; } html_output = html_output + ""; html_output = html_output + ""; html_output = html_output + ""; } html_output = html_output +"
Red Carpet
" + unescape(sz_rc_config_params.sz_rc_data[i]['comment_author']).replace(/\+/g, " ") + "
" + SezWho.Utils.get_star_rating(sz_rc_config_params.sz_rc_data[i]['sz_score'], "redcarpet") + "
View Comment
"; document.getElementById('cp_rc_placeholder').innerHTML = html_output; } this.handleCommentRating = function(response) { var ratingIncrement= document.getElementById('cpEmailForm').ratingIncrement.value ; var i= document.getElementById('cpEmailForm').commentID.value; var responseArr = response.split(','); var status ; if (responseArr[0]) status = responseArr[0].split('=')[1]; if (status == 'Failure' || status == 'N') { var errorMsgCode = responseArr[1].split('=')[1]; var errorMsg = "Failure in processing!"; if (errorMsgCode == "DuplicateRatingInsertion") errorMsg = "You can not rate same comment again!" ; if (errorMsgCode == "NoSiteKey") errorMsg = "No Site Key found!" ; if (errorMsgCode == "InvalidSiteKey" || errorMsgCode == "SITEKEYERR") errorMsg = "Invalid Site Key found!" ; if (errorMsgCode == "EmailInsertionFailure") errorMsg = "Failure inserting your email ID!" ; if (errorMsgCode == "RatingInsertionFailure") errorMsg = "Failure inserting your rating!" ; if (errorMsgCode == "NoBlogKey") errorMsg = "No Blog Key found!" ; if (errorMsgCode == "SelfRating") errorMsg = "You can not rate your own comment!" ; document.getElementById("sz_comment_score:"+i).innerHTML = SezWho.Utils.get_star_rating(sz_comment_config_params.sz_comment_data[i].comment_score, "comment"); SezWho.DivUtils.activateRatingsDIV(errorMsg); } else { var commentScoreDiv = document.getElementById("sz_comment_score:"+i); var comment_score = responseArr[1].split('=')[1]; commentScoreDiv.innerHTML = SezWho.Utils.get_star_rating(comment_score, "comment"); sz_comment_config_params.sz_comment_data[i].comment_score = comment_score; } } this.activateRatingsDIV = function(errorMsg) { // create the popup irrespective of whether the cookie exists or not. This is to display show error messages var divName = "ratingDiv"; if (errorMsg != ""){ var errorDiv = document.getElementById("popuperror") ; errorDiv.className = "cpPopupErrorSpanDisplayed"; errorDiv.innerHTML = errorMsg; document.getElementById('popuperror').style.visibility='visible'; } var divPopUp = PopupWindow.findPopupWindow(divName); divPopUp.autoHide(); var co_ordinates = SezWho.PopupPositionUtils.get_offsets(1, divName, divPopUp); divPopUp.offsetX = co_ordinates[0] ; divPopUp.offsetY = co_ordinates[1] ; var mainDiv = document.getElementById(divName) ; mainDiv.style.display = 'block' ; mainDiv.style.visibility = 'visible' ; divPopUp.showPopup(); } this.displayProfileData = function (name,data){ sz_cp_proto.replace(document.getElementById('cpPopupContentloadingId'), data); if (name != '') document.getElementById('cpPopupHeaderTitleTextId').innerHTML = name; var divPopUp = PopupWindow.findPopupWindow("profilepopup"); var co_ordinates = SezWho.PopupPositionUtils.get_offsets(0, "profilepopup", divPopUp); divPopUp.offsetX = co_ordinates[0] ; divPopUp.offsetY = co_ordinates[1] ; divPopUp.showPopup(); } this.loadProfilePopUp = function(url, divName, author_name) { SezWho.Utils.log("info" , "SezWho.DivUtils.loadProfilePopUp called with cpserverurl = "+sz_global_config_params.cpserverurl+" : cppluginurl = "+sz_global_config_params.cppluginurl+" : url = "+url+" : divName = "+divName+" : author_name = "+author_name); var profileDiv = document.getElementById(divName); if (profileDiv == null) profileDiv = this.createProfileDiv(); else { if (document.getElementById('cpPopupContentBodyID')) sz_cp_proto.replace(document.getElementById('cpPopupContentBodyID'), "
loading
"); } document.getElementById('cpPopupHeaderTitleTextId').innerHTML = author_name; var divPopUp = PopupWindow.findPopupWindow(divName); if (!divPopUp) divPopUp= new PopupWindow(divName); divPopUp.autoHide(); var co_ordinates = SezWho.PopupPositionUtils.get_offsets(0, divName, divPopUp); divPopUp.offsetX = co_ordinates[0] ; divPopUp.offsetY = co_ordinates[1] ; divPopUp.showPopup(); SezWho.Utils.makeJSCall(url); } var divpopuptimerid = 0 ; this.loadMyProfileDiv = function(url, div, author_name, delay, ev){ SezWho.Utils.log("info" , "SezWho.DivUtils.loadMyProfileDiv called with cpserverurl = "+sz_global_config_params.cpserverurl+" : cppluginurl = "+sz_global_config_params.cppluginurl+" : url = "+url+" : div = "+div+" : author_name = "+unescape(author_name)+" : delay = "+delay+" : ev = "+ev); var w = PopupWindow.findPopupWindow(div); if (!w) w = new PopupWindow(div); w.updateEvent(ev); divpopuptimerid= setTimeout("SezWho.DivUtils.loadProfilePopUp('"+url+"','"+div+"','"+unescape(author_name)+"')", delay); } this.closediv = function(divid) { SezWho.Utils.log("info" ,"SezWho.DivUtils.closediv called with divid = "+divid); document.getElementById(divid).style.visibility='hidden'; if (divid == "ratingDiv") document.getElementById('popuperror').style.visibility='hidden'; } this.cancelPopUp = function() { SezWho.Utils.log("info" ,"SezWho.DivUtils.cancelPopUp called "); if(divpopuptimerid) clearTimeout(divpopuptimerid); } } ; /* end SezWho.DivUtils */ /* This following code has been adapted from the fabulous prototype JS framework.*/ SezWho.Utils.Prototype = function () { this.getElementsByClassName = function (node_id, className) { SezWho.Utils.log("info" ,"SezWho.Utils.Prototype.getElementsByClassName called with node_id = "+node_id+" : className = "+className); var node ; var els ; /* if (node_id == null) { node = document.body ; } else { node = document.getElementById(node_id); }*/ node = document.body ; var els = node.getElementsByTagName("*"); var a = []; var re = new RegExp("(^|\\s)" + className + "(\\s|$)") ; for(var i=0,j=els.length; i"; var half_img = ""; var zero_img = ""; if (score < 0.25) ratings_images = zero_img+zero_img+zero_img+zero_img+zero_img ; else if (score >= 0.25 && score < 0.75) ratings_images = half_img+zero_img+zero_img+zero_img+zero_img ; else if (score >= 0.75 && score < 1.25) ratings_images = full_img+zero_img+zero_img+zero_img+zero_img ; else if (score >= 1.25 && score < 1.75) ratings_images = full_img+half_img+zero_img+zero_img+zero_img ; else if (score >= 1.75 && score < 2.25) ratings_images = full_img+full_img+zero_img+zero_img+zero_img ; else if (score >= 2.25 && score < 2.75) ratings_images = full_img+full_img+half_img+zero_img+zero_img ; else if (score >= 2.75 && score < 3.25) ratings_images = full_img+full_img+full_img+zero_img+zero_img ; else if (score >= 3.25 && score < 3.75) ratings_images = full_img+full_img+full_img+half_img+zero_img ; else if (score >= 3.75 && score < 4.25) ratings_images = full_img+full_img+full_img+full_img+zero_img ; else if (score >= 4.25 && score < 4.75) ratings_images = full_img+full_img+full_img+full_img+half_img ; else if (score >= 4.75) ratings_images = full_img+full_img+full_img+full_img+full_img ; return ratings_images; } this.setLocalCookie = function(cookieName,cookieValue,nDays) { SezWho.Utils.log("info" ,"SezWho.Utils.setCookie called with cookieName = "+cookieName); var today = new Date(); var expire = new Date(); if (nDays==null || nDays==0) nDays=1; expire.setTime(today.getTime() + 3600000*24*nDays); document.cookie = cookieName+"="+escape(cookieValue)+ ";expires="+expire.toGMTString()+";path=/"; } this.setCookie = function(cookieName,cookieValue,nDays) { SezWho.Utils.setLocalCookie(cookieName,cookieValue,nDays); SezWho.Utils.makeJSCall(sz_global_config_params.cpserverurl+"/SetCookie/"+escape(cookieValue)+"/"+86400*nDays+"/"+SezWho.Utils.getTimeStamp()); //SezWho.Utils.makeJSCall(sz_global_config_params.cpserverurl+"/cookiehandler.php?op=SetCookie&user="+escape(cookieValue)+"&nDays="+nDays+"&time="+SezWho.Utils.getTimeStamp()); } this.makeJSCall = function(url) { var script = document.createElement('script'); script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } this.readSZCookie = function(email) { if (email != ""){ var szForm = document.getElementById('cpEmailForm'); SezWho.Utils.setLocalCookie("SZ_EMAIL_COOKIE" , email, 100); szForm.emailID.value = email ; SezWho.DivUtils.submitRatingForm(szForm, 0); } else SezWho.DivUtils.activateRatingsDIV(""); } this.getTimeStamp = function(name){ var d = new Date(); return d.getTime(); } this.readCookie = function(name) { var cookieVal = null; var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) { cookieVal = c.substring(nameEQ.length,c.length); return cookieVal; } } return cookieVal; } this.cpProfileEventHandler = function(ev) { SezWho.Utils.log("info" ,"SezWho.Utils.cpProfileEventHandler called with event = "+ev); var elm = sz_cp_proto.element(ev); var a = elm.id.split(":"); var i = elm.id; var delay=0; if (ev.type == "mouseover") delay=500; SezWho.DivUtils.loadMyProfileDiv(sz_global_config_params.cpserverurl+"/webservices/ykgetprofile.php?site_key="+sz_global_config_params.sitekey+"&blog_key="+sz_global_config_params.blogkey+"&blog_id="+sz_global_config_params.blogid+"&commenter_email="+encodeURIComponent(sz_comment_config_params.sz_comment_data[a[1]].comment_author_email)+"&isplugin=true&source=comment&comment_id="+sz_comment_config_params.sz_comment_data[a[1]].comment_id+"&posting_id="+sz_comment_config_params.post_id, 'profilepopup', sz_comment_config_params.sz_comment_data[a[1]].comment_author, delay, ev); } this.cpProfileImgClickHandler = function(i) { SezWho.Utils.openPage("pic","http://sezwho.com/mypublicprofile.php?commenter_email="+encodeURIComponent(sz_comment_config_params.sz_comment_data[i].comment_author_email)+"&isplugin=true&viewid=0"); } this.cpProfileRCEventHandler = function(ev) { SezWho.Utils.log("info" ,"SezWho.Utils.cpProfileEventHandler called with event = "+ev); var elm = sz_cp_proto.element(ev); var a = elm.id.split(":"); var i = elm.id; var delay=0; if (ev.type == "mouseover") delay=500; SezWho.DivUtils.loadMyProfileDiv(sz_global_config_params.cpserverurl+"/webservices/ykgetprofile.php?site_key="+sz_global_config_params.sitekey+"&blog_key="+sz_global_config_params.blogkey+"&blog_id="+sz_global_config_params.blogid+"&commenter_email="+encodeURIComponent(sz_rc_config_params.sz_rc_data[a[1]].comment_author_email)+"&isplugin=true&source=red_carpet", 'profilepopup', unescape(sz_rc_config_params.sz_rc_data[a[1]].comment_author), delay, ev); } this.cpProfileBadgeEventHandler = function(ev) { SezWho.Utils.log("info" ,"SezWho.Utils.cpProfileBadgeEventHandler called with event = "+ev); var elm = sz_cp_proto.element(ev); var a = elm.id.split(":"); var i = elm.id; var delay=0; if (ev.type == "mouseover") delay=500; SezWho.DivUtils.loadMyProfileDiv(sz_global_config_params.cpserverurl+"/webservices/ykgetprofile.php?site_key="+sz_global_config_params.sitekey+"&blog_key="+sz_global_config_params.blogkey+"&blog_id="+sz_global_config_params.blogid+"&commenter_email="+encodeURIComponent(sz_badge_config_params.sz_badge_data[a[1]].comment_author_email)+"&isplugin=true&source=badge", 'profilepopup', unescape(sz_badge_config_params.sz_badge_data[a[1]].comment_author), delay, ev); } this.szHandleRatingButtonClicks = function(ev){ var elm = sz_cp_proto.element(ev); var a = elm.id.split(":"); var divName = 'ratingDiv'; var ratingsDiv = document.getElementById(divName); if (ratingsDiv == null) { ratingsDiv = SezWho.DivUtils.createRatingsDiv (); } var szForm = document.getElementById('cpEmailForm'); szForm.postID.value = sz_comment_config_params.post_id; szForm.commentID.value = a[2]; if (elm.value == 'yes') szForm.ratingIncrement.value = '10' ; else //if (vote == 'no') szForm.ratingIncrement.value = '0' ; // create the popup irrespective of whether the cookie exists or not. var divPopUp = PopupWindow.findPopupWindow(divName); if (!divPopUp) { divPopUp= new PopupWindow(divName); } divPopUp.updateEvent(ev); //First read the local cookie var cookieVal = SezWho.Utils.readCookie("SZ_EMAIL_COOKIE"); if (cookieVal) { szForm.emailID.value = cookieVal ; SezWho.DivUtils.submitRatingForm(szForm,0); } else // Read the SezWho cookie SezWho.Utils.makeJSCall(sz_global_config_params.cpserverurl+"/cookiehandler.php?op=GetCookie&time="+SezWho.Utils.getTimeStamp()); elm.blur(); } this.openPage = function(type, url) { if('undefined' == typeof url) url = null; var name, options; name=""; options=""; if (type == "home") url = sz_global_config_params.cpserverurl; else if (type == "help") { url = sz_global_config_params.cpserverurl+"/popup_help.php"; name = "Help"; options = "height=820,width=600,toolbar=no,scrollbars,resizable"; } else if (url == null) url = sz_global_config_params.cpserverurl; window.open(url, name, options); } this.callJSFramework = function() { SezWho.Utils.log("info" ,"SezWho.Utils.callJSFramework called "); if (!document.getElementById("szProfAndEmbedStyleSheet")){ var stylesheet = document.createElement("link"); stylesheet.rel = "stylesheet"; stylesheet.type = "text/css"; stylesheet.href = sz_global_config_params.cpserverurl+"/css/"+sz_global_config_params.plugin_version+"/prof.css"; stylesheet.media = "screen"; stylesheet.id = "szProfAndEmbedStyleSheet"; document.lastChild.firstChild.appendChild(stylesheet); } SezWho.PluginCore.szManageEmbedUI(); } this.isSafari = function(){ return (/Safari|Konqueror|KHTML/gi).test(navigator.userAgent) ; } this.isIE = function() { return (!SezWho.Utils.isSafari() &&!navigator.userAgent.match(/opera/gi) && navigator.userAgent.match(/msie (5\.5|6)/gi)) ; } this.isOpera = function() { return (navigator.userAgent.match(/Opera/gi)) ; } this.log = function(type, msg) { if ((type == 'info' || type == 'debug') && !window.is_debug_log_enabled) return ; var self = arguments.callee; if (window.console) (window.console[type] || window.console.log )(msg); else if (window.opera) window.opera.postError(msg); else if ( window.Log) { self._logger = self._logger || new Log(Log.INFO, Log.popupLogger); self._logger[type](msg); } } this.szClick = function (t,url,vid,key) {window.open(sz_global_config_params.cpserverurl+'/clickhandler.php?referrer='+escape(document.location)+'&linktype='+t+'&viewid='+vid+'&key='+key+'&linkurl='+escape(url));} this.szImageSource = function(name, imgsrc){ var altt = ""; imgsrc = imgsrc.toLowerCase(); if (name != null && name != "") name = name+"'s "; if (imgsrc == 'http://s3.amazonaws.com/sz_users_images/noimg.gif') altt = "no image"; else if (imgsrc.match("gravatar")) altt = name + "image from Gravatar"; else if (imgsrc.match("blogcatalog")) altt = name + "image from Blogcatalog"; else if (imgsrc.match("sz_users_images")) altt = name + "image from SezWho"; else if (imgsrc.match("yahoo")) altt = name + "image from MyBlogLog"; else altt = "no image"; return altt; } /* function _error(){ log("error" , msg) ; } function _warn(){ log("warn" , msg) ; } function _debug(){ log("debug" , msg) ; } function _info(){ log("info" , msg) ; } */ } /* End SezWho.Utils class */ /* start SezWho.Utils.CommentFilterProcessing - class for comment filter processing */ SezWho.Utils.CommentFilterProcessing = new function () { //hide = 0, show = 1, toggle = 2 this.manageComment = function(i, type) { SezWho.Utils.log("info" ,"SezWho.Utils.CommentFilterProcessing.toggleComment called with i = "+i); var hideCommCell = document.getElementById("sz_comment_collapse:"+i); var commDiv = document.getElementById("sz_comment_collapse_div:"+i); if (hideCommCell && commDiv) { if (type == 0) { hideCommCell.className = 'cpEmbedCommentImgPlus cpEmbedCommentImgPlusCustom'; commDiv.style.display = "none" ; commDiv.style.visibility = "hidden" ; } else if (type == 1) { hideCommCell.className = 'cpEmbedCommentImgMinus cpEmbedCommentImgMinusCustom'; commDiv.style.display = "inline" ; commDiv.style.visibility = "visible" ; } else //toggle { if (hideCommCell.className == 'cpEmbedCommentImgMinus cpEmbedCommentImgMinusCustom') { hideCommCell.className = 'cpEmbedCommentImgPlus cpEmbedCommentImgPlusCustom'; commDiv.style.display = "none" ; commDiv.style.visibility = "hidden" ; } else { hideCommCell.className = 'cpEmbedCommentImgMinus cpEmbedCommentImgMinusCustom'; commDiv.style.display = "inline" ; commDiv.style.visibility = "visible" ; } } } } this.cpshowFilterOptions = function(list) { SezWho.Utils.log("info" ,"SezWho.Utils.CommentFilterProcessing.cpshowFilterOptions called with list = "+list); SezWho.Utils.CommentFilterProcessing.filterCommentsByScore(list.options[list.selectedIndex].value); } this.filterCommentsByScore = function(score) { SezWho.Utils.log("info" ,"SezWho.Utils.CommentFilterProcessing.filterCommentsByScore called with score = "+score); var objectCount = sz_comment_config_params.comment_number ; for (var co2 = 0 ; co2 < objectCount; co2++) { if(score==0 || sz_comment_config_params.sz_comment_data[co2].comment_score >= score) SezWho.Utils.CommentFilterProcessing.manageComment(co2,1); else SezWho.Utils.CommentFilterProcessing.manageComment(co2,0); } sz_comment_config_params.sortOrder = score; } } /* end SezWho.Utils.CommentFilterProcessing */ function populate_comment_star_rating(comment_score, comment_id){ var comment_ratings_images = SezWho.Utils.get_star_rating(comment_score, "comment"); document.getElementById("yk_comment-"+comment_id+"-commentscore").innerHTML = comment_ratings_images; } sz_cp_proto.observe(window, "load", SezWho.Utils.callJSFramework , false ); /*@cc_on @*/ /*@if (@_win32) document.write("