// ==UserScript==
// @name          SoftPedia Report Blog
// @author        Ciuly  
// @namespace     http://www.ciuly.com
// @description   reports a blog entry on the dedicated thread
// @include       http://forum.softpedia.com/bloguri/*
// @require       http://www.ciuly.com/greasemonkey/aa_all_common.user.js
// @require       http://www.ciuly.com/greasemonkey/aa_sp_common.user.js
// ==/UserScript==

(function(wnd){
  
  wnd.ciuly_reportBlog = function(blogurl, full){
	wnd.ciuly_progress_show();
	wnd.ciuly_progress_log("Posting...");
	if (full)
	  var r = wnd.ciuly_reply(28, 181446, "Reclama in tot blogul: "+blogurl);
	else
	  var r = wnd.ciuly_reply(28, 181446, "Reclama in blog: "+blogurl);
	wnd.ciuly_progress_hide();
	return false;
  }

  if ( !wnd.ipb_md5_check)
    return;

  var blogurl;
  var divs = document.getElementsByClassName("navstrip");

  for (var i = 0; i<divs.length; i++){
    var div = divs.item(i);
    if (div.tagName == "DIV"){
      aa = div.getElementsByTagName("a");
      if (aa.length>2){
        blogurl = aa.item(2).getAttribute("href");
        blogurl = "http://forum.softpedia.com" + blogurl;
        entryurl = document.getElementById("url").getAttribute("value");
        div.innerHTML = div.innerHTML + "&nbsp;&nbsp;"+
	  "&nbsp;<button class=\"button\" name=\"Report Blog\" title=\"Report blog in dedicated thread\" onclick=\"return ciuly_reportBlog('"+blogurl+"', true)\">Report Blog</button>&nbsp;"+
	  "&nbsp;<button class=\"button\" name=\"Report Entry\" title=\"Report blog entry in dedicated thread\" onclick=\"return ciuly_reportBlog('"+entryurl+"', false)\">Report Entry</button>&nbsp;";      
      }
    }
  }

})(window.wrappedJSObject || window);