//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function text_view(mode) 
{
	var link = " ";
    if( mode == "short" ) {	 
		$("#text_page").css( {height: "860px"} );				 		
		link ="<a href=\"\" id=\"text_view_link\" onclick=\"return text_view(\'full\')\">Текст полностью</a>";		 
		window.scrollTo(0, 300);
    }
     else {
			if( mode == "full" ) {
				$("#text_page").css( {height: "100%"} );				
				link ="<a href=\"\" id=\"text_view_link\" onclick=\"return text_view(\'short\')\">Вид по умолчанию</a>";				
		        if($.browser.mozilla) scroll_text_page("prev");
			}	
          }
		  
	$("#text_view_link").replaceWith(link);	  	
	return false;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function scroll_text_page(direction, event)
{
	if(direction == "next") $("#text_page").scrollTo('+=300', 800 );
	 else  if(direction == "prev") $("#text_page").scrollTo('-=300', 800 );	
	
	if(event != undefined) 
	{
	 if (event.preventDefault) event.preventDefault()
	  else event.returnValue= false
	} 
	 
	return false;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function getModalTextBlock(obj, id, zero)  {  
	 
	$("#modal_text_block").load(obj.href, function() { $(document).trigger("ajax_end"); }); 
	$.blockUI({ message: $("#modal_text_block"), 
	    css: { top: "10%", left:"10%", backgroundColor: "#fff", width:"898px", height:"598px", cursor: "default"} });
		
	if(zero) zero_rank_read_text(id); 
	 else rank_read_text(id); 
	
	return false;
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function cancel_view() {
 
	$.unblockUI(); 
	$('#modal_text_block').empty();
 
 }
 //---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function send_text_rank(event, text_id, negative, confirm) {

	$.getScript("?mode=sendtextrank&text_id=" + text_id + (negative ? "&negative=true" : "") + (confirm ? "&confirm=1" : ""));
	
	if (event.preventDefault) event.preventDefault()
	 else event.returnValue= false
	 
	return false
	
}
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

