var fadein_opacity=0;
var fadeout_opacity=100;
var is_being=false;
var text_wait="Please comment only 1 post at a time.";
function showModalBackground(){var A=document.createElement("div");
A.id="background-modal";
A.className="imagen";
var B=document.createElement("img");
B.setAttribute("src","../img/matt-loader.gif");
$(A).css("position","absolute").css("top",0).css("left",0).css("z-index",100).css("background","#4B4B4B").css("display","none").appendTo(document.body).css("opacity",0).show();
$(A).css("height",$(window).height()+"px").css("width",$(window).width()+"px").fadeTo(100,0.25);
$(A).append(B);
$(window).resize(function(){$("#background-modal").css("height",$(window).height()+"px").css("width",$(window).width()+"px")
})
}function hideModalBackground(){$("#background-modal").remove();
$(window).resize(null)
}function addComment(F,A,C,B){if(!is_being){showModalBackground();
is_being=true;
var E=document.getElementById(F+"comment").value;
commentBlogDWR.addComment(E,A,C,B,displayComments);
ShowHide(B);
hideModalBackground();
document.getElementById("comment").value="";
try{document.getElementById("comment").focus()
}catch(D){}document.getElementById(F+"comment").value="";
fadein_opacity=0;
fadeout_opacity=100;
is_being=false
}else{alert(text_wait)
}}function LoginAndAddComment(D,A,C,B){document.getElementById("comment").value=document.getElementById(D+"comment").value;
document.getElementById("commentOrder").value=C;
document.getElementById("commentFather").value=B;
document.getElementById("itemId").value=A;
document.getElementById("blogCommand").submit();
document.getElementById(D+"comment").value="";
fadein_opacity=0;
fadeout_opacity=100;
is_being=false
}function displayComments(J){var R=null;
var K=$.cookie("org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE");
var S=document.getElementById(J.key);
if(null!=S){S.style.display="none"
}if(null==J.parentId||J.parentId==0){if(null==J.parentKey||J.parentKey==""){R=document.getElementById("CommentsContainer")
}else{R=document.getElementById("NewCommentsContainer")
}}else{R=document.getElementById(J.parentKey)
}var O=document.createElement("div");
O.setAttribute("id",J.key);
O.setAttribute("style","border: 0px; solid #000; padding:0px;");
R.appendChild(O);
var I=document.createElement("div");
I.className="respcommentscont";
if(J.order==0){I.setAttribute("style","margin-left:0px;")
}else{I.setAttribute("style","margin-left:30px;")
}O.appendChild(I);
var H=document.createElement("div");
H.className="whocomment";
I.appendChild(H);
if(J.order<9){var U=document.createElement("span");
U.className="comments";
U.setAttribute("style","cursor:hand; cursor:pointer;");
H.appendChild(U);
var A=document.createElement("a");
A.setAttribute("onclick","ShowHide('"+J.id+"');");
A.className="justright";
if(K=="es_MX"){A.innerHTML="« Responder"
}else{A.innerHTML="« Reply"
}U.appendChild(A)
}var T=document.createElement("span");
if(K=="es_MX"){T.innerHTML=" Por: "
}else{T.innerHTML=" By: "
}H.appendChild(T);
var E=document.createElement("img");
E.setAttribute("src",J.serverImage);
E.setAttribute("width","16");
E.setAttribute("height","11");
E.setAttribute("align","absmiddle");
E.className="userpic";
H.appendChild(E);
var W=document.createElement("a");
if(K=="es_MX"){W.setAttribute("href","/espanol/usuarios/"+J.userId+"/"+J.userName+".html")
}else{W.setAttribute("href","/english/users/"+J.userId+"/"+J.userName+".html")
}W.className="usernameblue";
W.innerHTML=" "+J.userName;
H.appendChild(W);
var D=document.createElement("div");
if(J.order==0){D.className="divScrollcomment0"
}else{D.className="divScrollcomment1"
}I.appendChild(D);
var C=document.createElement("p");
C.innerHTML=J.content;
D.appendChild(C);
var P=document.createElement("span");
P.setAttribute("id",J.id);
P.setAttribute("style","display:none;");
I.appendChild(P);
var V=document.createElement("table");
V.setAttribute("width","100%");
P.appendChild(V);
var F=document.createElement("tr");
V.appendChild(F);
var L=document.createElement("td");
L.setAttribute("width","100%");
F.appendChild(L);
var N=690-(30);
var G=document.createElement("textarea");
G.setAttribute("id",J.id+"comment");
G.setAttribute("style","width:"+N+"px; height:50px;");
L.appendChild(G);
var B=document.createElement("tr");
V.appendChild(B);
var Q=document.createElement("td");
Q.setAttribute("align","right");
B.appendChild(Q);
var M=document.createElement("input");
M.setAttribute("type","button");
M.setAttribute("name","send"+J.id);
M.setAttribute("id","send"+J.id);
M.setAttribute("value","Send");
M.setAttribute("onclick","javascript:if ( validateCommentContent('"+J.id+"') ){ addComment( '"+J.id+"' , '"+J.itemId+"' , '"+J.order+"' , '"+J.id+"' ); }");
Q.appendChild(M)
}function validateCommentContent(D){var B=document.getElementById(D+"comment").value;
var A=true;
if(B==""){alert("Comment field is empty!");
try{document.getElementById(D).focus()
}catch(C){}A=false
}return A
}function ShowHide(A){var B=document.getElementById(A);
if(B.style.display==""){B.style.display="none"
}else{B.style.display=""
}}function ShowMoreComments(B){var A=document.getElementById("numpage");
var C=A.value;
commentNewsStoriesDWR.getMoreComments(C,B,displayMoreComments);
C++;
A.value=C
}function displayMoreComments(A){if(A.hasMore==false){var B=document.getElementById("pager");
B.style.display="none"
}for(a=0;
a<A.total;
a++){displayComments(A.commentsList[a])
}};
