/* ****************************************** 
 
  TITLE:        NBC_SHARE.JS
  VERSION:      1.53
  LAST UPDATED: 11/04/2009 
  UPDATED BY:  Viktoriya Eremeeva
  CONTENTS:

 @release 2009-11-05 - vicky

******************************************  */

//Copyright (c) 2007 Fark, Inc
//$Id: farkit.js 6932 2009-03-07 00:23:42Z mandrews $
//////////////////////////////////////////////////////////////////////////
//To add FarkIt buttons to your page, include this Javascript file and
//then add a call to this function:
//
//farkItButton('This is the headline', 'http://this.is.the.url', '80x20');
//
//If you omit the URL, it will automatically use the URL of the current page.
//
//If you omit the headline, it will look for a global Javascript variable
//called 'fark_headline' and use that if it's there.  If it isn't, it'll
//stay blank, and Fark will prompt for the headline when the button is
//clicked.
//
//Valid sizes are '80x20', '100x20', '120x40', '16x16', '32x32', '29x40', '88x30'.
//If you omit the size, 80x20 is used.
//
//So, if you want to prompt for a headline, use the default URL, and the default
//size, you can simply use the following syntax:
//
//farkItButton();
//
//If you want to specify a headline and size but assume the default URL, use
//the following syntax:
//
//farkItButton('Headline goes here','','88x30');

function farkItButton(h, u, s) {
if (!IsDef(h)) {
 if (IsDef(window.fark_headline)) {
   h = window.fark_headline;
 } else {
   h = '';
 }
}
if (!IsDef(u)) {
 if (IsDef(window.fark_url)) {
   u = window.fark_url;
 } else {
   var URL = unescape(location.href); 
   u = URL;
 }
}
var img = 'FarkItButton1_80x20.png'; var imgw = 80; var imgh = 20;
if (IsDef(s)) {
 if (s == '100x20') {
   img = 'FarkItButton2_100x20.gif'; imgw = 100; imgh = 20;
 } else if (s == '120x40') {
   img = 'FarkItButton2_120x40.gif'; imgw = 120; imgh = 40;
 } else if (s == '16x16') {
   img = 'FarkItButton2_16x16.gif'; imgw = 16; imgh = 16;
 } else if (s == '29x40') {
   img = 'FarkItButton2_29x40.gif'; imgw = 29; imgh = 40;
 } else if (s == '32x32') {
   img = 'FarkItButton2_32x32.gif'; imgw = 32; imgh = 32;
 } else if (s == '88x30') {
   img = 'FarkItButton2_88x30.gif'; imgw = 88; imgh = 30;
 }
}
document.write('<a href="http://www.fark.com/cgi/farkit.pl?h=' + h + '&u=' + u + '" target="_blank"><img id="farkitButton" src="http://img.fark.net/pub/' + img + '" width="' + imgw + '" height="' + imgh + '" border="0"></a>');
}

function IsDef(variable) {
return (!(!( variable||false )))
}


function positionShare(o) {
	var canvas = document.getElementById("canvas");
	var leftPos = U.getPosition(o).x - U.getPosition(canvas).x;
        var getY = U.getPosition(o).y;
	jQuery("#share_box").css("top",getY);
	jQuery("#share_box").css("left", leftPos);
}

$(document).ready(function() {
   var dragShareHeader = $("#share_box .share_header");
    $('#share_box').jqDrag(dragShareHeader);
    dragShareHeader.mouseup(function() {
         $(this).css("opacity","1");
         $("#article a.share_close").css("display","block");
         $("#article a.share_close").css("opacity","1");
         $("#article a.share_close").css("display","block");
         $("#sales a.share_close").css("display","block");
         $("#sales a.share_close").css("opacity","1");
         $("#sales a.share_close").css("display","block");
         $("#video a.share_close").css("display","block");
         $("#video a.share_close").css("opacity","1");
         $("#video a.share_close").css("display","block");
         $("#slideshow a.share_close").css("display","block");
         $("#slideshow a.share_close").css("opacity","1");
         $("#slideshow a.share_close").css("display","block");
         $("#blog a.share_close").css("display","block");
         $("#blog a.share_close").css("opacity","1");
         $("#blog a.share_close").css("display","block");
    }); 
})

 
 
