function fc_absoluteOffsetLeftCompartirlo(id) 
{
	var objetoTexto = document.getElementById(id);
	var iReturnValue = 0;
	while( objetoTexto != null ) 
	{
		iReturnValue += objetoTexto.offsetLeft;
		objetoTexto = objetoTexto.offsetParent;
	}
	
	return iReturnValue;
}

function showCompartirlo(ventana) 
{
	var urlLink 					= document.URL;
 	var urlAux						= urlLink.substr(7);
 	var urlDom 						= urlAux.split('/');
 		
 	urlLink				 			= urlDom[0];
 	urlTitle	 					= urlLink.split('.');
 	urlTitle 						= urlTitle[1];
 	urlTitle						= ucFirst(urlTitle);
	
	var myDiv 						= document.getElementById('compartirloButton');
	var xDiv 						= 50;//fc_absoluteOffsetLeftCompartirlo(myDiv);
	var xDiv 						= fc_absoluteOffsetLeftCompartirlo(myDiv.id);
	// div 						= document.getElementById(ventana);
 
	
	document.getElementById(ventana).style.position 			= "absolute";
	document.getElementById(ventana).style.styleFloat			= "left"; 
	
	if (urlTitle != "Costasur")
	{
		document.getElementById(ventana).style.left				= xDiv;
	} 
	else
	{
		document.getElementById(ventana).style.left				= xDiv - 90;  
	}
	
	// div.style.left = 0;

 	document.getElementById(ventana).style.zIndex				= "98"; 
 	document.getElementById(ventana).style.backgroundImage		= "url(http://www.compartirlo.com/images/compartirloModalBG.png)";
 	document.getElementById(ventana).style.backgroundPosition	= "center bottom";
 	document.getElementById(ventana).style.backgroundRepeat		= "no-repeat";
 	document.getElementById(ventana).style.display				= "";
 	document.getElementById(ventana).style.width				= "217px";
 	document.getElementById(ventana).style.height				= "226px"; 
 	
 	var nom = navigator.appName;

	if (nom == "Microsoft Internet Explorer")
	{
		document.getElementById(ventana).style.marginTop		= "35"; 
		document.getElementById(ventana).style.marginRight		= xDiv; 
	}
	if (nom == "Opera" && urlTitle != "Costasur" && urlTitle !="Genuinetrusted")
	{
		document.getElementById(ventana).style.marginTop		= "135"; 
	}

	var RS;
	
	RS = 	"<table id='compartirloModal' cellpadding=0 cellspacing=1 border=0 width=175 align='center' style='font-size: 10px;z-indez: 99; margin-top: 5px; margin-left: auto; margin-right: auto;' >";
	RS +=		"<tr>";
	RS +=			"<td colspan=3 style='font-size: 12px; text-align: right; padding-right: 8px; font-weight: bold;'>Favoritos</td>";
	RS +=			"<td style='font-size: 10px; margin-top: 2px; text-align: right;'><img style='cursor:pointer;' src='http://costasur.com/images/gfx/closeModalWindow.jpg' border=0 onclick='ocultarCompartirlo(\"ventana\");'></td>";
	RS +=		"</tr>";
	RS +=		"<tr><td height=1>&nbsp;</td></tr>";
	RS +=		"<tr>";
	RS +=			"<td width=1%>&nbsp;<a style=cursor:pointer; onclick='window.print();'><img src=http://www.costasur.com/images/gfx/print_16.gif></a></td>";
	RS +=			"<td width=15% nowrap onclick='window.print();' style=cursor:pointer;font-size:10px;font-weight:bold;>&nbsp;Imprimir</td>";
	RS +=			"<td width=1%>&nbsp;<a style=cursor:pointer; onclick='addFavorite(\"" + urlLink + "\",\"" + urlTitle + "\");'><img src=http://www.costasur.com/images/gfx/favicon.jpg></a></td>";
	RS +=			"<td width=15% nowrap onclick='addFavorite(\"http://" + urlLink + "\",\"" + urlTitle + "\");' style=cursor:pointer;font-size:10px;font-weight:bold;>&nbsp;Favoritos</td>";
	RS +=		"</tr>";
	RS +=		"<tr><td height=2></td></tr>";
	RS +=		"<tr>";
	RS +=			"<td width=1%>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"yahoo_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/ybkm.gif></a></td>";
	RS +=			"<td width=15% nowrap>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"yahoo_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Yahoo</a></td>";
	RS +=			"<td width=1%>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"google_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/goog.png></a></td>";
	RS +=			"<td width=15% nowrap>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"google_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Google</a></td>";
	RS +=		"</tr>";
	RS +=		"<tr><td height=2></td></tr>";
	RS +=		"<tr>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"wong_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/misterwong.png></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"wong_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Mr.Wong</a></td>";	
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"face_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/facebook.gif></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"face_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Facebook</a></td>";
	RS +=		"</tr>";
	RS +=		"<tr><td height=2></td></tr>";
	RS +=		"<tr>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"drop_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/dropjack.gif></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"drop_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>DropJack</a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"live_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/live.gif></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"live_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Live MSN</a></td>";
	RS +=		"</tr>";
	RS +=		"<tr><td height=2></td></tr>";
	RS +=		"<tr>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"ask_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/ask.png></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"ask_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Ask</a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"aol_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/aolfav.gif></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"aol_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Aol</a></td>";
	RS +=		"</tr>";
	RS +=		"<tr><td height=2></td></tr>";
	RS +=		"<tr>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"gogo_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/linkagogo.png></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"gogo_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>LinkaGoGo</a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"myspace_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/myspaceicon.jpg></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"myspace_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>MySpace</a></td>";
	RS +=		"</tr>";
	RS +=		"<tr><td height=2></td></tr>";
	RS +=		"<tr>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"blink_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/blinklist.png></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"blink_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>Blinklist</a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer; onclick='redirectURLCompartirlo(\"stumbleupon_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'><img src=http://www.costasur.com/images/gfx/strumbleupon.jpg></a></td>";
	RS +=			"<td>&nbsp;<a style=cursor:pointer;font-size:10px;font-weight:bold; onclick='redirectURLCompartirlo(\"stumbleupon_bookmarks\", \"" + urlLink + "\", \"" + urlTitle + "\")'>SUpon</a></td>";
	RS +=		"</tr>";
	RS +=		"<tr><td colspan=5 style='font-size: 10px; text-align: center;padding-bottom: 2px;'><a href='http://www.compartirlo.com' target=_blank>www.compartirlo.com</a></td></tr>";
	RS +=	"</table>"; 
 	
 	document.getElementById('ventana').innerHTML = RS;
 	document.getElementById('compartirloButton').setAttribute('onmouseover', 'mostrarCompartirlo("ventana")');
}

function ucFirst(string)
{
	 return string.substr(0,1).toUpperCase()+string.substr(1,string.length).toLowerCase();
}

function ocultarCompartirlo(ventana)
{ 
	document.getElementById(ventana).style.display="none"; 
}

function mostrarCompartirlo(ventana)
{ 
	document.getElementById(ventana).style.display=""; 
}

getDimensions = function(oElement) 
{
	var x, y, w, h;
	x = y = w = h = 0;

	if (document.getBoxObjectFor) 
	{ // Mozilla
		var oBox = document.getBoxObjectFor(oElement);
		x = oBox.x-1;
		w = oBox.width;
		y = oBox.y-1;
		h = oBox.height;
	}
	else if (oElement.getBoundingClientRect) 
	{ // IE
		var oRect = oElement.getBoundingClientRect();
		x = oRect.left-2;
		w = oElement.clientWidth;
		y = oRect.top-2;
		h = oElement.clientHeight;
	}
	
	return {x: x, y: y, w: w, h: h};
}

function redirectURLCompartirlo(linkID, url, title)
{
	
	switch(linkID)
	{
		case 'yahoo_bookmarks':
			
			window.open("http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&u=http%3A%2F%2F" + url + "%2F&t=" + title,"Yahoo");
			break;

		case 'google_bookmarks':
			window.open("http://www.google.com/bookmarks/mark?op=add&bkmk=http%3A%2F%2F" + url + "%2F&title=" + title, "Google");
			break;
		
		case 'icio_bookmarks':
			window.open("https://secure.del.icio.us/safe?url=" + url + "&title=" + title + "&partner=addthis&v=4", "Icio");
			break;

		case 'digg_bookmarks':
							http://digg.com/submit/processing?key=a48d33ddcbbf715ec46e0607f3d293c3&type=Crawl
			window.open("https://secure.del.icio.us/safe?url=" + url + "&title=" + title + "&partner=addthis&v=4", "Digg");
			break;

		case 'face_bookmarks':
						 
			window.open("http://www.facebook.com/sharer.php?u=http%3A%2F%2F" + url + "%2F&t=" + title , "FaceBook");
			break;

		case 'yahooMyWeb_bookmarks':
			window.open("http://myweb.yahoo.com/myresults/join?.done=http%3A%2F%2Fmyweb.yahoo.com%2Fmyresults%2Fbookmarklet%3Fu%3D" + url + "%26t%3D" + title + "%26ei%3DUTF-8", "YahooMyWeb");
			break;

		case 'wine_bookmarks':
			window.open("https://www.newsvine.com/_tools/user/login?redirect=http%3A%2F%2Fwww.newsvine.com%2F_tools%2Fseed%26save%3Fu%3D" + url + "%26h%3D" + title + "", "Wine");
			break;

		case 'reddit_bookmarks':
			window.open("http://reddit.com/login?dest=%2Fsubmit%3Furl%3D" + url + "%26title%3D" + title + "", "Reedit");
			break;

		case 'live_bookmarks':
			window.open("https://favorites.live.com/quickadd.aspx?marklet=0&mkt=en-us&url=" + url + "&title=" + title + "&top=1", "Live");
			break;

		case 'ask_bookmarks':
			window.open("http://myjeeves.ask.com/mysearch/BookmarkIt?v=1.2&t=webpages&url=" + url + "&title=" + title + "", "ask");
			break;
		
		case 'aol_bookmarks':
			window.open("http://favorites.my.aol.com/ffclient/webroot/0.4.5/src/html/addBookmarkDialog.html?url=http%253A%252F%252F"+ url +"%252F&title=" + title +"&description=", "aol");
			break;

		case 'slash_bookmarks':
			window.open("http://slashdot.org/bookmark.pl?url=" + url + "", "slash");
			break;
		
		case 'fark_bookmarks':
			window.open("http://cgi.fark.com/cgi/fark/submit.pl?new_url=" + url + "&new_comment=" + title + "", "fark");
			break;

		case 'simpy_bookmarks':
			window.open("http://www.simpy.com/simpy/Login.do?_doneURI=%2Fsimpy%2FLinkAdd.do%3Fhref%3D" + url + "%26title%3D" + title + "", "simpy");
			break;

		case 'raw_bookmarks':
			window.open("http://www.rawsugar.com/login/ext_login?tttl=note%3D&turl=" + url + "", "Rawsugar");
			break;

		case 'blog_bookmarks':
			window.open("http://blogmarks.net/my/new.php?mini=1&simple=1&url=" + url + "&title=" + title + "", "Blogmark");
			break;

		case 'gogo_bookmarks':
			window.open("http://www.linkagogo.com/go/AddNoPopup?url=" + url + "&title=" + title + "", "Linkagogo");
			break;

		case 'wong_bookmarks':
			window.open("http://www.mister-wong.es/index.php?action=addurl&bm_url=http://" + url + "&bm_description=" + title + "", "Mr.Wong");
			break;

		case 'magnolia_bookmarks':
			window.open("http://ma.gnolia.com/signin?add_url=" + url + "", "Magnolia");
			break;
			
		case 'diigo_bookmarks':
			window.open("http://www.diigo.com/sign-in?referInfo=%2Fpost%3Furl%3D" + url + "%26title%3D" + title + "", "Diigo");
			break;

		case 'blue_bookmarks':
			window.open("http://faves.com/Authoring.aspx?u=" + url + "&t=" + title + "", "Blue Dot");
			break;

		case 'segnalo_bookmarks':
			window.open("http://segnalo.alice.it/login.html.php?uri=%2Fpost.html.php%3Furl%3Dhttp%253A%252F%252F" + url + "%26title%3D" + title + "", "Segnalo");
			break;

		case 'netvouz_bookmarks':
			window.open("http://netvouz.com/action/submitBookmark?url=http%3A%2F%2F" + url + "&title=" + title + "&popup=no", "Netvouz");
			break;

		case 'blink_bookmarks':
			window.open("http://www.blinklist.com/index.php?Action=Blink/addblink.php&Url=http://" + url + "&Title=" + title, "Blinklist");
			break;

		case 'drop_bookmarks':
			window.open("http://www.dropjack.com/login.php?return=/submit.php?url=http://" + url, "DropJack");
			break;

		case 'feed_bookmarks':
			window.open("http://feedmelinks.com/login?bounceToPage=%2Fcategorize%3F%26loggedIn%3Dwasnt%26from%3Dtoolbar%26op%3Dsubmit%26url%3Dhttp%253A%252F%252F" + url + "%26name%3D" + title, "Feedmelinks");
			break;
			
		case 'myspace_bookmarks':
						http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.addthis.com%2F&t=AddThis+-+Social+Bookmark+%26+Feed+Button+Builder&c=%3Ca+href%3D%22http%3A%2F%2Fwww.addthis.com%2F%22%3EAddThis+-+Social+Bookmark+%26+Feed+Button+Builder%3C%2Fa%3E%0A%3Cp%3E+%3C%2Fp%3E%0AShared+via+%3Ca+href%3D%22http%3A%2F%2Faddthis.com%22%3EAddThis%3C%2Fa%3E%0A
			window.open("http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2F" + url + "%2F&t=" + title, "MySpace");
			break;
			
		case 'stumbleupon_bookmarks':
			window.open("http://www.stumbleupon.com/submit?url=http%3A%2F%2F" + url + "%2F&title=" + title, "StumbleUpon");
			break;
			
			
	}
}

function addFavorite(pagina, descripcion) 
{
	var url = pagina; 
	var titulo = descripcion;	
	
	var ns = "Para añadir esta página a tus favoritos, pulsa: [ Ctrl ] + [ D ]"; 
	var op = "Para añadir esta página a tus favoritos, pulsa: [ Ctrl ] + [ D ]"; 
	
	if (window.sidebar) 
	{ // Mozilla Firefox 
		window.sidebar.addPanel(titulo, url,"");
	} 
	else if( window.external ) 
	{ // IE 
		window.external.AddFavorite( url, titulo); 
	}
	else if(window.opera && window.print) 
	{ // Opera
		alert(op); 
	}
	else if(navigator.appName == "Netscape")
	{ // Netscape
		alert(ns); 
	}
}

