function setCookie(name, value, expires, path, domain, secure)
{
 document.cookie = name + "=" + escape(value) + 
 (expires ? "; expires="+expires.toGMTString() : "") +
 (path    ? "; path="   +path   : "") +
 (domain  ? "; domain=" +domain : "") +
 (secure  ? "; secure" : "");
}
function getCookie(name)
{
 var cookie, offset, end;
 cookie  = " "+document.cookie;
 offset  = cookie.indexOf(" "+name+"=");
 if (offset == -1) return false;
 offset += name.length+2;
 end     = cookie.indexOf(";", offset)
 if (end    == -1) end = cookie.length;
 return unescape(cookie.substring(offset, end));
}
function categoria(id)
{
 if (document.getElementById('t'+id).style.display == 'none')
 {
  var img = 'i'+id;
  $('#'+img).fadeOut('slow', function() {
   $('#'+img).attr('src','imagenes/colapsar.png');
   $('#'+img).fadeIn('fast', function() {
    document.getElementById('t'+id).style.display = 'inherit';
    setCookie(id,'mostrar');
   });
  });
 }
 else
 {
  var img = 'i'+id;
  $('#'+img).fadeOut('slow', function() {
   $('#'+img).attr('src','imagenes/descolapsar.png');
   $('#'+img).fadeIn('fast', function() {
    document.getElementById('t'+id).style.display = 'none';
    setCookie(id,'ocultar');
   });
  });
 }
}
/**
 * Ventana de mensajes privados
 */  
$(document).ready(function () {
   $('#mpsinleer').fadeIn(2500);
   $('#mptitulo').bind('mousedown',function() {
    $('#mptitulo').bind('mousemove', function(event) {
     var izq = event.clientX + document.body.scrollLeft - 100;
     var top = event.clientY + document.body.scrollTop - 30;
     $('#mpsinleer').css('left',izq+'px');
     $('#mpsinleer').css('top',top+'px');
    });
   });
 });
 $(document).ready(function () {
  $('#mptitulo').bind('mouseup',function() {
   $('#mptitulo').unbind('mousemove');
  });
});