function wpsc_akst_share(id, url, title) {
  if ((jQuery('#wpsc_akst_form').css("display") == 'block') && (jQuery('#wpsc_akst_post_id').attr("value") == id)) {  
    jQuery('#wpsc_akst_form').css("display", "none");
    return;
    }
  
  var link = jQuery('#wpsc_akst_link_' + id);
  var options = {
    margin: 1 ,
    border: 1 ,
    padding: 1 ,
    scroll: 1 
  };
  
  var offset = {};
  new_container_offset = jQuery('#wpsc_akst_link_' + id).offset(options, offset);
  
  if(offset['left'] == null) {
		offset['left'] = new_container_offset.left;
		offset['top'] = new_container_offset.top;
	}

 jQuery("#wpsc_akst_delicious").attr("href", wpsc_akst_share_url("http://del.icio.us/post?url={url}&title={title}", url, title)); jQuery("#wpsc_akst_digg").attr("href", wpsc_akst_share_url("http://digg.com/submit?phase=2&url={url}&title={title}", url, title)); jQuery("#wpsc_akst_stumbleupon").attr("href", wpsc_akst_share_url("http://www.stumbleupon.com/submit?url={url}&title={title}", url, title)); jQuery("#wpsc_akst_facebook").attr("href", wpsc_akst_share_url("http://www.facebook.com/sharer.php?u={url}", url, title)); jQuery("#wpsc_akst_twitter").attr("href", wpsc_akst_share_url("http://twitter.com/home?status=Currently reading {url}", url, title));
  jQuery('#wpsc_akst_post_id').value = id;
  jQuery('#wpsc_akst_form').css("left", offset['left'] + 'px');
  jQuery('#wpsc_akst_form').css("top", (offset['top']+ 14 + 3) + 'px');
  jQuery('#wpsc_akst_form').css("display", 'block');
}

function wpsc_akst_share_url(base, url, title) {
  base = base.replace('{url}', url);
  return base.replace('{title}', title);
}

function wpsc_akst_share_tab(tab) {
  var tab1 = document.getElementById('wpsc_akst_tab1');
  var tab2 = document.getElementById('wpsc_akst_tab2');
  var body1 = document.getElementById('wpsc_akst_social');
  var body2 = document.getElementById('wpsc_akst_email');
  
  switch (tab) {
    case '1':
      tab2.className = '';
      tab1.className = 'selected';
      body2.style.display = 'none';
      body1.style.display = 'block';
      break;
    case '2':
      tab1.className = '';
      tab2.className = 'selected';
      body1.style.display = 'none';
      body2.style.display = 'block';
      break;
  }
}

function wpsc_akst_xy(id) {
  var element = jQuery(id);
  var x = 0;
  var y = 0;
}
