/*
 * ShareItPop socialbubble.js libary v0.1
 * http://design.zajecarci.com/
 *
 * Copyright (c) 2009 Milan Milovanovic
 * Licensed under GPL license.
 *
 * Date: 2009-10-14 10:58:21 -0500 (Thu, 19 Feb 2009)
 */

var u=encodeURIComponent(location.href);
var t=encodeURIComponent(document.title);
var services = {
  'Delicious' : 'http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url='+u+'&amp;title='+t+'|Submit to del.icio.us|1|550|550',
  'Digg' : 'http://digg.com/submit?url='+ u + '&amp;title='+ t +'|Submit to digg|0',
  'StumbleUpon' : 'http://www.stumbleupon.com/submit?url='+ u +'&title='+document.title.replace(/ /g,'+')+'|Stumble It!|0',
  'Buzzup' : 'http://buzz.yahoo.com/buzz?targetUrl=' + u +'|BuzzUp!|0',
  'BlinkList' : 'http://blinklist.com/blink?u='+ u +'&amp;t='+ t +'|Submit to BlinkList|1|600|500',
  'Mixx' : 'http://www.mixx.com/submit?page_url='+ u +'|Submit to Mixx|0',
  'MySpace' : 'http://www.myspace.com/index.cfm?fuseaction=postto&l=2&u='+ u + '&t=' + t +'|Publish to MySpace|1|850|600',
  'LinkedIn' : 'http://www.linkedin.com/shareArticle?mini=true&url='+ u + '&title=' + t + '&ro=false&summary=&source=|Link it in|1|600|500',
  'Facebook' : 'http://www.facebook.com/sharer.php?u='+ u + '|Share on Facebook|1|626|436',
  'Reddit' : 'http://reddit.com/submit?url='+ u +'|reddit this!|0',
  'Magnolia' : 'http://ma.gnolia.com/bookmarklet/add?url='+ u +'&amp;title='+ t +'|Submit to Magnolia|0',
  'Newsvine' : 'http://www.newsvine.com/_tools/seed&amp;save?u='+ u +'&amp;h='+ t + '|Submit to Newsvine|0',
  'Twitter' : 'http://twitter.com/home?status=Currently reading '+ u +'|Twitt it!|0',
  'Google' : 'http://www.google.com/bookmarks/mark?op=add&amp;bkmk='+ u +'&amp;title='+ t + '|Bookmark on google|0',
  'Yahoo' : 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+ location.href +'&amp;t='+ t + '|Bookmark on Yahoo|0',
  'Technorati' : 'http://technorati.com/faves?sub=favthis&add='+ u +'|Fav on technorati|0'
  }
function popup_toggle()
{
var vis = document.getElementById('popup');
       if(vis.style.display == 'none')
          popup_show('popup');
       else
          vis.style.display = 'none';
}
function popup_show(id)
{
  var element      = document.getElementById(id);
  var x = 0;
  var y = 0;
  var width        = window.innerWidth  ? window.innerWidth  : document.documentElement.clientWidth;
  var height       = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight;
  var position = 'element-bottom';
  element.style.position = 'absolute';
  element.style.display  = 'block';
    var position_element = document.getElementById('share_button');
    for (var p = position_element; p; p = p.offsetParent)
      if (p.style.position != 'absolute')
      {
        x += p.offsetLeft;
        y += p.offsetTop;
      }

    y += position_element.clientHeight;
    element.style.left = x+'px';
    element.style.top  = y+'px';
}
/*document.write('<link rel="stylesheet" type="text/css" href="/modules/ShareItPop/sharestyle.css" />');
document.write('<a href="javascript:void(0);" onclick="popup_toggle();"><img src="/modules/ShareItPop/images/share.gif" id="share_button" style="border: 0 none;"/></a>');*/
document.write('<div class="sample_popup" id="popup" style="display: none;">');
document.write('<div class="menu_form_header" id="popup_header">');
document.write('&nbsp;&nbsp;&nbsp;Comparte en redes sociales');
document.write('</div>');
document.write('<div class="menu_form_body">');
for(var index in services) {
s = services[index].split('|');
if (s[2] == '1'){
	l = '<a href="javascript:void(0)" OnClick="javascript:window.open(\''+ s[0] +'\',\'sharer\',\'toolbar=0,status=0,width=626,height=436\'); return false;" class="share_href" title="'+ s[1] +'">';
}
else {
	l = '<a href="'+ s[0] +'" target="_blank" class="share_href" title="'+ s[1] +'">';
}
document.write('<div class="share_body">');
document.write(l);
document.write('<img src="/modules/ShareItPop/images/' + index + '.png" class="share_icon" alt="Share" style="border: 0 none;"><span class="text">' + index + '</span></a>');
document.write('</div>');
}
document.write('</div></div>');
