function enviaAccion() {
	var arg = enviaAccion.arguments;
	var numero_argumentos = arg.length;
	var url='';

	var modulo = "";
	var accion = "";
	var opcion = "";
	var v4 = "";
	var v5 = "";
	var v6 = "";
	var v7 = "";
	
	if(numero_argumentos>6) v7 = arg[6];
	if(numero_argumentos>5) v6 = arg[5];
	if(numero_argumentos>4) v5 = arg[4];
	if(numero_argumentos>3) v4 = arg[3];
	if(numero_argumentos>2) accion = arg[2];
	if(numero_argumentos>1) opcion = arg[1];
	if(numero_argumentos>0) modulo = arg[0];

	//si borramos un registro preguntamos primero
	if(accion=="borrar") if(!confirm("Está seguro que desexa borrar este rexistro")) return true;
	
	/** /
	getId('modulo').value=modulo;
	getId('opcion').value=opcion;
	getId('accion').value=accion;
	/**/
	if(modulo) {
		url += modulo + '/';
		if(opcion) {
			url += opcion + '/';
			if(accion){
				url += accion + '/';
				if(v4) {
					url += v4 + '/';
					if(v5) {
						url += v5 + '/';	
						if(v6) {
							url += v6 + '/';
							if(v7) {
								url += v7 + '/';	
							}
						}
					}
				}
			}
		}
	}

	if(url){
		url = "/" + url;
		document.formulario.action=url;
	}
	/**/
	document.formulario.submit();
}
function getVoid() {
	return false;	
}
function envia_con_post(url) {
	document.formulario.action=url;
	document.formulario.submit();
}
function limpiar_campo(campo) {
	var obj;
	if(obj = getId(campo)) {
		obj.value='';	
	}
}
function ovr() {
	this.className="onmouseover";
	return true;
}
function out() {
	this.className="onmouseout";
	return true;
}
function getId(id) {
	return document.getElementById(id);
}
function getName(id) {
	return document.getElementsByName(id);
}
function returnFase() {
	return false;
}
function enviaPagina(nombre_var, pagina, modulo, opcion, accion, id_entidad_seleccionada) {
	var arg = enviaPagina.arguments;
	var numero_argumentos = arg.length;
	var campo_extra = "";
	if(numero_argumentos>6) campo_extra = arg[4];

	if(!nombre_var)nombre_var='offset';
	if (pagina=='') return false;
	ponvar(nombre_var,pagina);
	enviaAccion(modulo, opcion, accion, id_entidad_seleccionada);
}
function ponvar(){
	var variable,valor,nombre;
	if (ponvar.arguments.length < 2) {
		alert('uso incorrecto de ponvar(variable,valor[,nombre]);');
		return false;
	}
	if (ponvar.arguments.length >= 2) {
		variable=ponvar.arguments[0];
		valor=ponvar.arguments[1];
	}
	if (ponvar.arguments.length >= 3) {
		nombre=ponvar.arguments[2];
	} else nombre=variable;
	var obj,txt;
	if (obj=getId(variable)) obj.value=valor;
	else {
		txt=document.createElement('input');
		txt.type='hidden';
		txt.name=nombre;
		txt.id=variable;
		txt.value=valor;
		if (obj=getId('datos_js')) obj.appendChild(txt);
		else if (obj=document.formulario) obj.appendChild(txt);
		else alert('ERROR ACCEDIENDO A <span id="datos_js">(' + document.location + ')');
	}
}
//Esta funcion realiza el cambio de la imagen de checkbox y cambia el valor del hidden asociado a esa imagen
function NOchequear(num,nombre) {
	if(num == 0) {//Si la opcion es seleccionar todos
		marcar_chk(nombre,num);
	} else if(num==-1) {//Si la opcion es desseleccionar todos
		marcar_chk(nombre,num);
	} else {
		img = getId("chk"+nombre+num);
		hid = getId(nombre+num);
		if(hid && hid.disabled) {
			img.src = "/" + carpetaplantillas + "imagenes/checkbox_si.gif";
			
			hid.disabled = false;
		} else {
			img.src = "/" + carpetaplantillas + "imagenes/checkbox_no.gif";
			hid.disabled = true;
		}
	}
}
function chequear(num,nombre) {
    if (num==0 || num==-1) marcar_chk2(nombre,num);
    else {
        var img=getId('chk' + nombre + num);
        var hid=getId(nombre + num);
        if (hid && hid.disabled) {
            pon(img,'checked');
            hid.disabled=false;
            $('#extra_'+num).css('display','');
        } else {
            quita(img,'checked');
            hid.disabled=true;
            $('#extra_'+num).css('display','none');
        }
    }
}

function marcar_chk2(nombre,modo){
    sel=getName(nombre + '[]');
    for (var i=0;i < sel.length;i++){
        img = getId("chk"+nombre+sel[i].value);
        if(modo==0) {
            pon(img,'checked');
            sel[i].disabled = false;
        } else if(modo==-1) {
            quita(img,'checked');
            sel[i].disabled = true;
        }
    }
}

function pon(obj,estilo){
    var cn=obj.className.split(' ');
    cn[cn.length]=estilo;
    obj.className=cn.join(' ');
}
function quita(obj,estilo){
    var cn=obj.className.split(' ');
    var s=new Array();
    var i;
    for (i in cn) if (cn[i]!=estilo) s[s.length]=cn[i];
    obj.className=s.join(' ');
}

function marcar_chk(nombre,modo){
	sel=getName(nombre + '[]');
	for (var i=0;i < sel.length;i++){
		img = getId("chk"+nombre+sel[i].value);
		if(modo==0) {
			img.src = "/" + carpetaplantillas+"imagenes/checkbox_si.gif";
			sel[i].disabled = false;
		} else if(modo==-1) {
			img.src = "/" + carpetaplantillas+"imagenes/checkbox_no.gif";
			sel[i].disabled = true;
		}
	}
}
function ponValoresBonoPredefinido(arrayJsValoresPredefinido) {
	var i;
	for ( i in arrayJsValoresPredefinido ) {
		if(obj=getId(i)) 
			obj.value = arrayJsValoresPredefinido[i];
			
	}
}
function buscar(bsq) {
	if(bsq.length!="") {
		/** /
		//15/06/2009 11:47:57 modificamos hightlight para poder anadir anclas
		$('#container').removeHighlight().each(function() { $.highlight(this, bsq)})
		/**/
		$('#container').removeHighlight();
		$('.highlight_ancla_link').remove();
		highlightSearchTerms(bsq, true);
		if(!getId("highlight_ancla0")) {
			alert(info_no_se_encontraron_resultados);
		} else {
			document.location.href = '#highlight_ancla0';
		}
		/**/
	} else {
		/** /
		//15/06/2009 11:47:57 modificamos hightlight para poder anadir anclas
		getId('highlight').value='';
		$('#container').removeHighlight();
		/**/
		getId('highlight').value='';
		$('#container').removeHighlight();
		$('.highlight_ancla_link').remove();
		/**/
	}
	window.scrollBy(0,-30);
}
var temporizadorenvios=Array();
function enviodiferido(fuctions,tiempo) {
	var t;
	if (t=temporizadorenvios[fuctions]) window.clearTimeout(t);
	temporizadorenvios[fuctions]=window.setTimeout(fuctions,tiempo);
}
function verobj(obj) {
	var i,salida;
	salida=getId('salida');
	for (i in obj) {
		salida.innerHTML+=obj.name + "." + i;
		try {
			salida.innerHTML+= '= ' + obj[i];
		} catch(e){
			salida.innerHTML+= "["+ e + "]";
		}
		salida.innerHTML+=";<br>";
	}
}
function moc(nombre,nivel,clase){
	if (objetillo = document.getElementById(nombre)){
		if (objetillo.style.display == 'none'){
			objetillo.style.display = '';	
			if (objetillo2 = document.getElementById(nombre+'_im')){
				objetillo2.className='mi_menos'+nivel+'_'+clase;
			}
		}else{
			objetillo.style.display = 'none';
			if (objetillo2 = document.getElementById(nombre+'_im')){	
				objetillo2.className='mi_mas'+nivel+'_'+clase;
			}			
		}
	}
}
function pressEnterHighlight(e){
	if(e.keyCode == 13) {
		buscar(getId('highlight').value.toUpperCase());
		return false;
	}
}
function pressEnterCalendarSearch(e){
	if(e.keyCode == 13) {
		getId('calendarsearch').click();
		return false;
	}
}
function trim(str) {return str.replace(/(^\s*)|(\s*$)/g,"")}
function verSeleccion(){
	//Para IExplorer
	if(typeof document.selection != 'undefined' && document.selection) {
		return trim(document.selection.createRange().text);
	}
	//Para Mozilla
	else if(typeof window.getSelection()!='undefined'){
		return trim(window.getSelection().toString());
	}
}
function setHoy(obj) {
	var mydate=new Date();
	var year=mydate.getFullYear();
	var month=mydate.getMonth() + 1;
	if(month<10) month = "0" + month;
	var day=mydate.getDate();
	if(day<10) day = "0" + day;
	var hoy = year + "-" + month + "-" + day;
	obj.value=hoy;
}
function validaremail(email) {
	valor=email;
	var reesp=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
	if (reesp.test(valor)){
		return (true)
	} else {
		return (false);
	}
}
function sentDatosFacturacion(frmaction) {
	var errores = false;
	if( getId("nombre").value==""){		getId("error_nombre").innerHTML="&nbsp;Obligarorio";errores = true;}
	else 					getId("error_nombre").innerHTML="";
	if( getId("cp").value==""){		getId("error_cp").innerHTML="&nbsp;Obligatorio";errores = true;}
	else 					getId("error_cp").innerHTML="";
	if(validaremail(getId("email").value)==false){getId("error_email").innerHTML="&nbsp;Incorrecto";errores = true;}
	else 					getId("error_email").innerHTML="";
	if( getId("telefono").value==""){	getId("error_telefono").innerHTML="&nbsp;Obligatorio";errores = true;}
	else 					getId("error_telefono").innerHTML="";
	if( getId("poblacion").value==""){	getId("error_poblacion").innerHTML="&nbsp;Obligatorio";errores = true;}
	else 					getId("error_poblacion").innerHTML="";
	if( getId("nif_cif").value==""){	getId("error_nif_cif").innerHTML="&nbsp;Obligatorio";errores = true;}
	else 					getId("error_nif_cif").innerHTML="";
	if( getId("direccion").value==""){	getId("error_direccion").innerHTML="&nbsp;Obligatorio";errores = true;}
	else 					getId("error_direccion").innerHTML="";
	if(errores == false) {
		document.formulario.action=frmaction;
		document.formulario.submit();
	}
}
function numerico(valor){
  cad = valor.toString();
  for (var i=0; i<cad.length; i++) {
    var caracter = cad.charAt(i);
	if (caracter<"0" || caracter>"9")
	  return false;
  }
  return true;
}
function obtenerDigito(valor){
  valores = new Array(1, 2, 4, 8, 5, 10, 9, 7, 3, 6);
  control = 0;
  var i;
  for (i in valores)
    control += parseInt(valor.charAt(i)) * valores[i];
  control = 11 - (control % 11);
  if (control == 11) control = 0;
  else if (control == 10) control = 1;
  return control;
}
function validarcuenta(banco, sucursal, dc, cuenta) {
  if (banco == ""  || sucursal == "" ||
      dc == "" || cuenta == "")
   return "Introduzca los datos de su cuenta";
  else {
    if (banco.length != 4 || sucursal.length != 4 ||
        dc.length != 2 || cuenta.length != 10)
      return "Por favor, introduzca correctamente los datos de su cuenta. No están completos";
    else {
      if (!numerico(banco) || !numerico(sucursal) ||
          !numerico(dc) || !numerico(cuenta))
       return "Por favor, introduzca correctamente los datos de su cuenta. No están completos";
      else {
        if (!(obtenerDigito("00" + banco + sucursal) ==
              parseInt(dc.charAt(0))) || 
            !(obtenerDigito(cuenta) ==
              parseInt(dc.charAt(1))))
          return "Los dígitos de control no se corresponden con los demás números de la cuenta";
	    else
         	return false
      }
    }
  }
}

function sendDatosCuenta(frmaction) {
	var error_cuenta=validarcuenta(getId("banco").value, getId("sucursal").value, getId("dc").value, getId("cuenta").value);
	if(!error_cuenta) {
		document.formulario.action=frmaction;
		document.formulario.submit();
	} else {
		alert(error_cuenta);
		getId("error").innerHTML=error_cuenta;
	}
}
function ponCerosIzquierda(numero,ceros) {
	return ceros.substring(0,ceros.length-numero.length)+numero;
}
function muestraOcultaDocumentosConvenios() {
	if(getId("mostrardocumentos").checked) {
		getId("mostrardocumentos").checked='';
	} else {
		getId("mostrardocumentos").checked='checked';
	}
}
function muestraSubvencionesResumentesNormas(url,vigencia) {
	if(vigencia) {
		getId("subvencionesvigentes").checked='checked';
	} else {
		getId("subvencionesvigentes").checked='';
	}
	envia_con_post(url);
	return true;
}
function seleccionaVozSubvencion(id) {
	var obj = getId("id_vozsubvencion");
	if(obj) {
		obj.value=id;
	} else {
		return false;
	}
}
function muestraSectorEmpresa() {
	switch(getId("tipoconvenio").value) {
		case "Sector":
			getId("tipoconvenio").value="Empresa";
		break;
		case "Empresa":
			getId("tipoconvenio").value="Sector";
		break;
	}
}
function enviaQuizasQuisoDecir(value) {
	getId("pa").value=value;
}
var highlight_count = 0;
var highlight_actual = 0;
function highlight_ancla_click(op) {
	switch(op) {
		case 1:if(getId("highlight_ancla" + (highlight_actual - 1))) highlight_actual --;break;
		case 2:if(getId("highlight_ancla" + (highlight_actual + 1))) highlight_actual ++;break;
	}
	document.location.href = '#highlight_ancla' + highlight_actual;
	window.scrollBy(0,-30);
}
function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag) {
	// the highlightStartTag and highlightEndTag parameters are optional
	var ancla1='',ancla2='';
	if ((!highlightStartTag) || (!highlightEndTag)) {
		highlightStartTag = "<span class = 'highlight'>";
		highlightEndTag = "</span>";
	}

	// find all occurences of the search term in the given text,
	// and add some "highlight" tags to them (we're not using a
	// regular expression search, because we want to filter out
	// matches that occur within HTML tags and script blocks, so
	// we have to do a little extra validation)

	var newText = "";
	var i = -1;
	var lcSearchTerm = searchTerm.toLowerCase();
	var lcBodyText = bodyText.toLowerCase();
	while (bodyText.length > 0) {
		i = lcBodyText.indexOf(lcSearchTerm, i+1);
		// enlace del elemento actual
		ancla1 = "<a class='highlight_ancla_link' id='highlight_ancla" + (highlight_count) + "' name='highlight_ancla" + (highlight_count) + "'></a>";
		if (i < 0) {
			newText += bodyText;
			bodyText = "";
		} else {
			// skip anything inside an HTML tag
			if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
				// skip anything inside a <script> block
				if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
					// aumentamos contador para siguiente y anterior
					highlight_count = highlight_count + 1;
					newText += bodyText.substring(0, i) + ancla1 + highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag + ancla2;
					bodyText = bodyText.substr(i + searchTerm.length);
					lcBodyText = bodyText.toLowerCase();
					i = -1;
				}
			}
		}
	}
	
	return newText;
}


/*
* This is sort of a wrapper function to the doHighlight function.
* It takes the searchText that you pass, optionally splits it into
* separate words, and transforms the text on the current web page.
* Only the "searchText" parameter is required; all other parameters
* are optional and can be omitted.
*/


function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag) {
	highlight_count = 0;
	// if the treatAsPhrase parameter is true, then we should search for
	// the entire phrase that was entered; otherwise, we will split the
	// search string so that each word is searched for and highlighted
	// individually

	if (treatAsPhrase) {
		searchArray = [searchText];
	} else {
		searchArray = searchText.split(" ");
	}
	
	if (!getId('contenido_documento') || typeof(getId('contenido_documento').innerHTML) == "undefined") {
		if (warnOnFailure) {
			alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
		}
		return false;
	}

	//var bodyText = document.body.innerHTML;
	var bodyText = getId('contenido_documento').innerHTML;
	
	for (var i = 0; i < searchArray.length; i++) {
		bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);
	}
	
	//document.body.innerHTML = bodyText;
	getId('contenido_documento').innerHTML = bodyText;
	return true;
}
function muestraOculta(id) {
	var el;
	if(el=document.getElementById('vistaAvanzada_'+id)) {
		if(el.style.display=='none') {
			document.getElementById('muestraOculta_'+id).className="boton_mas";
			el.style.display='';
		} else {
			document.getElementById('muestraOculta_'+id).className="boton_menos";
			el.style.display='none';			
		}
	}
}
//
function ordenar(id) {
	var updown = '';
	if(getId('ordenar_nombre').value == id) {
		if(getId('ordenar_tipo').value == 'up') {
			updown = 'down';
		} else {
			updown = 'up';
		}
	} else {
		updown = 'down';
	}

	getId('ordenar_nombre').value = id;
	getId('ordenar_tipo').value = updown;
	
	enviaAccion();
}
function in_array(value, arr) {
	for (i in arr) if(arr[i] == value) return true; return false;
}
function selprovincia(value) {
	enviaAccion();
}
function verLogEnvio(valor,opcion,id_relacion) {
	if(opcion) {
		abreVentana('/includes/verlogenvio.php?id_e=' + valor + "&op=" + opcion + "&rel=" + id_relacion, 820, 600);
	} else {
		abreVentana('/includes/verlogenvio.php?id_e=' + valor, 820, 600);
	}
			
}
function abreVentana(pagina, ancho, alto){
	posY= (screen.height - alto) / 2;
	posX= (screen.width - ancho) / 2;
	window.open(pagina, '', 'Resizable=yes,menubar=no,Scrollbars=yes,toolbar=no,top='+ posY +',left='+ posX + ',height='+ alto +',width=' + ancho);
}
function muestroOcultaOpciones(valor) {
	var array_aspectos_alertables = new Array('convenio','subvencion');
	var obj;
	for(i in array_aspectos_alertables) {
		if(obj = getId('opciones' + array_aspectos_alertables[i])) {
			if(array_aspectos_alertables[i] == valor) {
				obj.style.display='';
			} else {
				obj.style.display='none';
			}
		}
	}
}
function seleccionar_todo(){
   for (i=0;i<document.formulario.elements.length;i++)
      if(document.formulario.elements[i].type == "checkbox")
         document.formulario.elements[i].checked=1;
}

function deseleccionar_todo(){
   for (i=0;i<document.formulario.elements.length;i++)
      if(document.formulario.elements[i].type == "checkbox")
         document.formulario.elements[i].checked=0;
}
function previsualizarenvio(id_caso_padre) {
	document.formulario.action = '/includes/previsualizarenvio.php';
	document.formulario.target='_blank';
	document.formulario.submit();
	document.formulario.action = '';
	document.formulario.target='_self';
}
function enviar_a_ventana_nueva(web) {
	document.formulario.action = web;
	document.formulario.target='_blank';
	document.formulario.submit();
	document.formulario.action = '';
	document.formulario.target='_self';
}
function veradjunto(id) {
	abreVentana('/includes/desdoc.php?id_adjunto=' + id, 820, 600);
}
function crear_alerta_siguiente(paso,txt) {
	switch(paso) {
		case 1:
			if(!getId('pa').value) {
				if(txt) {
					alert(txt);
				}
			} else {
				enviaAccion();
			}
		break;
	}	
}
function datos_norma(interno){
	$.ajax({
		beforeSend: function(objeto){
			$("#contenido_enlazar_texto_normas").html("... Cargando ...");
		},
        type: "POST",
        url: "/includes/ajax_normas.php",
        success: function(data) {
       		$("#contenido_enlazar_texto_normas").html(data);
        },
       	data: "interno="+interno+"&plantilla=1"
	});	
}
function datos_practico(codigo){
	$.ajax({
		beforeSend: function(objeto){
			$("#contenido_enlazar_texto_normas").html("... Cargando ...");
		},
        type: "POST",
        url: "/includes/ajax_practicos.php",
        success: function(data) {
       		$("#contenido_enlazar_texto_normas").html(data);
        },
       	data: "codigo="+codigo+"&plantilla=1"
	});	
}



var bubble_funcionando;
var bubble_funcionando2;
var bubble_funcionando3;
var mouseX;
var mouseY;
var mouseYactual;
var mouseXactual;
var tab_counter = 0;
var tab_contenido = '';
var carga_principal = 0;

function addTab(data) {
	tab_contenido = '...Cargando...'
					
	if (data){
		data = data.split('|||');
		for (dato in data){
			var aux = data[dato].split('--');
			var tipodoc = aux[0];
			var numrel = aux[1];

			switch(tipodoc)
			{
				case "comentario":
					var tab_title = "Comentarios";
					$("#bubbletip").tabs('add', '#bubbletip_comentarios', tab_title);
				break;
				case "sentencia":
					var tab_title = "Sentencias";
					$("#bubbletip").tabs('add', '#bubbletip_jurisprudencia', tab_title);
				break;
				case "practico":
					var tab_title = "Casos Practicos";
					$("#bubbletip").tabs('add', '#bubbletip_practicos', tab_title);
				break;
				case "formulario":
					var tab_title = "Formularios";
					$("#bubbletip").tabs('add', '#bubbletip_formularios', tab_title);
				break;
				case "legislacion":
					var tab_title = "Legislacion";
					$("#bubbletip").tabs('add', '#bubbletip_legislacion', tab_title);
				break;
				default:
				
				break;
			}			
		}	
	}

}	

function datos_norma_popup(interno){
	carga_principal = 0;
	mouseYactual = mouseY;mouseXactual = mouseX;
	
	$("#bubbletip").css( { "height": ""} );
	
	$("#documento_actual").val(interno);
	
	$("#bubbletip").tabs('option', 'selected', 0);
	$("#bubbletip").tabs('remove', 7);$("#bubbletip").tabs('remove', 6);$("#bubbletip").tabs('remove', 5);$("#bubbletip").tabs('remove', 4);
	$("#bubbletip").tabs('remove', 3);$("#bubbletip").tabs('remove', 2);$("#bubbletip").tabs('remove', 1);
	$("#bubbletip").tabs('option', 'selected', 0);
		
	if (bubble_funcionando){bubble_funcionando.abort();bubble_funcionando = null;}
	if (bubble_funcionando2){bubble_funcionando2.abort();bubble_funcionando2 = null;}
	
	bubble_funcionando = $.ajax({
		beforeSend: function(objeto){
			$("#bubbletip_contenido").html("... Cargando ...");
		},
        type: "POST",
        url: "/includes/ajax_normas.php",
        success: function(data) {
       		$("#bubbletip_contenido").html(data);
			reposicionar();
			carga_principal = 1;
        },
       	data: "interno="+interno+"&plantilla=2"
	});	
}
function datos_practico_popup(codigo){
	carga_principal = 0;
	mouseYactual = mouseY;mouseXactual = mouseX;
	
	$("#bubbletip").css( { "height": ""} );
	
	$("#documento_actual").val(codigo);
	$("#bubbletip").tabs('option', 'selected', 0);
	$("#bubbletip").tabs('remove', 7);$("#bubbletip").tabs('remove', 6);$("#bubbletip").tabs('remove', 5);$("#bubbletip").tabs('remove', 4);
	$("#bubbletip").tabs('remove', 3);$("#bubbletip").tabs('remove', 2);$("#bubbletip").tabs('remove', 1);
	$("#bubbletip").tabs('option', 'selected', 0);

	if (bubble_funcionando){bubble_funcionando.abort();bubble_funcionando = null;}
	if (bubble_funcionando2){bubble_funcionando2.abort();bubble_funcionando2 = null;}
	
	bubble_funcionando = $.ajax({
		beforeSend: function(objeto){
			$("#bubbletip_contenido").html("... Cargando ...");
		},
        type: "POST",
        url: "/includes/ajax_practicos.php",
        success: function(data) {
       		$("#bubbletip_contenido").html(data);
			reposicionar();
			carga_principal = 1;
        },
       	data: "codigo="+codigo+"&plantilla=2"
	});	
	
	bubble_funcionando2 = $.ajax({
		beforeSend: function(objeto){},
        type: "POST",
        url: "/includes/ajax_relacionados_pestanas.php",
        success: function(data) {
        	addTab(data);
        	if (carga_principal == 1) reposicionar();
        },
       	data: "codigo="+codigo+"&plantilla=2"+"&indice=menus"
	});		
}

function reposicionar(){
	//$("#bubbletip").tabs({ disabled: [2, 3] });	
	
	var restarY = $("#bubbletip").height();
	var alturaY = restarY - 60;
	var restarX = ($("#bubbletip").width() / 2);
	var finalY  = mouseYactual - restarY + 5;
	var finalX  = mouseXactual - restarX;
	
	$("#bubbletip").css( { "top":finalY + "px", "left":finalX + "px","height":restarY + "px"} );
	
	//$("#bubbletip_contenido").css( {"height":alturaY + "px"} );
	$("#bubbletip_comentarios").css( {"height":alturaY + "px"} );
	$("#bubbletip_jurisprudencia").css( {"height":alturaY + "px"} );
	$("#bubbletip_practicos").css( {"height":alturaY + "px"} );
	$("#bubbletip_formularios").css( {"height":alturaY + "px"} );
	$("#bubbletip_legislacion").css( {"height":alturaY + "px"} );
	
	$("#bubbletip").show();
}
