
/* Листалка для телегида */
function slide_item(id) {
	
	$('#'+id+' .item:first').addClass('selected');

	//Next Slide by calling the function
	$('#'+id+' .btn-next').click(function () {
		newsslider(0);	
		return false;
	});	

	//Previous slide by passing prev=1
	$('#'+id+' .btn-prev').click(function () {
		newsslider(1);	
		return false;
	});	
	
	function newsslider(prev) {

		//Get the current selected item (with selected class), if none was found, get the first item
		var current_image = $('#'+id+' .selected').length ? $('#'+id+' .selected') : $('#'+id+' .item:first');
		//if prev is set to 1 (previous item)
		if (prev) {
			//Get previous sibling
			var next_image = (current_image.prev().length) ? current_image.prev() : $('#'+id+' .item:last');
		//if prev is set to 0 (next item)
		} else {
			//Get next sibling
			var next_image = (current_image.next().length) ? current_image.next() : $('#'+id+' .item:first');
		}
	
		//clear the selected class
		$('#'+id+' .item').removeClass('selected');
		
		//reassign the selected class to current items
		next_image.addClass('selected');
	
		$('#'+id+' .item').hide();
		$('#'+id+' .selected').fadeIn();	
	
	} 
}

/* Время для ТВ-программы */
function tv_time() {
		var months=new Array(13);
		months[1]="января";
		months[2]="февраля";
		months[3]="марта";
		months[4]="апреля";
		months[5]="мая";
		months[6]="июня";
		months[7]="июля";
		months[8]="августа";
		months[9]="сентября";
		months[10]="октября";
		months[11]="ноября";
		months[12]="декабря";
		var time=new Date();
		var lmonth=months[time.getMonth() + 1];
		var date=time.getDate();
		var year=time.getYear();
		var hours=time.getHours();
		var minutes=time.getMinutes();
		if (eval(hours) <10) {hours="0"+hours}
		if (eval(minutes) < 10) {minutes="0"+minutes}
		$('#tv_time').html(date + " " +lmonth + " " + hours + "<img src='/i/time.gif' alt='' />" + minutes + " ");
		
		setTimeout('tv_time()',1000) 
}

$(document).ready(function(){
    $('.top_nav_li').hover(
    	function() {
    		$('.top_nav_li_ul').stop(true, true).hide();
    		$('.top_nav_li_a').removeClass('top_nav_li_a');
            $(this).addClass('top_nav_li_a').find('ul').stop(true, true).show();
        },
        function() {
        	$('.top_nav_li_a').removeClass('top_nav_li_a');
        	$('.top_nav_li_ul').stop(true, true).hide();
            $('#menu_now').addClass('top_nav_li_a');
            $('#menu_now .top_nav_li_ul').stop(true, true).show();
        }
    );
    var pic_num=1;
    $('.choose_header_img li a').each(function() {
        $(this).addClass('pic_num_'+pic_num);
        pic_num=pic_num+1;
    });

});
