
//funciones
var matb = {
	'toolbar': function(na, im, fu, ti, ta, id, va){
		if(va != false){
			var boton = '<div class="matb_left"><span class="matb_bullets"><span class="vSepS"><img src="http://miarroba.st/036/iconos/vacio.gif" class="vSep" /></span></span></div> <div class="matb_left"><a href="'+fu+'" target="'+ta+'" id="'+id+'" class="matb_boton tb_'+im+'_'+clase+'" title="'+ti+'"><img src="http://miarroba.st/036/iconos/vacio.gif" width="24" height="24" class="matb_ico"/> '+na+'</a></div>'
		}else{
			var boton = '';
		}
		return boton;
	},

	'marcadores': function(){
		if (window.sidebar) { //Mozilla Firefox
			window.sidebar.addPanel(document.title, window.location.href,"");
		}else if( window.external || document.all) { //Internet Explorer
			window.external.AddFavorite(window.location.href, document.title);
		}else if(window.opera) { //Opera
			jQuery('#matb_bookmarks').attr('href', document.title);
			jQuery('#matb_bookmarks').attr('title', window.location.href);
			jQuery('#matb_bookmarks').attr('rel','sidebar');
		}else{ // otros
			alert('Tu navegador no soporta esta función');
		}
	},
	
	'menu': function(ar){
		var posx = jQuery('#matb_pages').position().left;
		var posy = jQuery('#ma_toolbar').height()+jQuery('#ma_toolbar').position().top;
		if(jQuery('.matb_menu_pages').length == 0){
			var me = '<table id="ma_toolbar" class="matb_menu_pages" style="position:absolute;top:'+(posy+12)+'px;left:'+posx+'px;background-color:transparent;border:0px;">';
			for(t=0; t<ar.length; t++){
				me += '<tr><td><div class="matb_left matb_page_plus" id="miarrobaShareBox" style="padding:2px;text-align:center;"><a href="'+ar[t][1]+'" title="'+ar[t][2]+'" style="color:'+textColor+';text-decoration:none;">'+ar[t][0]+'</a></div></td></tr>';
			}
			me += '</table>';
			
			//insertar en el documento
			jQuery('body').append(me);
			
			//ajustar ancho de opciones
			var maxWidth = 75;
			jQuery('.matb_page_plus').each(function(){
				if(jQuery(this).width() > maxWidth){
					maxWidth = jQuery(this).width();
				}
			});
			jQuery('.matb_page_plus').css({'width':maxWidth});
			
			//eventos onmouseover & onmouseout
			jQuery('.matb_page_plus').mouseover(function(){
				jQuery(this).css('margin-left','5px');
			}).mouseout(function(){
				jQuery(this).css('margin-left','0px');
			});
		}else{
			jQuery('.matb_menu_pages').remove();
		}
	}
};

//cargar estilos
jQuery('<link type="text/css" rel="stylesheet" href="http://miamods.webcindario.com/barra/mod/css/" />').appendTo('head');

//color de toolbar
if(jQuery('.tb_lupa_b').length != 0){
	var clase = 'b';
	var textColor = '#ffffff';
}else{
	var clase = 'w';
	var textColor = '#000000';
}

//ensanchar toolbar
jQuery('#matb_forceWidth').css({
	'maxWidth' : 'none',
	'width' : '98%'
});

//insertar botones
jQuery('.matb_left:last').after(matb.toolbar('Contactar','nuevo_articulo','http://privados.miarroba.es/#!new&to='+contactar,'Haz clic para contactar con el administrador de esta comunidad','_blank','matb_contact',contactar)+matb.toolbar('Favoritos','mi_fotolog','javascript:matb.marcadores();','Haz clic para agregar esta página a tus marcadores','_top','matb_bookmarks',marcadores)+matb.toolbar('Páginas','index','javascript:matb.menu(paginas);','Haz clic para desplegar la lista de páginas','_top','matb_pages',paginas)+matb.toolbar('Twitter','twitter','http://twitter.com/#!/'+twitter,'Haz clic para visitar nuestro twitter','_blank','matb_twitter',twitter));
