function toogle(id) {
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'inline';
		document.getElementById('txt-'+id).innerHTML = 'cerrar';
		document.getElementById('txt-'+id).className = "toogle_up";
	} else {
		document.getElementById(id).style.display = 'none';
		document.getElementById('txt-'+id).innerHTML = 'abrir';
		document.getElementById('txt-'+id).className = "toogle";
	}
}

function toogle_text(id,txt_open, txt_close) {
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'inline';
		document.getElementById('txt-'+id).innerHTML = txt_close;
		document.getElementById('txt-'+id).className = "toogle_up";
	} else {
		document.getElementById(id).style.display = 'none';
		document.getElementById('txt-'+id).innerHTML = txt_open;
		document.getElementById('txt-'+id).className = "toogle";
	}
}

function simple_toogle(id) {
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'inline';
	} else {
		document.getElementById(id).style.display = 'none';
	}
}

function toogle2(id) {
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'inline';
		document.getElementById('txt-'+id).innerHTML = 'cerrar';
		document.getElementById('txt-'+id).style.backgroundImage = 'url(/media/icons/black_arrow_up.gif)';
	} else {
		document.getElementById(id).style.display = 'none';
		document.getElementById('txt-'+id).innerHTML = 'abrir';
		document.getElementById('txt-'+id).style.backgroundImage = 'url(/media/icons/black_arrow_down.gif)';
	}
}

function toogle_with_params(id,txt,bg) {
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'inline';
		document.getElementById('txt-'+id).innerHTML = txt[1];
		document.getElementById('txt-'+id).style.backgroundImage = 'url(/media/icons/' + bg[1] +')';
	} else {
		document.getElementById(id).style.display = 'none';
		document.getElementById('txt-'+id).innerHTML = txt[0];
		document.getElementById('txt-'+id).style.backgroundImage = 'url(/media/icons/' + bg[0] +')';
	}
}
function toogle_tram(id) {
	if(document.getElementById("tram_"+id).style.display == 'none') {
		document.getElementById("tram_"+id).style.display = 'inline';
		document.getElementById(id).style.backgroundImage = 'url(/media/icons/menos_gris.gif)';
	} else {
		document.getElementById("tram_"+id).style.display = 'none';
		document.getElementById(id).style.backgroundImage = 'url(/media/icons/mas_gris.gif)';
	}
}

function toogle3(id) {
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'inline';
		document.getElementById('txt-'+id).innerHTML = 'cerrar';
		document.getElementById('txt-'+id).style.backgroundImage = 'url(/media/icons/black_arrow_up.gif)';
	} else {
		document.getElementById(id).style.display = 'none';
		document.getElementById('txt-'+id).innerHTML = 'mostrar';
		document.getElementById('txt-'+id).style.backgroundImage = 'url(/media/icons/black_arrow_down.gif)';
	}
}

function ver_pop(ventana){
		var ww = window.screen.width;
		var wh = window.screen.height;
		var nww = 820;
		var nwh = 600;
        var posL = (ww/2) - (nww/2);
		var posR = (wh/2) - (nwh/2);
		window.open(ventana,'','width=820, height=600, resizable=no, scrollbars=yes, status=no, left=' + posL +',top=' + posR +" ' " );
}

jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
	return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);  
};

function mostrar_inf(id_link, id_contenido){
	jQuery("#"+id_contenido).slideFadeToggle('slow');
	
	var info = jQuery("#"+id_link);
	var info_aux = info.text();
	
	if (info_aux == "Leer -"){
		info_aux = "Leer +"
	}else{
		info_aux = "Leer -"
	}
	
	info.html(info_aux);
}
