// ==UserScript==
// @name           Sokker Emblem for Non Plus Users
// @namespace      http://www.mkvale.it/mk/sokker/
// @author         Mkcerusky (162594)
// @description    Version 1.0 - This script allows to add a Logo to the welcome page, visible only by the user (adapted to NEW DESIGN 2008)
// @include        http://online.sokker.org/*
// ==/UserScript==



var imageUrl = GM_getValue("sokker_logo_non_plus__url","Right click on the Grease monkey icon and click on Set Logo Url (you will need to have your image saved somewhere on the web)");

GM_registerMenuCommand('Set Logo Url', logo_url_picker);


if (document.URL.indexOf("glowna.php")!=-1 && document.URL.indexOf("teamID")==-1 && document.URL.indexOf("userID")==-1) {


/******************************************************************************/
/*    Procedure the image in the page                                         */
/******************************************************************************/

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };

var divs = document.getElementsByTagName("div");

if (imageUrl == "" || imageUrl==null) 
  divs[12].innerHTML += "<p style='font-size:smaller; width:220px'><b>Sokker Emblem for Non Plus Users</b> powered by <a href='http:\/\/www.mkvale.it\/mk\/sokker'>Mkcerusky's Sokker Page</a>:" + 
    "<br>Right click on the Grease Monkey icon and click on Set Logo Url (you will need to have your image saved somewhere on the web)</p>"; 
else 
  divs[12].innerHTML += "<img src='"+imageUrl+"' width='220px' alt='"+imageUrl+"'>" + 
  "<p style='font-size:smaller; width:220px'><b>Sokker Emblem for Non Plus Users</b> powered by <a href='http:\/\/www.mkvale.it\/mk\/sokker'>Mkcerusky's Sokker Page</a></p>";

}


function logo_url_picker() {
  var new_url = window.prompt("Enter a valid URL for your logo image. (You will need to refresh the page)\n", imageUrl);
  GM_setValue("sokker_logo_non_plus__url", new_url);
  imageUrl = new_url;
}


