function Agregate(agregator, share_url, share_title, share_autor)  {
        if (share_url == undefined || share_url == "") {
            share_url =  window.document.location.href;
        }
        if (share_title == undefined || share_title == "" ) {
            share_title = window.document.title;
        }
        if (share_autor == undefined) {
            share_autor = "";
        }
        //
	var title = encodeURIComponent(share_title);
	var href = encodeURIComponent(share_url);
	var autor = encodeURIComponent(share_autor);
	var components = window.document.location.href.split('/');
	var tag = title;

	switch(agregator){
		case 'meneame' :
			url = 'http://meneame.net/submit.php?url='+href;
                        width = 800;
                        height = 500;
			break;
		case 'digg' :
			url = 'http://digg.com/submit?phase=2&url='+href+'&title='+title;
                        width = 800;
                        height = 500;
			break;
		case 'delicious' :
			url = 'http://del.icio.us/post?url='+href+'&title='+title;
                        width = 800;
                        height = 500;
			break;
		case 'technorati' :
			url = 'http://www.technorati.com/search/'+tag+'?sub=postcosm';
                        width = 800;
                        height = 500;
			break;
		case 'yahoo' :
			url = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?u='+href+'&t='+title+'&ei=UTF-8';
                        width = 800;
                        height = 500;
			break;
		case 'fresqui' :
			url = 'http://tec.fresqui.com/post?url='+href+'&title='+title;
                        width = 800;
                        height = 500;
			break;
		case 'facebook' :
		    url = 'http://www.facebook.com/sharer.php?u='+href+'&t='+title;
                        width = 650;
                        height = 426;
		    break;
                case 'twitter' :
                        url = 'http://twitter.com/home?status='+share_title + ' ' + share_url;
                        width = 800;
                        height = 500;
                    break;
                case 'email' :
                        url = share_title + '?u=' + share_url + '&id='+share_autor;
                        width = 760;
                        height = 500;
                    break;
	}
	window.open(url, 'Compartir', 'toolbar=0,status=0,width=' + width + ',height=' + height);
}

// Jquery //

$(document).ready(function(){
	
	$("#banner_addwords_deplegable").css({ display: 'none' });

	// Display de les acotacions
	$("form ul li input").focus( function() {
		$(".acotacion").hide();
		$(this).parent().find(".acotacion").show();
	});
	$("form ul li textarea").focus( function() {
		$(".acotacion").hide();
		$(this).parent().find(".acotacion").show();
	});
	$("form ul li select").focus( function() {
		$(".acotacion").hide();
		$(this).parent().find(".acotacion").show();
	});
	$("form ul li label").click( function() {
		$(".acotacion").hide();
		$(this).parent().find(".acotacion").show();
	});
	$("form ul li img").click( function() {
		$(".acotacion").hide();
		$(this).parent().find(".acotacion").show();
	});
	
	// Acotaciones Tutores
	$("div.campo input, div.campo textarea, div.campo select").focus( function() {
		$(".acotacion_tutores").hide();
		$(this).parent().find(".acotacion_tutores").show();
	});
	
	$(".combinado ul li input.txt").focus( function() {
		$(".acotacion_tutores").hide();
		$(this).parent().find(".acotacion_tutores").show();
	});


	// Codi del programador
	$("textarea.text").focus(function(){
		if($(this).val()=='Escriba su respuesta aqu�...')
			$(this).attr("value", "");
	});
	
	////// HOME /////
	// Finestre diagrama bSherpas
	$().mousemove(function(e){
		var x = e.pageX;// - this.offsetLeft;
		var y = e.pageY;// - this.offsetTop;
		
		var pos_x = x - 240; var pos_y = y - 65;   // ventana_bsherpas
		var pos_x2 = x - 180; var pos_y2 = y - 65; // ventana_diagrama
				
		var cssObj = {left: pos_x,top: pos_y}
		var cssObj_2 = {left: pos_x2,top: pos_y2}
		
		$(".ventana_bsherpas").css(cssObj);
		$(".ventana_diagrama").css(cssObj_2);
		
	});
	$("#diagrama area").mouseover(function(){
		var id_link = $(this).attr("id");
		var id_link = id_link.split("_");
		$("#ventana_" + id_link[1]).show();
	});
	$("#diagrama area").mouseout(function(){
		var id_link = $(this).attr("id");
		var id_link = id_link.split("_");
		$("#ventana_" + id_link[1]).hide();
	});

	// Mapa con proyectos
	$().mousemove(function(e){
			var x = e.pageX;// - this.offsetLeft;
			var y = e.pageY;// - this.offsetTop;
			var pos_x = x + 8;
			var pos_y = y - 32;

			var cssObj = {				
				left: pos_x,
				top: pos_y
			}
		$(".globito").css(cssObj);
	});
	$("#mapa_proyectos a").mouseover(function(){
		var id_link = $(this).attr("id");
		var id_link = id_link.split("_");
		$("#globito_" + id_link[1]).show();
	});
	$("#mapa_proyectos a").mouseout(function(){
		var id_link = $(this).attr("id");
		var id_link = id_link.split("_");
		$("#globito_" + id_link[1]).hide();
	});
					
	// Detalls de Layout
	$("#lang_log_box ul.lang li:last").css("border", "0");	
	var cssObj = {
		border: "0",
		margin: "0"
	}
	
	$("#footer_options ul li:first").css(cssObj);
	$("ul.paginador li a.disabled").attr("href", "javascript:void(0)");	
	$("ul.right_blog_list li ul li:last-child").css("background", "none");
	$("ul.comentarios li").append('<div class="clr_1">&nbsp;</div>');
	
	var browser=navigator.appName;
	if(browser.indexOf('Microsoft') == -1){
		$("ul.comentarios li").find("p:last").css("margin-bottom", "0");
	}
	
	$("ul.comentarios li:last-child").css("background", "none");
	$(".blog_post").append('<div class="clr_1">&nbsp;</div>');

	/*var cssObj = {
		height: "252px",
		overflow: "hidden"
	}
	$("#login_wrapper").parent().css(cssObj);*/
	$("ul.productos li:last-child").css("background", "none");
	
	$("#aviso").fadeIn("slow");
	
	$("input#email_amigo").parent().prev("dt").css("lineHeight", "23px");
	$("input#email_amigo").click(function(){
		$(this).attr("value", "");
	});
	$("input#new_alert").click(function(){
		$(this).attr("value", "");
	});
	
	/* comen�ant x 0, flota a esquerra elements parells. Odd = imparells */
	/* $("ul.colaboradores li:even").css("float", "left");
	$("ul.colaboradores li:odd").css("float", "right"); */
	
	/* buscador */
	$("ul.buscador li:first a.h2").css("marginTop", "0");
	$("ul.buscador li:last").css("borderBottom", "0");

	// Fi Detalls de Layout
	
	/* Banner desplegable home
	 * Para Addwords */
	
    $(".btn-slide").click(function(){
        $("#banner_addwords_deplegable").slideToggle("slow");
        $(this).toggleClass("active"); return false;		
    });
    
	// Barres de valoracio dels projectes (SWF)
	/*
	$(".valoracion_swf").each(function (){
		var val = $(this).attr("title");
		var path = '/swf/estrellas.swf?val='+val;
		var width = '71';
		var height = '15';
		$(this).html('abc');
		$(this).html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" menu="false"><param name="movie" value="'+path+'" /> <param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><embed src="'+path+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent" menu="false"></embed> </object>');
	});
	*/
	// Barres de desenvolupament dels projectes (SWF)
	/*
	$(".desarrollo_swf").each(function (){
		var val = $(this).attr("title");
		var path = '/swf/barra_progreso.swf?val='+val;
		var width = '100';
		var height = '16';
		$(this).html('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" menu="false"><param name="movie" value="'+path+'" /> <param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="menu" value="false" /><embed src="'+path+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent" menu="false"></embed> </object>');
	});
	*/

	

	// SUGGEST
	/* Suggest nuevo mensaje */
	$("#destinatario").focus(function(){
		$(this).siblings(".suggest_usuario").show();
	}).blur(function() {
        $(this).siblings(".suggest_usuario").hide();
	});
	
	// ie6 bug
	if(jQuery.browser.msie == true && parseInt(jQuery.browser.version) < 7 ){
		$(".suggest_usuario li").mouseover(function(){
			var cssObj = {
				background: "#F0F0F0",
				cursor: "pointer"
			}
			$(this).css(cssObj);
		});
		$(".suggest_usuario li").mouseout(function(){
			var cssObj = {
				background: "#F7F7F7"
			}
			$(this).css(cssObj);
		});
	}
	
	$(".suggest_usuario li").mousedown(function(){
//		$(this).prev("input.text").attr("value") = $(this).attr("title");
//		alert($(this).parent().prevAll("input.text").eq(0).attr("value"));

//		$(this).parent().parent().find("input.text").attr("value") = 'abc';//$(this).attr("title");
		$(this).parent().parent().find("input.text").attr("value", $(this).attr("title"));
		$(this).parent().hide();


//		alert($(this).attr("title"));
//alert('horl');
	});
	
    // THICKBOX HIBRID VIDEO
	$("a.thumb_proyecto").click(function(){
                var route = $(this).attr("rel");
                if(route != ''){
                        var html_thickbox = '<div class="TB_overlayBG" id="TB_overlay"></div>';
                        html_thickbox += '<div id="TB_window" style="margin-left: -250px; width: 500px; margin-top: -245px; display: block; border:0; background:none;">';
                        html_thickbox += '<div id="TB_title" style="background:url(/images/bg.thickbox_video.png) no-repeat; height:30px; position:relative; top:3px; #background:url(/images/bg.thickbox_video_ie.png) no-repeat;">';
                        html_thickbox += '<div id="TB_ajaxWindowTitle" style="font-weight:normal; color:#FFF; font-size:16px; line-height:17px;"></div>';
                        html_thickbox += '<div id="TB_closeAjaxWindow"><a href="javascript:$(\'#TB_overlay\').remove();$(\'#TB_window\').remove();void(0);" id="TB_closeWindowButton"><img src="/images/ico.cross.png" alt="Cerrar" border="0" /></a></div>';
                        html_thickbox += '</div>';
                        html_thickbox += '<div id="TB_ajaxContent" style="margin:0; padding:0;">';
                        html_thickbox += '<object type="application/x-shockwave-flash" data="http://www.bsherpas.com/swf/player_flv_maxi.swf?'+route+'" width="500" height="400">';
                        html_thickbox += '<param name="movie" value="http://www.bsherpas.com/swf/player_flv_maxi.swf" />';
                        html_thickbox += '<param name="allowFullScreen" value="true" />';
                        html_thickbox += '<param name="wmode" value="transparent" />';
                        html_thickbox += '<param name="FlashVars" value="'+route+'" />';
                        html_thickbox += '<embed src="http://www.bsherpas.com/swf/player_flv_maxi.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" menu="false" width="500" height="400" flashvars="'+route+'"></embed>';
                        html_thickbox += '</object></div></div>';
                }
                $(this).attr("href", "javascript:void(0);");
                $("body").append(html_thickbox);
        });
});