var path2imgs = "http://www.noocle.com/bookmarkimages/";

var left, top;
document.onmousedown = getClick;
function getClick(evt)
{
  var w3c = document.getElementById&&!document.all;
  if (w3c)
  {
    left = evt.clientX;
    top = evt.pageY;
  }
  else
  {
    left = event.clientX;
    top = event.clientY;
  }
}

function goSocial()
{

  var socialButtons = "";
  var buttons = Array();
  var i;
  for (i=0; i<10; i++)
  {
    buttons[i] = new Object(); 
  }
  buttons[0].name = "Hibookmark";
  buttons[1].name = "del.icio.us";
  buttons[2].name = "blinklist";
  buttons[3].name = "digg";
  buttons[4].name = "blinkbits";
  buttons[5].name = "google";
  buttons[6].name = "netscape";
  buttons[7].name = "myweb2";
  buttons[8].name = "technorati";
  buttons[9].name = "furl";

  buttons[0].img = "hibookmark.gif";
  buttons[1].img = "delicious.gif";
  buttons[2].img = "blinklist.gif";
  buttons[3].img = "digg.gif";
  buttons[4].img = "blinkbits.gif";
  buttons[5].img = "google.gif";
  buttons[6].img = "netscape.gif";
  buttons[7].img = "yahoo.gif";
  buttons[8].img = "technorati.gif";
  buttons[9].img = "furl.gif";

  
  var url = escape(document.location.href);
  var title = escape(document.title);
  buttons[0].link = "http://www.hibookmark.com/bookmarks.php/?action=add&popup=1&address="+url+"&title="+title;
  buttons[1].link = "http://del.icio.us/post?v=2&url="+url+"&title="+title;
  buttons[2].link = "http://www.blinklist.com/index.php?Action=Blink/addblink.php&Title="+title+"&Url="+url;
  buttons[3].link = "http://digg.com/submit?phase=3&url="+url+"&title="+title;
  buttons[4].link = "http://blinkbits.com/bookmarklets/save.php?v=1&source_url="+url+"&title="+title;
  buttons[5].link = "http://www.google.com/bookmarks/mark?op=add&bkmk="+url+"&title="+title;
  buttons[6].link = "http://www.netscape.com/submit/?U="+url+"&T="+title;
  buttons[7].link = "http://myweb2.search.yahoo.com/myresults/bookmarklet?u="+url+"&t="+title;
  buttons[8].link = "http://technorati.com/faves/?add="+url;
  buttons[9].link = "http://www.furl.net/storeIt.jsp?t="+title+"&u="+url;

  socialButtons = "<table style=\"width: 140px; height: 60px; border:0;\"><tbody><tr>";
  for (i=0; i<5; i++)
  {
    socialButtons += "<td style=\"width: 20px\"><a href=\""+buttons[i].link+"\" rel=\"nofollow\" target=\"_blank\" style=\"text-decoration:none\"><img src=\""+path2imgs+buttons[i].img+"\" alt=\""+buttons[i].name+"\" title=\""+buttons[i].name+"\" /></a></td>"
  }
  socialButtons += "</tr><tr>";
  for (i=5; i<10; i++)
  {
    socialButtons += "<td style=\"width: 20px\"><a href=\""+buttons[i].link+"\" rel=\"nofollow\" target=\"_blank\"><img src=\""+path2imgs+buttons[i].img+"\" alt=\""+buttons[i].name+"\" title=\""+buttons[i].name+"\" /></a></td>"
  }
  socialButtons += "</tr></tbody></table>";
  
  var newDiv = document.createElement("div");
  newDiv.id = "socialPopup";
  
  newDiv.style.position = "absolute";
  newDiv.style.overflow = "hidden";
  newDiv.style.border = "1px black solid";
  newDiv.style.backgroundColor = "white";
  newDiv.style.margin = "0";
  newDiv.style.padding = "0";
  newDiv.style.width = "140px";
  newDiv.style.height = "100px";

  newDiv.style.left = (left < 600) ? (left+"px") : (left-200+"px");
  newDiv.style.top = top+"px";

  newDiv.innerHTML ="<div style=\"padding:0;margin:0;width:"+newDiv.style.width+";height:20px;overflow:hidden;margin:0;padding:0;background-color:white;text-align:center;font: normal 12px Verdana; color: white; padding-top:3px;\"><a href=\"http://www.noocle.com\" target=\"_blank\" style=\"color:black; text-decoration:none\">Noocle Bookmaklet</a></div>"+
  "<div>"+socialButtons+"<center><a onclick=\"javascript: document.body.removeChild(document.getElementById('socialPopup'))\" style=\"color: black; text-decoration:none; font: normal 12px Verdana; color: black; cursor:pointer\">Close</a></center></div>";
  document.body.appendChild(newDiv);
}
