$.noConflict();
$(document).ready(function(){
$('.pagination A').corner("3px");
$('#error_login').corner("5px");
$('.bigNewsHref').corner("3px");
$('.selectCommentDisplay').corner("3px");
$('.pagination span').corner("3px");
$('#TextareaBlog .tool').corner("3px");
$('.comment_all .nick_input').corner("5px");
$('.ModDownloadBoxV2 .left').corner("5px");
$('#BottomArticles').corner("5px");
$('.comment_all .comment_form_answer').corner("5px");
$('.comment_all .opcje').corner("5px");
$('.button_BBCode').corner("3px");
$('.blog_Img').corner("3px");
$('.MiddleNewsAll .comment_all .comment_middle').corner("5px");
$('.MiddleNewsAll .comment_all_two .comment_middle_two').corner("5px");
});
shortcut("Ctrl+B",function() {
	insertext("[b]","[/b]","komentarz");
});
shortcut("Ctrl+U",function() {
	insertext("[u]","[/u]","komentarz");
});
shortcut("Ctrl+I",function() {
	insertext("[i]","[/i]","komentarz");
});
function ocen(ncount,mod_id,modul, url){
var add_rating = 'add_rating';
var ncount = ncount;
var mod_id = mod_id;
var modul = modul;
	$.ajax({
		type: "POST",
		url:  '/system/ajax/api.php',
		data: { o: ncount, m: modul, i: mod_id,a: add_rating },
		success: function(msg) {
		alert('idzie'+msg);
		$("unit_ul_"+url).html(msg);
		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
		$("unit_ul_"+url).html("Przepraszamy, wystąpil bląd...");
		}
	});
}
$(document).ready(
function()
{
	$("#addfavourite").click(function () { 
	modul = $("#modul_favourite").val();
	id = $("#id_favourite").val();
	add_favourite = 'add_favourite';
		$.ajax({
			type: "POST",
			url:  '/kA3sads2/system/ajax/api.php',
			data: { id: id, modul: modul, add_favourite: add_favourite },
			success: function(msg) {
			alert(msg);
			},
			error: function (XMLHttpRequest, textStatus, errorThrown) {
			alert("Przepraszamy, wystąpil bląd...");
			}
		});
	});
});
function insertext(open, close, area){
	var msgfield = document.getElementById(area);
	//var msgfield = area;
	if (document.selection && document.selection.createRange){
		msgfield.focus();
		sel = document.selection.createRange();
		sel.text = open + sel.text + close;
		msgfield.focus();
	}
	else if (msgfield.selectionStart || msgfield.selectionStart == "0"){
		var startPos = msgfield.selectionStart;
		var endPos = msgfield.selectionEnd;
		msgfield.value = msgfield.value.substring(0, startPos) + open + msgfield.value.substring(startPos, endPos) + close + msgfield.value.substring(endPos, msgfield.value.length);
		msgfield.selectionStart = msgfield.selectionEnd = endPos + open.length + close.length;
		msgfield.focus();
	}
	else {
		msgfield.value += open + close;
		msgfield.focus();
	}
	return;
}


