function toggleCookie( i )
{
  if( $( i ).style.display == 'none' )
    CookieWrite('ProfilCommentsHide','0' );
  else
    CookieWrite('ProfilCommentsHide','1' );

  $( i ).toggle();

}

function commentUpdate( e )
{
  var numLeft = 300 - e.value.length;

  if( numLeft <= 0 ) {
    e.value = e.value.substr( 0, 300 );
    numLeft = 300 - e.value.length;
  }

  if( numLeft < 15 )
    $('commentStatus').innerHTML = ' ' + numLeft + ' Zeichen verbleibend.';
  else
    $('commentStatus').innerHTML = '';


}

function commentDelete( ID )
{
  var url = '/_ajax/commentDelete.php?ID='+ID;

  new Ajax.Request( url, {
    method: 'get',
    onSuccess: function( t ) { $('comment'+ID).hide(); }
  });

}

function commentAdd( Region, ID, Text )
{

  var url = '/_ajax/commentAdd.php?Region='+Region+'&ID='+ID+'&Text='+encodeURIComponent( Text );

  new Ajax.Request( url, {
    method: 'get',
    onSuccess: function( t ) { window.location.reload(); }
  });

}

