cuentaLineas = 1000;
contadoresPA = new Array(1000);
var dashboardDesplegado = 0;
var selBolBuscar = 0;

function log(message) {
	if (window.console && console.log) {
	  console.log(message);
	}
}

function debug(variable) {
	if (window.console && console.debug) {
	  console.debug(variable);
	}
}

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 setHoy2(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 = day + "-" + month + "-" + year;
	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;
		case 2:
			if(!getId('pa').value) {
				if(txt) {
					if (confirm(txt)){
						enviaAccion();
					}else{
					}
				}
			} else {
				enviaAccion();
			}
		break;
	}	
}
function crear_boletin_tematico_siguiente(paso,txt)
{
	var continuar = 1;
	if (paso == 3){
		var aux = '';
		var encontrado = 0;
		
		var checkeado = '';

		checkeado=$('#boletines_203').attr("checked");
		if(checkeado) {	
			if ($('#pa_203').length){
				aux = $('#pa_203').val();
				if (aux != ''){
					encontrado = 1;
				}
				
				aux = $('#p_203').val();
				if (aux != ''){
					encontrado = 1;
				}	
				
				if (encontrado == 1){
					continuar = 1;
				}else{
					continuar = 0;
					alert('Debe escribir alguna palabra o frase en el apartado de boletines');
				}
			}
		}
		
		checkeado=$('#boletines_201').attr("checked");
		if(checkeado) {	
			var algunoCheckado = 0;
			$('.comprueba_check').each(function(){		
				var idCheck = this.id;
				
				var checkeado=$('#'+idCheck).attr("checked");
				if(checkeado) {
					algunoCheckado = 1;
				}
			});
			$('.masCategoriasCPV').each(function(){		
				algunoCheckado = 1;
			});
			
			if (algunoCheckado == 1){
				continuar = 1;
			}else{
				continuar = 0;
				alert('Debe seleccionar alguna categoria');
			}
		}
	}
	
	if (continuar == 1)
	{
		if($("#ambitos_seleccionados_general").html() == '' || $("#ambitos_seleccionados_general").html() == '&nbsp;')
		{
			alert("Debe seleccionar su ambito geográfico");

		}
		else if(!alguno_chk('boletines_seleccionados'))
		{
			alert("Debe seleccionar información");		
		}
		else
		{
			ponvar("paso",paso);
			enviaAccion();	
		}
	}
}
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 bloquearPantalla(){
	if ($('#uiLockId').length){
		
	}else{
		var altura = $('body').height();
		
		$('<div></div>').attr('id', 'uiLockId').css({
			'position': 'absolute',
			'top': $('body').position().top,
			'left': $('body').position().left,
			'z-index': 1,
			'opacity': 0.4,
			'width':$('body').width() ,
			'height':altura + 'px',
			'color':'#000000',
			'background-color':'white'
		}).appendTo($('body'));	
	
		$('#uiLockId').click(function(){
			$("#uiLockId").remove();
			$("#bubbletip").css( { "display": "none"} );
		});
	}
}

function datos_norma_popup(interno){
	carga_principal = 0;
	mouseYactual = mouseY;mouseXactual = mouseX;	
	
	$("#bubbletip").show();
	
	$("#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": ""} );
	
	$("#bubbletip").show();
	
	$("#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();
	bloquearPantalla();
}


function abre_seleccionar_ambitos(id_boletin,opcion)
{
	$("#TB_overlay").show();
	$("#sel_ambitos").fadeIn("slow");
	$("embed, object, select").css("visibility","hidden");
	
	if(!opcion)
	{
		opcion = 'seleccionar';
	}
	
	var masDatos = '';
	if(opcion == 'seleccionar-ambitos-dashboard'){
		masDatos = "&ambitos_seleccionados=" + $("#ambitos_seleccionados_final_" + id_boletin).val();
	}

	$.ajax({
		beforeSend: function(objeto){
			$("#contenido_sel_ambitos").html("<span class=\"destacado\">... Cargando ...</span>");
		},
        type: "POST",
        url: "/includes/ajax_seleccionar_ambitos.php?option=" + opcion,
        success: function(data)
        {
       		$("#contenido_sel_ambitos").html(data);
       		BolMarcarDesmarcarTodos();
        },
       	data: "id_boletin=" + id_boletin + masDatos
	});
}
function guarda_seleccionar_ambitos(nombre,id_boletin,opcion)
{
	if(!opcion)
	{
		opcion = 'guardar';
	}
	
    sel=getName(nombre + '[]');
    var datos = 'id_boletin=' + id_boletin;
    var datosFinal = '';
    for (var i=0;i < sel.length;i++)
    {
		if(sel[i].disabled == '')
		{
			datos = datos + "&" + nombre + '[]=' + sel[i].value;
			if(opcion == 'guarda-seleccionar-ambitos-dashboard'){
				datosFinal = datosFinal + sel[i].value + ',';
			}
		}
    }

	$.ajax({
		beforeSend: function(objeto){
			$("#contenido_sel_ambitos").html("... Cargando ...");
		},
        type: "POST",
        url: "/includes/ajax_seleccionar_ambitos.php?option=" + opcion,
        success: function(data)
        {
       		$("#ambitos_seleccionados_" + id_boletin).html(data);
       		seleccionar_ambito_geografico_on_of();
        },
       	data: datos
	});
	
	if(opcion == 'guarda-seleccionar-ambitos-dashboard'){
		$("#ambitos_seleccionados_final_" + id_boletin).val(datosFinal);
	}

	//cerramos popup
	$("#TB_overlay").hide();
	$("#sel_ambitos").hide();
	$("embed, object, select").css("visibility","visible");
}
function abre_popup_info()
{
	$("#TB_overlay").show();
	$("#popup_info").fadeIn("slow");
	$("embed, object, select").css("visibility","hidden");
	$('.select_seccion').css("visibility","visible");
}

function activa_desactiva_popup_info()
{
	$("#activa_desactiva_popup_info").value;
	/** /
	$.ajax({
		beforeSend: function(objeto){
			$("#contenido_popup_info").html("... Cargando ...");
		},
        type: "POST",
        url: "/includes/ajax_desactiva_popup_info.php",
        success: function(data)
        {
       		//$("#id).html(data);
        },
       	data: datos
	});
	
	//cerramos popup
	$("#TB_overlay").hide();
	$("#popup_info").slideUp("slow");
	$("embed, object, select").css("visibility","visible");
	/**/
}

function function_activa_desactiva_popup_info()
{
	var opcion='';
	if($("#activa_desactiva_popup_info").attr("checked"))
	{
		opcion = 'desactivar';
	}
	else
	{
		opcion = 'activar';
	}
	
	$.ajax({
        url: "/includes/ajax_desactiva_popup_info.php?opcion=" + opcion
	});
	
	//cerramos popup
	/** /
	$("#TB_overlay").hide();
	$("#popup_info").slideUp("slow");
	$("embed, object, select").css("visibility","visible");
	/**/
}
function muestra_oculta(id)
{
	if($("#" + id).css("display") == 'none')
	{
		$("#" + id).slideDown();
	}
	else
	{
		$("#" + id).slideUp();
	}
}

function BolMarcarDesmarcarTodos(){
	$('.boletinesMarcarDesmarcarTodos').unbind('click');
	$('.boletinesMarcarDesmarcarTodos').click(function(){
		var auxid = this.id.split('-');
		$(".checkear").each(function(){
			var aux = this.id.split('-');
			if (auxid[1] == aux[1]){
				chequear(aux[2],auxid[1]);
			}
		});		
		
	});		
}
function seleccionar_todas(nombre)
{
	if(getId(nombre + 'todas').checked)
	{
		marcar_chk(nombre,0);
	}
}
function seleccionar_alguna(nombre)
{
	nombre = nombre.replace("[]", "");
	getId(nombre + 'todas').checked = 0;
}
function marcar_chk(nombre,modo){
	sel=document.getElementsByName(nombre + '[]');
	for (var i=0;i < sel.length;i++)
	{
		sel[i].checked=modo;
	}
}
function alguno_chk(nombre){
	var sel = getName(nombre + '[]')
	if(sel["length"])
	{
		for (var i=0;i < sel.length;i++){
			if(sel[i].checked) {
				return true;	
			}
		}
		return false;
	}
	else
	{
		return true;		
	}
}

function envia_post_url() {
	var arg = envia_post_url.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];

	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 + '/';	
							}
						}
					}
				}
			}
		}
	}
	
	//ponemos al final los valores de los select
	var total = '';
	$('.hiddenFestivos').each(function(){
		var aux = $('#'+this.id).val();
		total = total + aux;
	});
	$('.selectFestivos').each(function(){
		var aux = $('#'+this.id).val();
		var aux2 = $("#"+this.id+" option:selected").text();
		total = total + '--' + this.id + ',' + aux+','+aux2;	
		
	});
	$('.selectAnos').each(function(){
		var aux = $('#'+this.id).val();
		var aux2 = $("#"+this.id+" option:selected").text();
		total = total + '--' + this.id + ',' + aux+','+aux2;	

	});
	if (total != ''){
		url += total + '/';
	}	

	if(url){
		url = "/" + url;
		document.formulario.action=url;
	}
	
	document.formulario.submit();
}
function sleep(milliSeconds)
{
    var startTime = new Date().getTime(); // get the current time
    while (new Date().getTime() < startTime + milliSeconds); // hog cpu
}
function addStylesheet(url) {
	var stylesheet = document.createElement('link');
	stylesheet.rel = 'stylesheet';
	stylesheet.type = 'text/css';
	stylesheet.href =  url;
	document.getElementsByTagName('head')[0].appendChild(stylesheet);
}
function abre_mas_informacion(plantilla)
{
	$("#TB_overlay").show();
	$("#mas_informacion").fadeIn("slow");
	$("embed, object, select").css("visibility","hidden");
	$.ajax({
		beforeSend: function(objeto){
			$("#contenido_mas_informacion").html("<span class=\"destacado\">... Cargando ...</span>");
		},
        type: "POST",
        url: "/includes/ajax_mas_informacion.php",
        success: function(data)
        {
       		$("#contenido_mas_informacion").html(data);
        },
       	data: "plantilla=" + plantilla
	});
}

function anadir_mas_pa(idboletin){
	var html = $('#pa_extra_'+idboletin).html();
	
	var aux = contadoresPA[idboletin]["pa"];
	
	html = html.replace(/aaIDaa/gi,cuentaLineas);
	html = html.replace(/aaNUMEROaa/gi,aux);
	
	$('#pa_extra_final_'+idboletin).append(html);
	
	contadoresPA[idboletin]["pa"]++;
	cuentaLineas++;
}
function anadir_mas_p(idboletin){
	var html = $('#p_extra_'+idboletin).html();
	
	var aux = contadoresPA[idboletin]["p"];
	
	html = html.replace(/aaIDaa/gi,cuentaLineas);
	html = html.replace(/aaNUMEROaa/gi,aux);
	$('#p_extra_final_'+idboletin).append(html);
	
	contadoresPA[idboletin]["p"]++;	
	
	cuentaLineas++;
}
function abre_popup_identificacion(url,poner_request_uri)
{
  poner_request_uri = poner_request_uri || true;

	$("#TB_overlay").show();
	$("#identificacion").fadeIn("slow");
	$("embed, object, select").css("visibility","hidden");
	$.ajax({
		beforeSend: function(objeto){
			$("#contenido_identificacion").html("<span class=\"destacado\">... Cargando ...</span>");
		},
    type: "POST",
    url: "/includes/ajax_identificacion.php",
    success: function(data)
    {
   		$("#contenido_identificacion").html(data);
    },
    data: "url=" + url + "&poner_request_uri" + poner_request_uri
	});
}

function abre_popup_identificacion_precargado()
{
	$("#TB_overlay").show();
	$("#identificacion").fadeIn("slow");
	$("embed, object, select").css("visibility","hidden");
}

function abre_popup_Extracto(idDocumento,indice)
{
	if (typeof indice == 'undefined') indice = 'menus';
	
	$( "#popupExtracto" ).dialog( "open" );
	$("#ifframe").css( { "display":""} );
	
	$.ajax({
		beforeSend: function(objeto){
			$("#popupExtracto").html("<span class=\"destacado\">... Cargando ...</span>");
		},
    type: "POST",
    dataType:"json",
    url: "/includes/popup_extracto.php",
    success: function(data)
    {
    	if (data.texto){
   			$("#popupExtracto").html(data.texto);
   		}
    },
    data: "id=" + idDocumento + "&indice=" + indice
	});
}

function set_request_uri(url)
{
	$.ajax({
        type: "POST",
        url: "/includes/ajax_set_request_uri.php",
        data: "url=" + url
	});
}
function valida_gestion_online()
{
	if(validaFormulario(document.forms['formulario']))
	{
		ponvar('accion_post','pedir_documento');
		enviaAccion();
	}
}
function validaFormulario(formulario)
{
	if(verificaCamposComunes(formulario))
	{
		return true;
	}
	else
	{
		return false;
	}
}

function verificaCamposComunes(formulario){
	var obj;
	for(i in formulario)
	{
		switch(i)
		{
			case "si_acepto_las_condiciones_generales":
				obj = formulario.si_acepto_las_condiciones_generales[1];
				if(obj.checked)
				{
					alert("Debe aceptar las condiciones generales");
					return false;
				}
			break;
		}
	}
	//esta función está en el propio formulario
	return verificaCampos(formulario);
}
function campo_obligatorio(campo,nombre)
{
	if(campo.value == "")
	{
		alert("Debe indicar " + nombre);
		return false;
	}
	else
	{
		return true;	
	}
}
function valida_nif(abc)
{
	if(isValidCif(abc.value) || isValidNif(abc.value))
	{
		return true;
	}
	else
	{
		alert("El campo nif/cif no es valido");
		return false;
	}
}
function isValidCif(abc){

    par = 0;
    non = 0;
    letras = "ABCDEFGHKLMNPQS";
    let = abc.charAt(0);

    if (abc.length!=9) {

        //alert('El Cif debe tener 9 dígitos');
        return false;
    }


    if (letras.indexOf(let.toUpperCase())==-1) {

    //alert("El comienzo del Cif no es válido");
    return false;
    }


    for (zz=2;zz<8;zz+=2) {

    par = par+parseInt(abc.charAt(zz));
    }


    for (zz=1;zz<9;zz+=2) {

    nn = 2*parseInt(abc.charAt(zz));
    if (nn > 9) nn = 1+(nn-10);
    non = non+nn;
    }


    parcial = par + non;
    control = (10 - ( parcial % 10));
    if (control==10) control=0;

    if (control!=abc.charAt(8)) {

    //alert("El Cif no es válido");
    return false;
    }

    //alert("El Cif es válido");
    return true;
}

function isValidNif(abc){
    dni=abc.substring(0,abc.length-1);
    let=abc.charAt(abc.length-1);
    if (!isNaN(let)) {

        //alert('Falta la letra');
        return false;
    }else{

        cadena = "TRWAGMYFPDXBNJZSQVHLCKET";
        posicion = dni % 23;
        letra = cadena.substring(posicion,posicion+1);
        if (letra!=let.toUpperCase()){

        //alert("Nif no válido");
        return false;
        }

    }

    //alert("Nif válido")

    return true;
} 
function pre(obj)
{
	for(i in obj)
	{
		str = str + "\n" + i + " : " + obj[i];
	}
	alert(str);
}
function seleccionar_ambito_geografico_on_of()
{
	if($("#ambitos_seleccionados_general").html()=="" || $("#ambitos_seleccionados_general").html()=="&nbsp;")
	{
		$("#seleccionar_ambito_geografico").css({ "background-image" : "url(/plantillas/defecto/imagenes/mapa.png)" });
		$("#radio_seleccionar_ambito_geografico").removeAttr("checked");
	}
	else
	{
		$("#seleccionar_ambito_geografico").css({ "background-image" : "url(/plantillas/defecto/imagenes/mapa2.png)" });
		$("#radio_seleccionar_ambito_geografico").attr("checked", "checked");
	}
}

function seleccionar_hijos(idHijo){
	if ($('#'+idHijo).length){
		$('#'+idHijo+' > div').each(function(){
			var idHijo = this.id;
			if (typeof idHijo != 'undefined'){
				if (idHijo != ''){
					var auxIdHijo = idHijo.split('_');
					var auxIdHijoCheck = 'check_'+auxIdHijo[0]+'_'+auxIdHijo[1]+'_'+auxIdHijo[2]+'_'+auxIdHijo[3];
					
					$('#'+auxIdHijoCheck).click();
				}
			}
		});
	}
}


/*DASHBOARD*/
function anadirWidget(widgetID,opcion){
	if (!opcion){
		opcion = 'add_widget';
	}
	$.ajax({
		beforeSend: function(objeto){
		},
        type: "POST",
        url: "/includes/getWidgetsDashboard.php",
        success: function(data) {
       		//alert(data);
       		location.reload();
        },
       	data: "op="+opcion+"&id="+widgetID+"&zona="+zonaDashboard
	});		
	
}

function borrarWidget(widgetID,opcion){
	if (!opcion){
		opcion = 'delete_widget';
	}	
	$.ajax({
		beforeSend: function(objeto){
		},
        type: "POST",
        url: "/includes/getWidgetsDashboard.php",
        success: function(data) {
       		//alert(data);
       		location.reload();
        },
       	data: "op="+opcion+"&id="+widgetID+"&zona="+zonaDashboard
	});		
	
}

function despliegaDashboard(){
	//$("#contenedorDashboard").css( { "display":""} );
	iniciarDashboard();
}
/*FIN DASHBOARD*/

function detectaHTML5(elemento){
	//return true; 
	//return false;
	
	var elem = document.getElementById(elemento);
	if (elem && elem.getContext) {  
		var contexto = elem.getContext('2d');
		if(contexto){
			return true;
		}
	}	
	return false;
}

/*CPV*/
function devolver_categorias_seleccionadas(checks){
	var totalCheck = '';
	$(checks).each(function(){
		var idCheck = this.id;
		
		var valor = $('#'+idCheck).val();
		totalCheck += valor+'-';
	});
	
	return totalCheck;
}

function anadirCPV(){
	$('#busca-cpv').unbind('keypress');
	$('#busca-cpv').bind('keypress', function(e) {
        if(e.keyCode==13){
          $('#boton_buscar_cpv').click();      
        }
	});
	
	$('#tabla-busca-cpv').html('');
	
	$("#dialog-busqueda-cpv").dialog({
		modal: true,
		draggable: false,
		resizable: false,
		height: 800,
		width: 1000,
		buttons: {
			
		}
	});
	
	
}		

function buscarCpv(){
	var anadir = '';
	var checkeado=$('#solo2niveles').attr("checked");
	if(checkeado) {			
		anadir = '&solo2niveles=1';	
	}
	var categoriasSeleccionadas = devolver_categorias_seleccionadas('.masCategoriasHidden');
	$.ajax({
		beforeSend: function(objeto){
			
		},		
	    url: '/includes/BuscarCPV.php',
	    type: 'POST',
	    success:function(data) {
	    	$('#tabla-busca-cpv').html(data);
	    },
	    data: "texto="+$('#busca-cpv').val()+'&categoriasseleccionadas='+categoriasSeleccionadas+anadir
	});			
}

function GuardarCpvSeleccionados(){
	$('.checkcpv').each(function(){
		var idCheck = this.id;

		var checkeado=$('#'+idCheck).attr("checked");
		if(checkeado) {
			var valor = $('#'+idCheck).val();
			
			var nombre = $('#cpv-nombre-'+valor).html();
			
			var titleCategorias = $('#titleCategorias_'+valor).val();
			
			//var namee = 'campo--concursos_publicos_cpv--'+iteracion+'--cpv';
			
			if ($('#categoriacpv-'+valor).length){
			}else{
				var plantilla = '<div class="masCategoriasCPV" id="categoriacpv-'+valor+'" title="'+titleCategorias+'"><input type="button" name="borraCategoria-'+valor+'" value="Borrar" onclick="$(\'#check_d_h_'+valor+'_1\').click();$(\'#categoriacpv-'+valor+'\').remove();">'+nombre+'<input type="hidden" class="masCategoriasHidden" name="masCategorias[]" id="masCategorias-'+valor+'" value="'+valor+'"></div>';
				  
				$('#bloqueMasCategorias').append(plantilla); 
			}
		}
		
	});
	$('#dialog-busqueda-cpv').dialog( "close" );	
	
}
function seleccionar_hijos_cpv(idHijo){	
	if ($('#'+idHijo).length){
		$('#'+idHijo+' li').each(function(){
			var idHijo = this.id;
			if (typeof idHijo != 'undefined'){
				if (idHijo != ''){
					var auxIdHijo = idHijo.split('--');
					var auxIdHijoCheck = 'checkcpv-'+auxIdHijo[2];
					
					var checkeado=$('#'+auxIdHijoCheck).attr("checked");
					if(checkeado) {
						$('#'+auxIdHijoCheck).attr('checked',false);	
					}else{
						$('#'+auxIdHijoCheck).attr('checked',true);	
					}
				}
			}
		});
	}
}
/*FIN CPV*/

function enviarNiceReply(url){
	var datos = 'enviar=1';
	var aux = '';
	
	var continuar = 1;
	
	if (continuar == 1){
		aux = $('#fnr_nombredespacho').val();
		if (aux != ''){
			datos = datos + '&fnr_nombredespacho='+aux;
		}else{
			continuar = 0;	
		}
	}
	
	if (continuar == 1){
		aux = $('#fnr_comentario').val();
		if (aux != ''){
			datos = datos + '&fnr_comentario='+aux;
		}else{
			continuar = 0;	
		}
	}
	
	if (continuar == 1){
		aux = $("input[@name=fnr_star1]:checked").val();
		if (aux != ''){
			datos = datos + '&fnr_star1='+aux;
		}else{
			continuar = 0;	
		}
	}
	
	if (continuar == 1){
		$.ajax({
	            url: '/includes/nicereply.php',
	            type: "POST",
	            dataType:"json",
	            data: datos,
	            success: function(data) {
					if (data.resultado === true){
						//tenemos que marcar la ventana para que no se muestre mas	
						$("#activa_desactiva_popup_info").attr('checked', true);
						function_activa_desactiva_popup_info();
						$("#popup_info").hide();
						$("embed, object, select").css("visibility","visible");
						
						if (typeof url != 'undefined'){
							document.location.href=url;	
						}
					}else{
						alert('Ha ocurrido un error. Intentelo de nuevo mas tarde.');					
					}
	            }
	    });
	}else{
		alert('Debe cubrir todos los campos');		
	}
	
}

function valoresVarios(op,val)
{
	$.ajax({
        type: "POST",
        url: "/includes/valores_varios_sesion.php",
        success: function(data)
        {
			//vale
        },
       	data: "op=" + op + "&val=" + val
	});
}

function muestraOcultaMenuIzquierdaPracticos(){
	$('#moMenuIzquierda').toggle();
	
	var displayActual = $("#moMenuIzquierda").css("display");
	
	if (displayActual == 'none'){
		valoresVarios('forzarocultarmenuizquierdapracticos','oculto');
	}else{
		valoresVarios('forzarocultarmenuizquierdapracticos','mostrar');
	}	
}
