function submenu_listing(me, direction){
	var selectionRange=4;//Одновременно показываются 4 пункта подряд.
	var container=$('#photostrip>div[class!=nav]');
	var pos=0;
	//console.info($(container).html());
	//console.info("visible:"+$(visible).html());
	//console.info($('ul',container).html());
	
	var totalItems=$('#photostrip .album_item').length;
	$('#photostrip .album_item').each(function(){
		if($(this).css('display')=='none'){
			pos=pos+1;
			return true;
		}
		//console.info($(this).html());
		return false;
	});
	//console.info('totalItems:'+totalItems);
	//console.info('pos:'+pos);
	
	if (direction && (pos+selectionRange<totalItems)){
		$('#photostrip .album_item:eq('+pos+')').hide();
		$('#photostrip .album_item:eq('+(pos+selectionRange)+')').show();
		pos=pos+1;
	}else if(!direction && pos-1>=0){
		$('#photostrip .album_item:eq('+(pos-1)+')').show();
		$('#photostrip .album_item:eq('+(pos+selectionRange-1)+')').hide();	
		pos=pos-1;
	}
	//console.info('new pos:'+pos);
	if (pos+selectionRange>=totalItems){
		$('#photostrip_table .img_right').addClass('disabled');
		//$('#photostrip .nav .next').addClass('disabled');
	}else{
		$('#photostrip_table .img_right').removeClass('disabled');
		//$('#photostrip .nav .next').removeClass('disabled');
	}
	
	if (pos<=0){
		$('#photostrip_table .img_left').addClass('disabled');
		//$('#photostrip .nav .prev').addClass('disabled');
	}else{
		$('#photostrip_table .img_left').removeClass('disabled');
		//$('#photostrip .nav .prev').removeClass('disabled');
	}	
}


$(window).load(function(){
	/*
	$('#photostrip .nav a').click(function(){
		if ($(this).hasClass('prev')){
			shiftImages('prev');
			return false;
		}else if ($(this).hasClass('next')){
			shiftImages('next');
			return false;
		}
	});
	*/
	
	
});

/*function setCover(uid, thumb, id) 
	{
	$.get("cover.php", {uid:uid, cover:thumb, cover_id:id}, function (data) {alert (data); }); 
	}*/

function getPhotoSelect()
	{
	var aaa = $("#avatar_select").attr("value");
	$("#selected_image").attr("src", "http://i.spark-media.ru/userupload/" +aaa);
	$("#cover").attr("value", "http://i.spark-media.ru/userupload/" +aaa);
	$("#cover_hidden").attr("value", aaa);        
	}

//Это как submenu_listing, вызываемая на странице изменения личных данных

function submenu_listing2(me, direction, is_first){
	var selectionRange=1;//Одновременно показываются 4 пункта подряд.
	var container=$('#photostrip>div[class!=nav]');
	var pos=0;
	var totalItems=$('#photostrip .album_item').length;
	if (is_first)
		{
		pos = -1;
		for (i=0;i<totalItems;i++)
			{
			aaa = $('#photostrip .album_item:eq('+(pos+selectionRange)+')').attr('id');
			$('#photostrip .album_item:eq('+pos+')').hide();
			$('#photostrip .album_item:eq('+(pos+selectionRange)+')').show();
			aaa = $('#photostrip .album_item:eq('+(pos+selectionRange)+')').attr('id');
			bbb = aaa.substring(4, aaa.length)
			if (bbb == $("#cover_hidden").attr("value")) break;
			pos=pos+1;
			}
		pos = pos + 1;
		}


	else
	{
	$('#photostrip .album_item').each(function(){
		if($(this).css('display')=='none'){
			pos=pos+1;
			return true;
		}
		return false;
	});
	if (direction && (pos+selectionRange<totalItems)){
		$('#photostrip .album_item:eq('+pos+')').hide();
		$('#photostrip .album_item:eq('+(pos+selectionRange)+')').show();
		aaa = $('#photostrip .album_item:eq('+(pos+selectionRange)+')').attr('id');
		bbb = aaa.substring(4, aaa.length)
		pos=pos+1;
		}
	else if(!direction && pos-1>=0){
		$('#photostrip .album_item:eq('+(pos-1)+')').show();
		$('#photostrip .album_item:eq('+(pos+selectionRange-1)+')').hide();	
		aaa = $('#photostrip .album_item:eq('+(pos-1)+')').attr('id');
		bbb = aaa.substring(4, aaa.length)
		pos=pos-1;
		}
		
	$("#cover_hidden").attr("value", bbb);
	}	

	if (pos+selectionRange>=totalItems){
		$('#photostrip_table2 .img_right').addClass('disabled');
	}else{
		$('#photostrip_table2 .img_right').removeClass('disabled');
	}
	
	if (pos<=0){
		$('#photostrip_table2 .img_left').addClass('disabled');
	}else{
		$('#photostrip_table2 .img_left').removeClass('disabled');
	}	

}

function warning_ok()
{
$.post("ajax/warning_ok.php", function(data){
	//alert(data);
// if (window.opera) {
//                 document.body.style += '';
//             }
	$("div#div_warning_ok").fadeOut(function(){$("div#div_warning_ok").html(data);});
	
	$("div#div_warning_ok").fadeIn();
	});

}
