var $j = jQuery.noConflict();

	function StylethePost(){
	
		var ulpost = $j('#listpostwraper');
		var bgHeight = $j(window).height();
		var bgWidth = $j(window).width();
		var veryTop = $j('#verytop').height();
		var titleHeight = $j('.singletitlewrap').height();
		
		var plusi = veryTop + titleHeight;
		var sisa = bgHeight - plusi;
		var Minsisa = sisa - 400;
		var SisaTo = Minsisa / 2;
		
		ulpost.css("top", SisaTo + titleHeight - 15 + "px").css( "width" , bgWidth + "px").css('overflow', 'hidden');
		$j('#listpaged').css("top", SisaTo + titleHeight + 390 + "px");
		$j('.listpostimage').css( "width" ,"9999px").css('overflow-x', 'auto');
		
	}
	
	function Loadandload(){
	
		$j('.cliker:first').addClass('onview');
		$j('#listpostwraper').scrollLeft(0);
		
		$j('ul.listpostimage>li').each(function(){
			
			var listloader = $j(this);
			
			var listImg = listloader.attr('title');
			
			var luimg = new Image();
			
			$j(luimg).css("opacity", "0.0").css("border", "5px solid #FFFFFF").load( function(){
			
				listloader.append(this).removeAttr('title');
				
				var ght = $j(this).height();
				
				if( ght < 388 || ght == 388 ){
					trHeight = ght;
					if ( ght < 388 ){	
						gin = 400 - ght;
						nMargin = gin / 2;
					} else {
						nMargin = 0;
					}
				} else {
					ght = 388;
					nMargin = 0;
				}
				
				
				
				$j(this).css('height', ght + "px").css('width', 'auto').animate({ marginTop : nMargin + "px"}, 300,
					function(){
						$j(this).animate({ opacity : 1 }, 300);
					}
				);
			
			}).attr('src', listImg);
			
			
			$j(this).hover( function()
			{
				var sp = $j(this).find('.icip');
				
				sp.stop(true, true).animate({ opacity : 1.00}, 300 );
			}, function() {
				var sp = $j(this).find('.icip');
				
				sp.stop(true, true).animate({ opacity : 0.00}, 300 );			
			
			}
			);
			
		});

	}
	
	function nextAnim()
	{

		$j('.cliker').click(function(){
			$j('.onview').removeClass('onview');
			$j(this).addClass('onview');
			
			var tar = $j(this).attr('href');
			
			var target = $j(tar);
			
			$j('#listpostwraper').stop().scrollTo( target , 800 );
			
			return false;
			
		});		
	
	}


$j(document).ready(function(){
	StylethePost();
	Loadandload();
	nextAnim();
});
$j(window).load( function(){
	StylethePost();
	$j('li#desc').fadeIn();
});