$(document).ready(
	function() 
	{
		// Динамическая навигация в шапке
		
		//$('#header_nav .area .menu:nth-child(2)').css({backgroundPosition:'-143px -80px'});
		//$('#header_nav .area .menu:nth-child(3)').css({backgroundPosition:'-282px -80px'});
		//$('#header_nav .area .menu:nth-child(4)').css({backgroundPosition:'-422px -80px'});
		//$('#header_nav .area .menu:nth-child(5)').css({backgroundPosition:'-561px -80px'});
		
		//$('#header_nav .menu div div div ul').slideUp('slow');
		//$('#header_nav .menu').hover(
		//	function()
		//	{
		//		$('ul', this).slideDown('slow');
		//	},
		//	function()
		//	{
		//		$('ul', this).slideUp('slow');
		//	}
		//);
		

		$('a').click(function(){
			
			var url = $(this).parent().parent().children('div.begun_adv_contact').children('span.begun_adv_contact').children('a').text();
			if(url){
				var name = $(this).parent().parent().children('div.begun_adv_title').children('a').html();
				var text = $(this).parent().parent().children('div.begun_adv_text').children('a').html();
				var from = document.URL;
				
				$.ajax({
				      url: "/clickstat.php",
				      type: "POST",
				      data: (
				      	{url : url, name : name, text : text, from : from}
				      )
				});
			}

			//return false;
		});
		
		$('.forum a.savepost').click(
			function()
			{
				var text = $(this).parent().children('div').html();
				var test = $.ajax({
				url : '/forum/?edit=1&pid='+$(this).parent().children('div').attr('pid'),
				type: "POST",
				data : 'text='+text,
				cache: false,
				success: function(msg){
					alert( "Data Saved " );
					}
				});
				return false;
			}
		);
		
		/*
		// Скрыть/показать комментарии
		
		$('.comments .collapse a').toggle(
			function()
			{
				$(this).parent().children('span').html('+');
				$(this).html('Показать комментарии');
				$(this).parent().parent().children('.list').slideToggle('slow');
			},
			function()
			{
				$(this).parent().children('span').html('-');
				$(this).html('Скрыть комментарии');
				$(this).parent().parent().children('.list').slideToggle('slow');
			}
		);



		// Скрыть/показать длинный комментарий
		
		$('.comments .fullview a').toggle(
			function(){
				$(this).parent().children('span').html('-');
				$(this).html('Скрыть комментарий');
				$(this).parent().parent().children('.full').slideToggle('slow');
				$(this).parent().parent().children('.short').slideToggle();
			},
			function(){
				$(this).parent().children('span').html('+');
				$(this).html('Прочитать полностью');
				$(this).parent().parent().children('.full').slideToggle('slow');
				$(this).parent().parent().children('.short').slideToggle();
			}
		);

		// Скрыть/показать форму добавления комментариев
		
		$('.comments .add_comment form').css({display:'none'});
		$('.comments .add_comment p.add a').toggle(
			function()
			{
				$(this).parent().children('span').html('-');
				$(this).parent().parent().children('form').slideToggle('slow');
			},
			function()
			{
				$(this).parent().children('span').html('+');
				$(this).parent().parent().children('form').slideToggle('slow');
			}
		);
		
		// Скрыть/показать добавление альбома
		
		$('.add_album form').css({display:'none'});
		$('.add_album p.head a').toggle(
			function()
			{
				$(this).addClass('nobg');
				$(this).parent().parent().children('form').slideToggle('slow');
			},
			function()
			{
				$(this).removeClass('nobg');
				$(this).parent().parent().children('form').slideToggle('slow');
			}
		);
		
		// Скрыть/показать добавление фотграфий
		
		$('.add_photo form').css({display:'none'});
		$('.add_photo p.head a').toggle(
			function()
			{
				$(this).addClass('nobg');
				$(this).parent().parent().children('form').slideToggle('slow');
			},
			function()
			{
				$(this).removeClass('nobg');
				$(this).parent().parent().children('form').slideToggle('slow');
			}
		);

		
		// Подсветить при наведении блок бегуна
		$('div.begun span').mouseover(function(){
			$(this).css({'background-color':'#f2f2f2'});
		});
		$('div.begun span').mouseout(function(){
			$(this).css({'background-color':'transparent'});
		});
		*/
	}
);