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; var sz_custom_ratings_text = {1:"Estas Mal!", 2:"Esta dos que tres!", 3:"Esto esta bueno!", 4:"Eres Sabio!", 5:"Eres Genio!"};
SezWho = {
Version: '2.1'
} ;
SezWho.Utils = {} ;
// class for rendering the sezwho UI for each comment
SezWho.PluginCore = new function () {
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 || ((window.sz_comment_config_params.sz_enable_comment_rating != null) && (0 === sz_comment_config_params.sz_enable_comment_rating)) ) {
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_enable_comment_filter && SezWho.BlogPlatformCallbackJS.get_platform() != "blogger") return;
if (sz_comment_config_params.sz_auto_option_bar && sz_comment_config_params.sz_enable_comment_filter) {
var fb = get_show_comment_dropdown_div();
var fbph = document.getElementById('szOptionBarPlaceHolder');
fbph.parentNode.replaceChild(fb, fbph);
}
else if (sz_comment_config_params.sz_enable_comment_filter){
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 "+sz_global_config_params.cpserverurl+"/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" || sz_comment_config_params.sz_comment_data[co2].comment_score == 0)
continue;
hn = null;
fn = null;
ccd = null;
if (SezWho.BlogPlatformCallbackJS.get_platform() == "blogger"){//insert the header etc.
var at = null;
var url = unescape(sz_comment_config_params.sz_comment_data[co2].comment_author_url);
if (url != "") at= SezWho.BlogPlatformCallbackJS.get_comment_author_name(sz_comment_config_params.sz_comment_data[co2].comment_id, url);
if (!at) continue;
if (sz_comment_config_params.sz_comment_data[co2].comment_author == "")
sz_comment_config_params.sz_comment_data[co2].comment_author = escape(at.innerHTML);
var im = cp_comment_user_image(co2, sz_comment_config_params.sz_comment_data[co2].encoded_email, at.innerHTML, 0);
var ln = cp_comment_profile_link(co2, 0);
if (ln && im && at.parentNode){
at.parentNode.insertBefore(im, at);
at.parentNode.insertBefore(ln, at.nextSibling);
}
// now the ratings bar
var bb = SezWho.BlogPlatformCallbackJS.get_comment_bottom_block(sz_comment_config_params.sz_comment_data[co2].comment_id);
if (!bb) continue;
var rb = cp_comment_footer_content(co2, sz_comment_config_params.sz_comment_data[co2].comment_score, sz_comment_config_params.sz_comment_data[co2].rating_count);
if (rb) bb.insertBefore(rb, null);
}
if (sz_comment_config_params.sz_enable_comment_filter &&
SezWho.BlogPlatformCallbackJS.get_platform() != "blogger"){// filtering not supported on blogger
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);
// 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 "+sz_global_config_params.cpserverurl+"/FAQ.php .");
isErrorShown = "true" ;
return ;
}
}
}
}
}
this.szManagePostUI = function(){
if (window.sz_global_config_params == null ||
'undefined' == typeof sz_post_config_params ||
window.sz_post_config_params == null)
return;
if (SezWho.BlogPlatformCallbackJS.get_platform() == "blogger") {
for (id in sz_post_config_params) {
var pn = SezWho.BlogPlatformCallbackJS.get_post_node(id);
if (sz_post_config_params[id].blog_author_name == "") sz_post_config_params[id].blog_author_name = "Author";
var fb = cp_post_footer_content(
sz_post_config_params[id].post_id,
sz_post_config_params[id].post_score,
sz_post_config_params[id].rating_count,
sz_post_config_params[id].blog_author_name,
sz_post_config_params[id].md5email);
if (!fb || !pn) continue;
pn.insertBefore(fb, null);
}
}
else {
for (id in sz_post_config_params) {
var pn;
var sn;
var sid = document.getElementById('sz_image_link_post:'+id);
if (sid && sid.parentNode.tagName && sid.parentNode.tagName == 'A'){
pn = sid.parentNode.parentNode;
sn = sid.parentNode;
pn.insertBefore(sid, sn);
}
var sid = document.getElementById('sz_author_span_post:'+id);
if (sid && sid.parentNode.tagName && sid.parentNode.tagName == 'A'){
pn = sid.parentNode.parentNode;
sn = sid.parentNode;
sn.removeChild(sid);
pn.insertBefore(sid, sn.nextSibling);
}
}
}
}
function get_show_comment_dropdown_div() {
if ((window.sz_comment_config_params.sz_enable_comment_filter != null) && (1 === sz_comment_config_params.sz_enable_comment_filter)){
iHtml = "
" ;
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 ;
}
}
/* 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";
document.getElementById(this.divName).style.display = "block";
}
}
// 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");
var htmlStr;
ratingDiv.id = "ratingDiv";
ratingDiv.className = "cpPopupWrapper";
htmlStr = "
";
htmlStr += "
";
htmlStr += "
Rate Content
";
htmlStr += "
";
htmlStr += "";
htmlStr += "
";
htmlStr += "
";
ratingDiv.innerHTML = htmlStr;
var bodyTag = document.getElementsByTagName("body")[0];
bodyTag.appendChild(ratingDiv);
return ratingDiv;
}
this.createRatingsHelpDiv = function () {
var ratingDiv = document.createElement("div");
var htmlStr;
ratingDiv.id = "sz_ratingHelpDiv";
ratingDiv.className = "cpPopupWrapper";
htmlStr = "
";
htmlStr += "
";
htmlStr += "
Rate Content
";
htmlStr += "
";
htmlStr += "
Click on the score icons to rate this content.
By rating the content you are not only expressing your opinion but you also helping the community!
Registered and logged-in user votes count a lot more than anonymous votes - your identity as a rater is always kept private and never shown or transmitted to others.
";
htmlStr += "
";
htmlStr += "
";
ratingDiv.innerHTML = htmlStr;
var bodyTag = document.getElementsByTagName("body")[0];
bodyTag.appendChild(ratingDiv);
return ratingDiv;
}
this.activateRatingsHelpDIV = function(ev) {
// create the popup irrespective of whether the cookie exists or not. This is to display show error messages
var divName = "sz_ratingHelpDiv";
var ratingsHelpDiv = document.getElementById(divName);
if (ratingsHelpDiv == null) {
ratingsHelpDiv = SezWho.DivUtils.createRatingsHelpDiv();
}
var divPopUp = PopupWindow.findPopupWindow(divName);
if (!divPopUp) {
divPopUp= new PopupWindow(divName);
}
divPopUp.updateEvent(ev);
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();
sz_cp_proto.stop(ev);
}
this.createProfileDiv = function () {
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.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 rt = form.ratingType.value;
var cid = (rt == 'C')?sz_comment_config_params.sz_comment_data[i].comment_id:0;
var emailID= form.emailID.value;
var formParam = 'ratingIncrement='+escape(ratingIncrement)+'&blogID='+escape(sz_global_config_params.blogid)+'&siteKEY='+escape(sz_global_config_params.sitekey)+'&postID='+escape(postID)+'&commentID='+escape(cid)+'&rating_type='+rt+'&msec='+SezWho.Utils.getTimeStamp()+'&__mode=cp_comment_rating_submit';
if(document.getElementById('sz_radio_anon').checked)
emailID = "anonymous";
if (document.getElementById('sz_radio_login_reg').checked && emailID == "") {
var url;
url = sz_global_config_params.cpserverurl + '/login_pp.php';
url += '?ratingsubmitpath=' + encodeURIComponent(sz_global_config_params.rating_submit_path);
url += '&cppluginurl=' + sz_global_config_params.cppluginurl;
url += '&';
url += formParam;
url += '&sz_postRating=true&return_js=true';
SezWho.Utils.openPage('login_reg', url);
return ;
}
if (rt == 'C')
SezWho.Utils.ScoreDisplay.setWait("cpEmbedCommScore:"+i);
else
SezWho.Utils.ScoreDisplay.setWait("cpEmbedPostScore:"+postID);
// now set cookie
if(setcookieflag && (emailID != "anonymous")) SezWho.Utils.setCookie("SZ_EMAIL_ENC" , emailID, 100);
SezWho.Utils.makeJSCall(sz_global_config_params.rating_submit_path+"?sz_postRating=true&return_js=true&"+formParam+"&emailID="+encodeURIComponent(emailID));
}
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 = "