function jblogcomments_mouse_up() { if (jcurrent_flower_selector) close_flower_selector(jcurrent_flower_selector); if (jcurrent_entry_smileys) { o=document.getElementById('smileydiv_'+jcurrent_entry_smileys); if (o) o.innerHTML=''; } } var jcurrent_entry_smileys=0; function jshow_blog_comments( entryid ) { if ( !( entryid > 0 ) ) { return false; } var o = $Elem( 'blogcomments_' + entryid ); if ( o == null ) { return false; } if ( o.style.display != 'none' ) { o.Hide(); o = $Elem( 'blogcommentslink_' + entryid ); if (o) o.innerHTML='Show comments'; } else { o.innerHTML = 'Loading comments...'; jblogcomments_request(entryid,3); o.Show(); o = $Elem( 'blogcommentslink_' + entryid ); if (o) o.innerHTML='Hide comments'; } } function jload_blog_comment_box( entryid ) { var o = $Elem( 'submit_' + entryid ); if ( o && o.disabled ) { o = $Elem( 'blogcommentbox_' + entryid ); if (o) { o.Hide(); o.innerHTML=''; } return; } o = $Elem( 'blogcommentbox_' + entryid ); if (o) { if (o.style.display=='none') { jblogcomments_request(entryid,2); o.innerHTML='Loading comment box...'; o.Show(); } } } function jblogcomments_request(entryid,flags) { var url = '/blogs/blogcomments_xmlhttp.php'; var params = 'entryid=' + entryid + '&flags=' + flags; CAJAX.Get( url, params, jblogcomments_process_http_response, "", "string" ); } function jblogcomments_process_http_response( response ) { var openbox = 0; var ok = response.substring(0,4); if ( ok == '[OK]' ) { var p = response.indexOf(';'); if ( p > 0 ) { var p2 = response.indexOf(';',p+1); if ( p2 > 0 ) { var entryid = response.substring(4,p); var flag = response.substring(p+1,p2); var response = response.substring(p2+1); if ( flag == 1 ) { var o = $Elem( 'blogcomments_' + entryid ); if (o) { o.innerHTML = response; o.Show(); } openbox = entryid; var sub_btn = $Elem( 'submit_' + entryid ); o = $Elem( 'blogcomments_' + entryid ); if ( sub_btn && sub_btn.disabled ) { var new_div = document.createElement("div"); var new_img = document.createElement("img"); new_img.setAttribute( "src", CXIHAConfig.imghost + "/images/icons/info20x20.png" ); new_img.setAttribute( "border", "0" ); new_div.appendChild( new_img ); new_div.appendChild( document.createTextNode('Posted!') ); o.appendChild( new_div ); } o = $Elem( 'blogcomment_' + entryid ); if ( o ) { o.value = ''; } } else if ( flag == 2 ) { var o = $Elem( 'blogcommentbox_' + entryid ); if (o) o.innerHTML = response; } } } } else { alert( 'Requested action failed. Please try again.' ); var submit_buttons = document.getElementsByTagName( "input" ); for ( var a = 0; a < submit_buttons.length; a++ ) { var item = submit_buttons[a]; if ( typeof( item.type ) && item.type == "submit" && typeof( item.id ) && new String( item.id ).match( /submit_([0-9]{1,})/i ) && item.disabled ) { item.disabled = false; item.value = 'Submit'; } } } if (openbox) jload_blog_comment_box(openbox); } function jopen_entry_smiley_table(entryid,i) { var o; //document.onmouseup=jblogcomments_mouse_up; if (jcurrent_flower_selector) close_flower_selector(jcurrent_flower_selector); if (jcurrent_entry_smileys) { o=document.getElementById('smileydiv_'+jcurrent_entry_smileys); if (o) o.innerHTML=''; } var o=document.getElementById('smileydiv_'+entryid); if(o) { jcurrent_entry_smileys=entryid; o.innerHTML=get_entry_smiley_table(i-1,entryid); var tableid='entry'+entryid+'sm0'+i; o=document.getElementById(tableid); if (o) { o.style.display=''; } } } function choose_entry_smiley(entryid,tag) { var o=document.getElementById('smileydiv_'+entryid); if(o) o.innerHTML=''; jcurrent_entry_smileys=0; var o=document.getElementById('blogcomment_'+entryid); if (!o) { return; } // IE if (document.selection) { o.focus(); var rng=document.selection.createRange(); rng.text=tag; } //Mozilla/firefox/Netscape 7+ else if (o.selectionStart || o.selectionStart == '0') { var startpos = o.selectionStart; var endpos = o.selectionEnd; o.value = o.value.substring(0, startpos)+ tag+ o.value.substring(endpos, o.value.length); } else { o.value += tag; } } function get_entry_smiley_table(idx,entryid) { var smileycounts=new Array(30,30,20,25,25); var maxws=new Array(47,50,41,39,41); var pad=4; var num=smileycounts[idx]; var maxh=35; var maxw=maxws[idx]; s=''; s+='
| ';
s+=' | ';
d++;
if (d==maxd) {
d=0;
s+='';
}
}
s+='