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.2.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_js_config_params == null || sz_js_config_params === 'undefined' || sz_js_config_params == null || document.getElementById('cpEmbedPageTableid') || !sz_js_config_params.comment_number) {
return ;
}
var post_id = sz_js_config_params.post_id ;
var sortScore = sz_js_config_params.sortOrder ;
var isErrorShown = "false" ;
if (sortScore == '') sortScore = 0 ;
if (sz_js_config_params.comment_number != sz_js_config_params.sz_comment_data.length) sz_js_config_params.comment_number = sz_js_config_params.sz_comment_data.length;
if (sz_js_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_comment_node(sz_js_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);
else {
var tfc = SezWho.BlogPlatformCallbackJS.get_top_of_first_comment(sz_js_config_params.sz_comment_data[0].comment_id);
tfc.parentNode.insertBefore(showCommentDiv, tfc);
}
} 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_js_config_params.comment_number; co2++) {
if (sz_js_config_params.sz_comment_data[co2].comment_score == 0) continue;
hn = null;
fn = null;
ccd = null;
if (sz_js_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_js_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_js_config_params.sz_comment_data[co2].comment_id);
if (!comment_node) continue;
try {
hn = get_comment_header_div(co2,
sz_js_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_js_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; iWhat is this?
" ;
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";
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(anchorname) {
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; idocument.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 (cppluginurl, cpserverurl) {
SezWho.Utils.log("info" , "SezWho.DivUtils.createRatingsDiv called with : cppluginurl = "+cppluginurl+" : cpserverurl = "+cpserverurl);
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.
";
var bodyTag = document.getElementsByTagName("body")[0];
bodyTag.appendChild(ratingDiv);
return ratingDiv;
}
this.createProfileDiv = function (cpserverurl) {
var profileDiv = document.createElement("div");
profileDiv.id = "profilepopup";
profileDiv.className = "cpPopupWrapper";
profileDiv.innerHTML = "
Public Profile
";
var bodyTag = document.getElementsByTagName("body")[0];
bodyTag.appendChild(profileDiv);
return profileDiv;
}
this.submitForm = function(form, cppluginurl) {
SezWho.Utils.log("info" , "submitForm called with : cppluginurl = "+cppluginurl);
var req = null;
if(window.XMLHttpRequest) req = new XMLHttpRequest();
else if (window.ActiveXObject) req = new ActiveXObject("Microsoft.XMLHTTP");
var ratingIncrement= form.ratingIncrement.value ;
var postID= form.postID.value;
var i= form.commentID.value;
var emailID= form.emailID.value;
var cpserverurl = form.cpserverurl.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 = "";
// now set cookie
SezWho.Utils.setCookie("SZ_EMAIL_COOKIE" , emailID, 100);
var d = new Date();
var formParam = 'ratingIncrement='+escape(ratingIncrement)+'&postID='+escape(postID)+'&commentID='+escape(sz_js_config_params.sz_comment_data[i].comment_id)+'&emailID='+encodeURIComponent(emailID)+'&msec='+escape(d.getMilliseconds())+'&__mode=cp_comment_rating_submit';
//alert(formParam);
req.onreadystatechange = function() {
if(req.readyState == 4) {
if(req.status == 200) {
var response = req.responseText;
//alert(response);
SezWho.DivUtils.handleCommentRating(response);
}
}
};
var comment_rating_submit_path = sz_js_config_params.comment_rating_submit_path ;
if(sz_js_config_params.use_cross_domain_posting) {
this.submitCommentRating(cppluginurl+comment_rating_submit_path+"?return_js=true&"+formParam);
}
else {
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.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!" ;
var button_id ;
if (ratingIncrement == 10) button_id = "sz_rating_button:yes:"+i ;
else button_id = "sz_rating_button:no:"+i;
document.getElementById("sz_comment_score:"+i).innerHTML = SezWho.Utils.get_comment_star_rating(sz_js_config_params.sz_comment_data[i].comment_score);
activateErrorDIV("ratingDiv" , i, button_id, errorMsg );
} else {
var commentScoreDiv = document.getElementById("sz_comment_score:"+i);
var comment_score = responseArr[1].split('=')[1];
commentScoreDiv.innerHTML = SezWho.Utils.get_comment_star_rating(comment_score);
sz_js_config_params.sz_comment_data[i].comment_score = comment_score;
}
}
this.submitCommentRating = function(url) {
var script = document.createElement('script');
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
}
function activateErrorDIV(divName, i, button_id, errorMsg) {
SezWho.Utils.log("info" , "SezWho.DivUtils.activateErrorDIV called with divName = "+divName+" : i = "+i+" : button_id = "+button_id+" : errorMsg = "+errorMsg);
var post_id = document.getElementById('cpEmailForm').postID.value = sz_js_config_params.post_id;
var comment_id = document.getElementById('cpEmailForm').commentID.value =i;
var rating = document.getElementById('cpEmailForm').ratingIncrement.value ;
// create the popup irrespective of whether the cookie exists or not. This is to display show error messages
var divPopUp = PopupWindow.findPopupWindow(divName);
if (!divPopUp) {
divPopUp= new PopupWindow(divName);
}
divPopUp.autoHide();
var mainDiv = document.getElementById(divName) ;
mainDiv.style.display = 'block' ;
mainDiv.style.visibility = 'visible' ;
var errorDiv = document.getElementById("popuperror") ;
errorDiv.style.visibility = "visible";
errorDiv.style.display = "block";
errorDiv.style.color = "#ff0000";
errorDiv.style.display.verticalAlign="left" ;
errorDiv.style.fontSize = "9px";
errorDiv.innerHTML = errorMsg;
var co_ordinates = SezWho.PopupPositionUtils.get_offsets(i, button_id, divName, divPopUp);
divPopUp.offsetX = co_ordinates[0] ;
divPopUp.offsetY = co_ordinates[1] ;
divPopUp.showPopup(i);
}
this.activateDIV = function(cppluginurl, divName, i, vote, cpserverurl, ev) {
SezWho.Utils.log("info" , "SezWho.DivUtils.activateDIV called with : cppluginurl = "+cppluginurl+" : divName = "+divName+" : i = "+i+" : vote = "+vote+" : cpserverurl = "+cpserverurl+" : ev = "+ev);
var ratingsDiv = document.getElementById(divName);
if (ratingsDiv == null) {
ratingsDiv = SezWho.DivUtils.createRatingsDiv (cppluginurl, cpserverurl);
}
var post_id = document.getElementById('cpEmailForm').postID.value = sz_js_config_params.post_id;
var comment_id = document.getElementById('cpEmailForm').commentID.value =i;
var button_id = vote+":"+comment_id+":"+post_id ;
if (vote == 'yes') {
document.getElementById('cpEmailForm').ratingIncrement.value = '10' ;
} else if (vote == 'no') {
document.getElementById('cpEmailForm').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);
var co_ordinates = SezWho.PopupPositionUtils.get_offsets(i, button_id, divName, divPopUp);
divPopUp.offsetX = co_ordinates[0] ;
divPopUp.offsetY = co_ordinates[1] ;
divPopUp.autoHide();
if (SezWho.Utils.readCookie("SZ_EMAIL_COOKIE")) {
// if cookie exists set popup visibility to false!
document.getElementById(divName).style.display = 'none' ;
this.submitForm(document.getElementById('cpEmailForm'), cppluginurl);
return;
} else {
document.getElementById(divName).style.display = 'block' ;
document.getElementById(divName).style.visibility = 'visible' ;
divPopUp.showPopup(i);
}
}
this.loadProfileData = function(url) {
var script = document.createElement('script');
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
// document.body.appendChild(script);
}
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(null, null, "profilepopup", divPopUp);
divPopUp.offsetX = co_ordinates[0] ;
divPopUp.offsetY = co_ordinates[1] ;
divPopUp.showPopup(null);
}
this.loadProfilePopUp = function(cpserverurl, cppluginurl, url, divName, author_name)
{
SezWho.Utils.log("info" , "SezWho.DivUtils.loadProfilePopUp called with cpserverurl = "+cpserverurl+" : cppluginurl = "+cppluginurl+" : url = "+url+" : divName = "+divName+" : author_name = "+author_name);
var profileDiv = document.getElementById(divName);
if (profileDiv == null) profileDiv = this.createProfileDiv(cpserverurl);
else {
if (document.getElementById('cpPopupContentBodyID'))
sz_cp_proto.replace(document.getElementById('cpPopupContentBodyID'), "
");
}
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(null, null, divName, divPopUp);
divPopUp.offsetX = co_ordinates[0] ;
divPopUp.offsetY = co_ordinates[1] ;
divPopUp.showPopup('');
this.loadProfileData (url);
}
var divpopuptimerid = 0 ;
this.loadMyProfileDiv = function(cpserverurl, cppluginurl, url, div, author_name, delay, ev){
SezWho.Utils.log("info" , "SezWho.DivUtils.loadMyProfileDiv called with cpserverurl = "+cpserverurl+" : cppluginurl = "+cppluginurl+" : url = "+url+" : div = "+div+" : author_name = "+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('"+cpserverurl+"','"+cppluginurl+"','"+url+"','"+div+"','"+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 full_img = "";
if (comment_score < 0.25) comment_ratings_images = zero_img+zero_img+zero_img+zero_img+zero_img ;
else if (comment_score >= 0.25 && comment_score < 0.75) comment_ratings_images = half_img+zero_img+zero_img+zero_img+zero_img ;
else if (comment_score >= 0.75 && comment_score < 1.25) comment_ratings_images = full_img+zero_img+zero_img+zero_img+zero_img ;
else if (comment_score >= 1.25 && comment_score < 1.75) comment_ratings_images = full_img+half_img+zero_img+zero_img+zero_img ;
else if (comment_score >= 1.75 && comment_score < 2.25) comment_ratings_images = full_img+full_img+zero_img+zero_img+zero_img ;
else if (comment_score >= 2.25 && comment_score < 2.75) comment_ratings_images = full_img+full_img+half_img+zero_img+zero_img ;
else if (comment_score >= 2.75 && comment_score < 3.25) comment_ratings_images = full_img+full_img+full_img+zero_img+zero_img ;
else if (comment_score >= 3.25 && comment_score < 3.75) comment_ratings_images = full_img+full_img+full_img+half_img+zero_img ;
else if (comment_score >= 3.75 && comment_score < 4.25) comment_ratings_images = full_img+full_img+full_img+full_img+zero_img ;
else if (comment_score >= 4.25 && comment_score < 4.75) comment_ratings_images = full_img+full_img+full_img+full_img+half_img ;
else if (comment_score >= 4.75) comment_ratings_images = full_img+full_img+full_img+full_img+full_img ;
return comment_ratings_images ;
}
this.setCookie = 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.readCookie = function(name) {
SezWho.Utils.log("info" ,"SezWho.Utils.readCookie called with name = "+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);
if (document.getElementById("ratingDiv")) document.getElementById('cpEmailForm').emailID.value = cookieVal ;
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_js_config_params.cpserverurl, sz_js_config_params.cppluginurl, sz_js_config_params.cpserverurl+"/webservices/ykgetprofile.php?site_key="+sz_js_config_params.sitekey+"&blog_key="+sz_js_config_params.blogkey+"&blog_id="+sz_js_config_params.blogid+"&commenter_email="+encodeURIComponent(sz_js_config_params.sz_comment_data[a[1]].comment_author_email)+"&isplugin=true", 'profilepopup', sz_js_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_js_config_params.sz_comment_data[i].comment_author_email)+"&isplugin=true&viewid=0");
}
this.makeJSCall = function(url) {
var script = document.createElement('script');
script.src = url;
document.getElementsByTagName('head')[0].appendChild(script);
}
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("yahoofs")) altt = name + "image from MyBlogLog";
else altt = "no image";
return altt;
}
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_rc_config_params.cpserverurl, sz_rc_config_params.cppluginurl, sz_rc_config_params.cpserverurl+"/webservices/ykgetprofile.php?site_key="+sz_rc_config_params.sitekey+"&blog_key="+sz_rc_config_params.blogkey+"&blog_id="+sz_rc_config_params.blogid+"&commenter_email="+encodeURIComponent(sz_rc_config_params.sz_rc_data[a[1]].comment_author_email)+"&isplugin=true", 'profilepopup', sz_rc_config_params.sz_rc_data[a[1]].comment_author, delay, ev);
}
this.szHandleRatingButtonClicks = function(ev){
var elm = sz_cp_proto.element(ev);
var a = elm.id.split(":");
SezWho.DivUtils.activateDIV(sz_js_config_params.cppluginurl, 'ratingDiv', a[2], elm.value, sz_js_config_params.cpserverurl, ev);
elm.blur();
}
this.openPage = function(type, url) {
if('undefined' == typeof url) url = null;
var name, options;
name="";
options="";
if (type == "home") url = sz_js_config_params.cpserverurl;
else if (type == "help") {
url = sz_js_config_params.cpserverurl+"/popup_help.php";
name = "Help";
options = "height=820,width=600,toolbar=no,scrollbars,resizable";
} else if (url == null) url = sz_js_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_js_config_params.cpserverurl+"/css/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') && !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_js_config_params.cpserverurl+'/clickhandler.php?referrer='+escape(document.location)+'&linktype='+t+'&viewid='+vid+'&key='+key+'&linkurl='+escape(url));}
/*
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_js_config_params.comment_number ;
for (var co2 = 0 ; co2 < objectCount; co2++) {
if(score==0 || sz_js_config_params.sz_comment_data[co2].comment_score >= score)
SezWho.Utils.CommentFilterProcessing.manageComment(co2,1);
else
SezWho.Utils.CommentFilterProcessing.manageComment(co2,0);
}
sz_js_config_params.sortOrder = score;
}
}
/* end SezWho.Utils.CommentFilterProcessing */
function populate_comment_star_rating(comment_score, comment_id){
var comment_ratings_images = SezWho.Utils.get_comment_star_rating(comment_score);
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("