$(document).ready(function(){
  //  alert("Привет!");
  $("a[rel='foto']").colorbox();
  LoadLastUpdatePages(3);
  LoadLastComments(3);
  $("#RandomPage").load("inc/ajax.php?act=randompage");
});

// загрузка Последних обновлённых страниц
function LoadLastUpdatePages(i)
{
  $("#LastUpdatePages").load("inc/ajax.php?act=lastpages&lid="+i);
}

// загрузка последних коментариев
function LoadLastComments(i)
{
  $("#LastComments").load("inc/ajax.php?act=lastcomments&lid="+i);
}

/* СКРИПТЫ ДЛЯ КОММЕНТАРИЕВ */
function ShowCommentForm(ID)
{
  $("div.addcomfor").css("display","none");
  $("#addcomfor_"+ID).css("display","block");
}

function SubmitComment(ID)
{
  $("div.addcomfor").css("display","none");
}

document.onkeydown = NavigateThrough;

function NavigateThrough (event)
{
	if (!document.getElementById) return;
	if (window.event) event = window.event;
	if (event.ctrlKey)
	{
		var link = null;
		var href = null;
		switch (event.keyCode ? event.keyCode : event.which ? event.which : null)
		{
			case 0x25:
				link = document.getElementById ('NextLink');
				break;
			case 0x27:
				link = document.getElementById ('PrevLink');
				break;
			case 0x26:
				link = document.getElementById ('UpLink');
				break;
			case 0x28:
				link = document.getElementById ('DownLink');
				break;
			case 0x24:
				href = '/';
				break;
		}
		if (link && link.href) document.location = link.href;
		if (href) document.location = href;
	}
}

function admAllowComments()
{

}

function admPublicate(classpath, tid, lid)
{
//  $("#adm_c_"+id+" .pub a").load("inc/ajax.php?act=pub&tid=4&lid="+id);
  $(classpath).load("inc/ajax.php?act=pub&tid="+tid+"&lid="+lid);
 //load("inc/ajax.php", function(data){ alert("Привет!"+data)});*/
}

function admDelete(classpath, tid, lid)
{
  var r=confirm("Удалить?");
  if (r==true)
  {
    $(classpath).load("inc/ajax.php?act=del&tid="+tid+"&lid="+lid);
//    alert("You pressed OK!")
  }
}

function downCounter(filename)
{
  $.get("inc/ajax.php?act=dc&fname="+filename);
}

