function doRate_catsites( rate, id ) {
	ShowLoading('');

	$.get(dle_root + "engine/ajax/catsites/rating_catsites.php", { go_rate: rate, news_id: id, skin: dle_skin }, function(data){

		HideLoading('');

		$("#ratig-layer-" + id).html(data);

	});

};

function MenuCommBuild_l( m_id, modulname, f_id, page ){

var menu=new Array();

menu[0]='<a onclick="ajax_comm_edit_l(\'' + m_id + '\'); return false;" href="#">' + menu_short + '</a>';
menu[1]='<a href="' + dle_root + '?do=catsites_catalog&act=comments&action=comm_edit&id=' + m_id + '">' + menu_full + '</a>';

return menu;
};

function ajax_comm_edit_l( c_id )
{
	if ( ! c_cache[ c_id ] || c_cache[ c_id ] == '' )
	{
		c_cache[ c_id ] = $('#comm-id-'+c_id).html();
	}

	ShowLoading('');

	$.get(dle_root + "engine/ajax/catsites/editcomments_catsites.php", { id: c_id, action: "edit" }, function(data){

		HideLoading('');

		RunAjaxJS('comm-id-'+c_id, data);

		setTimeout(function() {
           $("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $("#comm-id-" + c_id).position().top - 70}, 700);
        }, 100);

	});
	return false;
};

function ajax_save_comm_edit_l( c_id )
{
	var comm_txt = '';
	comm_edit_id = c_id;

	if (dle_wysiwyg == "yes") {

		comm_txt = $('#dleeditcomments'+c_id).html();

	} else {

		comm_txt = $('#dleeditcomments'+c_id).val();

	}

	ShowLoading('');

	$.post(dle_root + "engine/ajax/catsites/editcomments_catsites.php", { id: c_id, comm_txt: comm_txt,action: "save" }, function(data){

		HideLoading('');
		c_cache[ comm_edit_id ] = '';
		$("#comm-id-"+c_id).html(data);

	});
	return false;
};

function doAddComments_catsites(){

	var form = document.getElementById('dle-comments-form');
    
    if (dle_wysiwyg == "yes")
    {
		document.getElementById('comments').value = $('#comments').html();
		var editor_mode = 'wysiwyg';
	}
    else
    {
        var editor_mode = '';
    }

	if (form.comments.value == '' || form.name.value == '')
	{
		DLEalert ( dle_req_field, dle_info );
		return false;
	}

    if ( form.sec_code )
    {
	   var sec_code = form.sec_code.value;
    }
    else
    {
        var sec_code = '';
    }
    
    ShowLoading('');
    
    $.post(dle_root + "engine/ajax/catsites/addcomments.php", { post_id: form.post_id.value, comments: form.comments.value, name: form.name.value, mail: form.mail.value, editor_mode: editor_mode, skin: dle_skin, sec_code: sec_code }, function(data){

		if ( form.sec_code ) {
           form.sec_code.value = '';
           reload();
	    }

		HideLoading('');

		RunAjaxJS('dle-ajax-comments', data);

		if (data != 'error' && document.getElementById('blind-animation')) {

			$("html"+( ! $.browser.opera ? ",body" : "")).animate({scrollTop: $("#dle-ajax-comments").position().top - 70}, 1100);
	
			setTimeout(function() { $('#blind-animation').show('blind',{},1500)}, 1100);
		}

	});
    
};
