	
	function OpenID_Google() {
		var newWin = window.open('/system/php/scripts/googleopenid.php?openid_mode=checkid_setup', "GOOGLEOPENID", "");
		if(newWin) {
			var newWinInterval = setInterval(function() {
				if (newWin.closed) {
					clearInterval(newWinInterval);
					window.location.reload();
				}
			}, 100)
		}
	}
		
	
	function MousePosition(event) {
		// cursor position
		// Internet Explorer & Opera
		if (document.attachEvent != null) { 
			x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
			y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
		}
		// Gecko
		if (!document.attachEvent && document.addEventListener) {
			x = event.clientX + window.scrollX;
			y = event.clientY + window.scrollY;
		}
		return {x:x, y:y};
	}
	
	function rate_document(id, direction) {
		$.getJSON(
 			"/system/php/service.php?_action=rate&_module=rating&document_id=" + id + "&direction=" + direction,
 			function (json) {
 				if(json.result == "success") {
 					
 					var currentRating = $("#document" + id + "rating");
 					if(currentRating.get(0) != undefined) {
 						currentRating.html(json.rating);
 					}
 					
 					djem_alert("Спасибо за ваш голос");
 				} else {
 					djem_alert("Вы не можете дважды давать одну и ту же оценку");
 				}
 			}
 		)
	}
	
	function getCKEditorConfig() {
		return {
			toolbar: [
				['Source', '-', 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', '-', 'Image'],
				['UIColor']
			],
			resize_enabled : false
		}
	}

	$(document).ready(function() {
			
		$('#divContentsBookmark').click(function() {
			$('#divContentsBlock').toggle();
			
			return false;
		});
		
	
	});
