function setbookmark( id, topic, user ) {

   new Ajax.Request('/data/xaja/x_forum_bookmark.php?userid='+user+'&topic_id='+topic+'&category_id='+id, {
   onSuccess: function(transport) {
   }
   });

}
function rate( id, topic, user ) {

   new Ajax.Request('/data/xaja/x_topic_rate.php?userid='+user+'&topic_id='+topic+'&rating='+id,{
   onSuccess: function(transport) {
      alert('Deine Bewertung wurde gespeichert. Die Gesamtwertung wird erst angezeigt, wenn mindestens 10 Mitglieder dieses Thema bewertet haben.');
   }
   });


   return false;
}

function overstar( id ) {

   for (var i = 1; i <= 5; i++) {

      $( 'star'+i ).src = '/images/cms/star2.gif';
   }

   for (var i = 1; i <= id; i++) {

      $( 'star'+i ).src = '/images/cms/star1.gif';
   }
}
function outstar() {
   for (var i = 1; i <= 5; i++) {

      $( 'star'+i ).src = '/images/cms/star2.gif';
   }

}

function report_close( thread, page, post )
{
   var g;

   g = prompt( 'Bitte beschreibe kurz, was zu getan hast:' );

   self.location.href='/forum/t/'+thread+','+page+'?report_close='+post+'&thread='+thread+'&bg='+g;
}






function sendFormByAjax( form )
{
   form.request( { encoding: 'utf-8' } );

   return false;

}

function requestByAjax( url )
{

   new Ajax.Request(url,
      {
      method: 'get',
      onSuccess: function(response) { return true; }
      }
   );

   return false;

}



function _saveForumTags()
{

   var tags = document.getElementById( 'input_forum_tags' ).value;
   var topic_id = document.getElementById( 'input_topic_id' ).value;

   XAJA_loadContent( "/data/xaja/forum_setTags.php?topic_id="+topic_id+"&tags="+tags, "" );

   forum_updateTags( topic_id );

   PU_close();

}



function forum_showAttachment( att_id )
{
   PU_init();

//   XAJA_loadContent( "/data/xaja/forum_PU_attachment.php?att_id="+att_id, "helper" );

     
   var pars = 'att_id=' + att_id;

   var myAjax = new Ajax.Updater("helper", '/data/xaja/forum_PU_attachment.php', {method: 'get', parameters: pars});


//   PU_resizeByImg()

   PU_resize( 600, 570 );
}

function forum_showImage( path )
{
   PU_init();

//   XAJA_loadContent( "/data/xaja/forum_PU_attachment.php?att_id="+att_id, "helper" );

     
   var pars = 'path=' + path;

   var myAjax = new Ajax.Updater("helper", '/data/xaja/PU_image.php', {method: 'get', parameters: pars});


//   PU_resizeByImg()

   PU_resize( 600, 570 );
}


function PU_resizeByImg() {

  if ($('img').complete) {

   PU_resize( $('img').width + 31, $('img').height + 50);

  } else window.setTimeout('PU_resizeByImg()',250); 

}



function forum_thank( post_id ) {

   XAJA_loadContent( '/data/xaja/forum_thank.php?post_id='+post_id , "");

   forum_updateThanks( post_id );

}

function forum_report( topic_id, post_id )
{

   PU_init( 520, 200 );

   XAJA_loadContent( "/data/xaja/forum_PU_report.php?topic_id="+topic_id+"&post_id="+post_id, "helper", "load1.gif" );

}

function forum_saveReport()
{
   var post_id = document.getElementById( 'input_post_id' ).value;
   var topic_id = document.getElementById( 'input_topic_id' ).value;
   var message = document.getElementById( 'input_message' ).value;


   XAJA_loadContent( "/data/xaja/forum_saveReport.php?topic_id="+topic_id+"&post_id="+post_id+"&message="+message, "helper", "load1.gif" );

   PU_close();

   alert('Deine Beschwerde wurde gespeichert und an einen Moderator weitergeleitet.');


}


function _saveForumTags2()
{

   var tags = document.getElementById( 'input_forum_tags' ).value;
   var topic_id = document.getElementById( 'input_topic_id' ).value;

   XAJA_loadContent( "/data/xaja/forum_setTags.php?topic_id="+topic_id+"&tags="+tags, "" );   

   forum_updateTags( topic_id );
   
   PU_close();

}

function forum_removeTag( tag_id )
{
   XAJA_loadContent( "/data/xaja/forum_removeTag.php?tag_id="+tag_id, "" );
}

function forum_updateTags( topic_id )
{
   XAJA_loadContent( "/data/content/forum/inc/xaja_getTags.php?topic_id="+topic_id, "forum_tags", "saving.gif" );
}

function forum_removeThank( thank_id )
{
   XAJA_loadContent( "/data/xaja/forum/xaja_removeThank.php?thank_id="+thank_id, "" );
}


function forum_updateThanks( post_id )
{
   XAJA_loadContent( "/data/xaja/forum/xaja_getThanks.php?post_id="+post_id, "forum_thanks_"+post_id, "saving.gif" );
}

function forum_PU_setTags( topic_id )
{


   PU_init( 400, 150 );

   XAJA_loadContent( "/data/xaja/forum_PU_setTags.php?t="+topic_id, "helper" );


}


function forum_quote( post_id )
{

   var text = getSection( 'post_'+post_id );

   if( text == "" )
   {

      alert( "Markiere den Text, den du zitieren möchtest. Zitiere bitte NICHT ganze Beiträge!" );

      return false;
   }


   return text;

}
