/** 	$Id: 18.09.2006 18:45:21 ober $ **/
/* POST CUT FUNCTIONS */

/**
*	Release post cut through ajax
*	@param	post_id	integer		id of post
*	@param	cut		integer		cut num in post
*	@param	_this	integer		release anchor obj
*	
*	@return void
*/
function toggleCut(post_id, cut, _this)
{
	if (!post_id)
	{
		return;
	}
	var elm=document.getElementById( 'post_'+post_id+'_cut_'+cut );
	elm.style.display=elm.style.display ? '' : 'none';
	_this.className = (elm.style.display == 'none' ) ? 'b-closed' : 'b-opened';

	if ('center'==elm.firstChild.nodeName.toLowerCase())
	{
		//alert("ajax\n"+'ajax/blog/post_cut?id='+escape(post_id)+'&cut=\''+escape(cut)+'\'');
		ajaxLoadText(
		{
			url:'/ajax/blog/post_cut',
			args:{
				id:escape(post_id),
				cut:("'"+escape(cut)+"'")
				},
			forse:1,
			onwait:function( req )
			{
				onWaitCalled = true;
			},
			onready:function( text )
			{
				var result = eval( '(' + text + ')' );

				if ( 'success' == result['status'] )
				{
					// success
					//alert(/*eval*/(result['content']));
					elm.innerHTML = result['content'];
				}
				else if ('failure' == result['status'])
				{
					alert(result['error']);
					elm.style.display=elm.style.display ? '' : 'none';
					_this.className = (elm.style.display == 'none' ) ? 'b-closed' : 'b-opened';
				}
			}
		});
	}

}
