//
// (c) 2008 primeadd.net
// Service Widget
//
document.write('<style type="text/css">' +
 '#f_1623608666_primadd_menu { text-align: left; color: black; position: absolute; background-color: white; border:1px solid black; font: normal 10px Verdana; line-height: 12px; z-index: 100; visibility: hidden; padding: 0px; margin: 0px;}' +
 '#f_1623608666_primadd_menu div { float: left; padding: 0px; margin: 0px; border: none;}' +
 '#f_1623608666_primadd_menu .bar { width: 280px; height: 12px; background-color: #efefef; font-size:10px; padding: 2px 2px; }' +
 '#f_1623608666_primadd_menu .footer { text-align: right; }' +
 '#f_1623608666_primadd_menu .si { width: 50%; text-decoration: none; }' +
 '#f_1623608666_primadd_menu .si a { padding: 6px 2px 8px 4px;}' +
 '#f_1623608666_primadd_menu .si a:hover { background-color: #CCFF9D; }' +
 '#f_1623608666_primadd_menu a { display:block; text-decoration: none; color: #000000; }' +
 '#f_1623608666_primadd_menu .icons { float: left; margin: 0px; padding: 0px; font-size: 1px; line-height: 1px; width: 16px; height: 16px; background: url("//primadd.net/icon/services.png") no-repeat; }' +
 '#f_1623608666_primadd img { border:none; }' +
 '</style>');

var f_1623608666_textCnt;
if ( typeof(f_1623608666_textCnt ) == "undefined" ) { f_1623608666_textCnt = 0; } else { f_1623608666_textCnt++; }

document.write('<div id="f_1623608666_primadd"><a href="#" id="f_1623608666_primadd_bar'+f_1623608666_textCnt+'" onclick="f_1623608666_primadd_showmenu(event)" onMouseover="f_1623608666_primadd_showmenu(event, '+f_1623608666_textCnt+')" onMouseout="f_1623608666_primadd_hidemenu()"><img src="//primadd.net/img/btn/add_button_1.gif" style="border:none;" title="bookmark this size" alt="bookmark this site"/></a></div>');

var f_1623608666_defaultMenuWidth="284px" //set default menu width.
var f_1623608666_list=new Array(
new Array('whatsthis', 'whatsthis', 0, 'http://en.wikipedia.com/', "what's this?"),
new Array('google_bookmarks', 'Google Bookmarks', 3, 'http://www.google.com/', ""),
new Array('delicious', 'del.icio.us', 4, 'http://del.icio.us/', ""),
new Array('slashdot', 'slashdot', 5, 'http://slashdot.org/', ""),
new Array('stumbleupon', 'StumbleUpon', 6, 'http://www.stumbleupon.com/', ""),
new Array('reddit', 'reddit', 7, 'http://reddit.com/', ""),
new Array('technorati', 'Technorati', 8, 'http://technorati.com/', ""),
new Array('facebook', 'Facebook', 9, 'http://www.facebook.com/', ""),
new Array('yahoo_bookmarks', 'Yahoo Bookmarks', 10, 'http://bookmarks.yahoo.com/', ""),
new Array('ask', 'Ask', 11, 'http://myjeeves.ask.com/', ""),
new Array('simpy', 'Simpy', 12, 'http://www.simpy.com/', ""),
new Array('rawsugar', 'RawSugar', 13, 'http://www.rawsugar.com/', ""),
new Array('spurl', 'spurl', 14, 'http://www.spurl.net/', ""),
new Array('mister_wong', 'Mister Wong', 15, 'http://www.mister-wong.de/', ""),
new Array('backflip', 'Backflip', 16, 'http://www.backflip.com/', ""),
new Array('diigo', 'Diigo', 17, 'http://www.diigo.com/', ""),
new Array('segnalo', 'Segnalo', 18, 'http://segnalo.com/', ""),
new Array('tailrank', 'Tailrank', 19, 'http://tailrank.com/', ""),
new Array('dropjack', 'DropJack', 20, 'http://www.dropjack.com/', ""),
new Array('digg', 'digg', 21, 'http://digg.com/', ""),
new Array('furl', 'furl', 22, 'http://www.furl.net/', ""),
new Array('yahoo_myweb', 'Yahoo MyWeb', 23, 'http://myweb2.search.yahoo.com/', ""),
new Array('live_favorites', 'Live Favorites', 24, 'https://favorites.live.com/', ""),
new Array('twitter', 'twitter', 25, 'http://twitter.com/', ""),
new Array('myaol', 'myAOL', 26, 'http://favorites.my.aol.com/', ""),
new Array('fark', 'fark', 27, 'http://www.fark.com/', ""),
new Array('netscape_propeller', 'propeller', 28, 'http://www.netscape.com/', ""),
new Array('blogmarks', 'Blogmarks', 29, 'http://blogmarks.net/', ""),
new Array('linkagogo', 'linkaGoGo', 30, 'http://www.linkagogo.com/', ""),
new Array('magnolia', 'ma.gnolia', 31, 'http://ma.gnolia.com/', ""),
new Array('faves', 'faves.com', 32, 'http://faves.com/', ""),
new Array('netvouz', 'netvouz', 33, 'http://netvouz.com/', ""),
new Array('blinklist', 'BlinkList', 34, 'http://www.blinklist.com/', ""),
new Array('more', 'more', 1, 'http://primadd.net/', "for more services"));
function f_1623608666_gotoService(service)
{
	subUrl = '//primadd.net/services/' + service + '/';
	if (service == 'more') subUrl = '//primadd.net/bookmark/submit/'
	url = subUrl + '?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(window.location.href);
	window.open(url);
  
	if(typeof 'f_1623608666_hidemenu' == 'function')
	{
		f_1623608666_hidemenu();
	}
}
var ie5 = document.all && !window.opera;
var ns6 = document.getElementById;

if (ie5 || ns6)
{
	f_1623608666_print = setTimeout('f_1623608666_printMenu()', 1);
}

function f_1623608666_printMenu()
{
		if (document.getElementById('f_1623608666_foo_primadd_menu')) return;

		var newlink = document.createElement('div');
		newlink.id = 'f_1623608666_foo_primadd_menu';
		document.body.appendChild(newlink);
		newlink.innerHTML = '<div id="f_1623608666_primadd_menu" onMouseover="f_1623608666_clearhidemenu();" onMouseout="f_1623608666_dynamichide(event)">&nbsp;</div>';
}

function f_1623608666_addLinks()
{
	var ret = '';
	for (var i = 0; i < f_1623608666_list.length; i++)
	{
		var service = f_1623608666_list[i][0];
		var offset_y = f_1623608666_list[i][2];
		var txt = ''
		if (f_1623608666_list[i][4] != '') 
			txt = f_1623608666_list[i][4];
		else
			txt = f_1623608666_list[i][1];
					
		ret += '<div class="si"><a onclick="f_1623608666_gotoService('+"'"+service+"'"+');return false;" href="'+f_1623608666_list[i][3] + '"><div class="icons" style="background-position: 0px -'+(offset_y*16)+'px;"></div>&nbsp;' + txt + '</a></div>';
	}
	return ret;
}

function f_1623608666_iecompattest()
{
	return (document.compatMode && document.compatMode.indexOf('CSS') != -1) ? document.documentElement : document.body;
}

function f_1623608666_getY( oElement )
{
	var iReturnValue = 0;
	while( oElement != null )
	{
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function f_1623608666_getX( oElement )
{
	var iReturnValue = 0;
	while( oElement != null )
	{
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function f_1623608666_primadd_showmenu(e, barid)
{
	// no dom
	if (!document.all&&!document.getElementById) return ;

 f_1623608666_clearhidemenu();

	iconobj = ie5 ? document.all.f_1623608666_primadd : document.getElementById('f_1623608666_primadd_bar'+barid);
	menuobj = ie5 ? document.all.f_1623608666_primadd_menu : document.getElementById('f_1623608666_primadd_menu');
	menuobj.innerHTML     = '<div class="bar"><div>Add Article to</div><div style="float:right"><a href="" title="close menu" onclick="f_1623608666_hidemenu();return false;">[x]</a></div></div>' 
	                      + f_1623608666_addLinks() + '<div class="bar footer"><a target="_blank" href="http://primadd.net/">&copy; primadd.net</a></div>';
	menuobj.style.width   = f_1623608666_defaultMenuWidth;

	menuobj.style.top = (f_1623608666_getY(iconobj) +  16) + "px";
	menuobj.style.left = f_1623608666_getX(iconobj) + "px";

	var eventX = ie5 ? event.clientX : e.clientX;
	var eventY = ie5 ? event.clientY : e.clientY;

	//Find out how close the mouse is to the corner of the window
	var rightedge  = ie5 ? f_1623608666_iecompattest().clientWidth : window.innerWidth;
	var bottomedge = ie5 ? f_1623608666_iecompattest().clientHeight : window.innerHeight;

	// change pos if menu wouldnt fit
	if (rightedge < menuobj.offsetWidth + f_1623608666_getX(iconobj))
	{
		lval = (rightedge - parseInt(f_1623608666_defaultMenuWidth)- 10);
		if (lval < 5) lval = 5;
		menuobj.style.left = lval + "px";
	}
	else
	{
		menuobj.style.left = f_1623608666_getX(iconobj) +"px";
	}

  // y
  labelY = f_1623608666_getY(iconobj);
	if (bottomedge < menuobj.offsetHeight + labelY)
	{
		topval = (labelY - menuobj.offsetHeight);
		if (topval < 5) topval = 5;
		menuobj.style.top = topval + "px";
	}
	else
	{
		menuobj.style.top = labelY +"px";
	}


	menuobj.style.visibility = 'visible';
	return false;
}

function f_1623608666_contains_ns6(a, b)
{
	// Determines if 1 element in contained in another
	while (b.parentNode)
	{
		if ((b = b.parentNode) == a)
		{
			return true;
		}
	}
	return false;
}

function f_1623608666_hidemenu()
{
	if (window.menuobj)
	{
		menuobj.style.visibility = 'hidden';
	}
}

function f_1623608666_dynamichide(e)
{
	if ((ie5 && !menuobj.contains(e.toElement))||(ns6 && e.currentTarget != e.relatedTarget && !f_1623608666_contains_ns6(e.currentTarget, e.relatedTarget)))
	{
		f_1623608666_primadd_hidemenu()
	}
}

function f_1623608666_primadd_hidemenu()
{
	f_1623608666_delayhide = setTimeout('f_1623608666_hidemenu()', 850);
}

function f_1623608666_clearhidemenu()
{
	if (window.f_1623608666_delayhide)
	{
		clearTimeout(f_1623608666_delayhide);
	}
}
