   /* sharing functions... */

   //var windowHeight = $(window).innerHeight();
   //var windowWidth = $(window).innerWidth();

   var shareWindow = {
         height: 980,
         width: 940,
         positionType:'absolute',
         positionTop:10,
         positionLeft:400,
         draggable: 1,
         eventType:'click',
         windowSource:'iframe',
         windowPadding:4,
         loader:1,
         loaderImagePath:'images/ajax_wait.gif',
         loaderHeight:16,
         loaderWidth:17
      }

   function shareWindowPopup(url) {

      var defaultWidth = 970;
      var defaultHeight = 800;
      var windowHeight = ($(window).innerHeight() < defaultHeight) ? $(window).innerHeight() - 30 : defaultHeight;
      var windowWidth = ($(window).innerWidth() < defaultWidth) ? $(window).innerWidth() - 20 : defaultWidth;
      var positionTop = ($(window).innerHeight()  - windowHeight) /3;
      var positionLeft = ($(window).innerWidth()  - windowWidth) /2 - 14;

      var shareWindow = {
         height: defaultHeight,
         width: defaultWidth,
         positionType:'absolute',
         positionTop: positionTop,
         positionLeft: positionLeft,
         draggable: 1,
         eventType:'click',
         windowSource:'iframe',
         windowPadding:4,
         loader:1,
         loaderImagePath:'images/ajax_wait.gif',
         loaderHeight:16,
         loaderWidth:17
      }

      $(".share").attr('href', url);
      $(".share").openDOMWindow(shareWindow);
      $(".share").click();
   }

   function shareWindowPopup2(url) {
      var defaultWidth = 970;
      var defaultHeight = 800;
      var windowHeight = ($(window).innerHeight() < defaultHeight) ? $(window).innerHeight() - 30 : defaultHeight;
      var windowWidth = ($(window).innerWidth() < defaultWidth) ? $(window).innerWidth() - 20 : defaultWidth;
      var positionTop = parseInt(($(window).innerHeight()  - windowHeight) /3);
      var positionLeft = parseInt(($(window).innerWidth()  - windowWidth) /2 - 14);

      //alert(url); return;

      options = 'toolbar=0, menubar=0, location=0, height=' + windowHeight + ', width=' + windowWidth + ', top=' + positionTop + ', scrollbars=yes, status=yes, resizable=true, left=' + positionLeft;
      //window.open(url, "test");
      window.open(url, "share", options);
   }
    
   function shareEmail(section) {
     subject = escape("Guarda questo disco di Sonic Solution!");
     body = escape("Ciao,\r\n\r\nguarda questo disco di Sonic Solution: " + current_url + "\r\n");
     document.location = 'mailto:?subject='+subject+'&body='+body;
   }

   function shareFacebook() {
      //window.open("http://www.facebook.com/share.php?u=" + current_url, "_blank");
      shareWindowPopup2("http://www.facebook.com/share.php?u=" + escape(current_url));
   }

   function shareTwitter() {
      //cur_url = escape(current_url);
      status = ("Guarda+questo+disco+di+Sonic+Solution!+" + current_url + "");
      shareWindowPopup2("http://www.twitter.com/home?status=" + status);
   }

   function shareMySpace() {
      //shareWindowPopup("http://www.myspace.com/Modules/PostTo/Pages/?u=" + current_url + "&t=Guarda+questo+disco+su+Sonicsolution.it&c=testing");
      cur_url = escape(current_url);
      title = escape("Guarda+questo+disco+di+Sonic+Solution!");
      descr = "";
      if (typeof(shortDescr) != 'undefined') descr = shortDescr;
      shareWindowPopup2("http://www.myspace.com/Modules/PostTo/Pages/?u=" + cur_url + "&t=" + title + "&c=" + descr);
   }

   function shareDigg() {
      cur_url = escape(current_url);
      title = escape("Guarda+questo+disco+di+Sonic+Solution!");

      shareWindowPopup2("http://digg.com/submit?phase=2&url=" + cur_url + "&t=" + title);
   }    
    

   $(document).ready(function() {
      $(".share-email").click(function() {
         shareEmail();
      }); 
      $(".share-facebook").click(function() {
         shareFacebook();
      });

      $(".share-twitter").click(function() {
         shareTwitter();
      });

      $(".share-myspace").click(function() {
         shareMySpace();
      });

      $(".share-digg").click(function() {
         shareDigg();
      });

});
