    function CargarFavorito(valor){    
    var variable_post= valor;
    $.post("http://music-strike.net/Partesweb/favoritos.php", { dato: variable_post }, function(data){
    $("#favoritos").html(data);
    });   
    }

function abrirForm(div, idcoment, idmuro, nickmuro, idadic){
document.getElementById(div).innerHTML="<form action='nuevocomentario.php?modo=respuesta' method='post' id='respuesta"+idadic+"' name='respuesta"+idadic+"'><input type='hidden' name='idcoment' value='"+idcoment+"'><input type='hidden' name='idmuro' value='"+idmuro+"'><input type='hidden' name='numeroreplay' value='replay"+idadic+"'><input type='hidden' name='nickmuro' value='"+nickmuro+"'><table width='100%'><tr><td valign='middle'><textarea name='replay"+idadic+"' id='replay"+idadic+"' style='resize: none; height: 14px; line-height: 13px; width: 80%;' placeholder='Escribe un comentario...' onkeyup=\"checkearTecla(event,'respuesta"+idadic+"')\" autocomplete='off' offblur='focus();'></textarea></td></tr></table></form>";
	$().ready(function(){
		$("textarea").autoResize();
	});
document.getElementById(div).focus();
var t = "replay"+idadic;
ponerFoco(t);
}
function ponerFoco(t){

var seleccion = document.getElementById(t);
seleccion.focus();
}
function checkearTecla(e, res)
{
	if(e.keyCode == 13)
		document.getElementById(res).submit();
	return true;
}

function abrir(url,anchura,altura,scroll)
{
var centrado = (screen.width/0)-(altura/0);
window.open(url, "", "scrollbars="+scroll+",left="+centrado+",top=10,width="+anchura+",height="+altura);
}
function abrir2(url,anchura,altura,scroll)
{
var centrado = (screen.width/2)-(altura/2);
window.open(url, "", "scrollbars="+scroll+",left="+centrado+",top=10,width="+anchura+",height="+altura);
}



(function($){
	$.fn.extend({
		autoResize: function(options){
			//Si no se envÃ­a nada, se crea un objeto vacÃ­o para que no de error a continuaciÃ³n
			if(!options){
				options = {};
			}
			//Almacena las opciones pasadas a la funciÃ³n o valores predeterminados en su defecto
			var _options = {
				//Maximo en altura que podrÃ¡ alcanzar, luego se aplicarÃ¡ scrollbar
				maxHeight: options.maxHeight || null,
				//Altura que tomarÃ¡ al coger el foco
				minHeight: options.minHeight || null,
				//Texto que se mostrarÃ¡ cuando esta vaci­o y sin foco
				textHold: options.textHold || null,
				//Clase que se aÃ±adirÃ¡ cuando recibe el foco
				activeClass: options.activeClass || null
			};
			this.each(function(){
				//Encapsulamos con jQuery
				var $this = $(this);
				//Establece el texto por defecto si ha sido establecido
				if($this.val() == "" && _options.textHold){
					$this.val(_options.textHold);
				}
				//Guarda la altura inicial
				$this.initHeight = $this.css("height");
				//Establece el atributo CSS overflow segun el caso
				if(_options.maxHeight){
					$this.css("overflow", "auto");
				}else{
					$this.css("overflow", "hidden");
				}
				//Para guardar el texto y comparar si hay cambios
				var _value = null;
				//Crea el clon del textarea
				var $clon = $this.clone(true);
				//Establece propiedades del clon y lo aÃ±ade al DOM
				$clon.css({
					visibility: "hidden",
					position: "absolute",
					top: 0,
					overflow: "hidden",
					width: parseInt($this.width())-10
				});
				$clon.attr("name","");
				$clon.attr("id", "");
				$this.parent().append($clon);
				//Aux
				var clon = $clon[0];
				var me = $this;
				//Eventos del textarea
				$this.bind("keyup" , autoFit)
					.bind("focus", function(){
						if(_options.textHold){
							if(this.value == _options.textHold){
								this.value = "";
							}
						}
						if(_options.minHeight){
							me.css("height", _options.minHeight+"px");
							$clon.css("height", _options.minHeight+"px");
							autoFit(true);
						}
						if(_options.activeClass){
							me.addClass(_options.activeClass);
						}
					})
					.bind("blur", function(){
						if(_options.textHold){
							if(this.value == ""){
								this.value = _options.textHold;
								if(_options.minHeight && me.initHeight){
									$clon.css("height", me.initHeight);
									me.css("height", me.initHeight);
									autoFit();
								}
							}
						}else{
							if(_options.minHeight && me.initHeight){
								$clon.css("height", me.initHeight);
								me.css("height", me.initHeight);
								autoFit();
							}
						}
						if(_options.activeClass){
							me.removeClass(_options.activeClass);
						}
					});
				function autoFit(force){
				    	clon.value = me.val();
				    	//Comprueba si ha cambiado el valor del textarea
				    	if (_value != clon.value || force===true){
					    _value = clon.value;
					    var h = clon.scrollHeight;
					    if(_options.maxHeight && h > _options.maxHeight){
						me.css("height", _options.maxHeight + "px");
					    }else{
					    	me.css("height", parseInt(h) + "px");
					    }
						
				    	}
				}
				autoFit();
			});
		}
	})  
}(jQuery));
