$(function()
{
	if ($('#divHomePageOtherNews').length)
	{
		var slideHomePageOtherNews = function(direct)
		{
			$slideObject = $('#divHomePageOtherNewsCenter');
			var $offset = 210;
			var $idx = $slideObject.data('current');
			var $count = $slideObject.data('total');
			
			if ($count == null)
			{
				$count = $(".Content",$slideObject).length;
				$slideObject.data('total',$count);
			}
			
			if (!$idx) $idx = 0;
			
			if (direct == 'left')
			{
				if ($idx >= $count - 3)
				{
					return;
				}
				
				$idx++;
			}
			else
			{
				if ($idx == 0)
				{
					return;
				}
				
				$idx--;
			}
			
			$slideObject.data('current',$idx);
			
			
			$slideObject.animate({left: (direct == 'left' ? '-=220' : '+=220')},'normal');
		}
		
		$('#slideNewsLeft').click(function() {slideHomePageOtherNews('right');});
		$('#slideNewsRight').click(function() {slideHomePageOtherNews('left');});
	}
});

// hack footer div
$(window).bind("load",function()
{
	$('.autocenter').each(function(k,v)
	{
		var p = ($(v).parent().height() - $(v).height()) / 2;
		
		$(v).parent().css('position','relative');
		
		$(v).css({
			position: 'absolute',
			display: 'block',
		});
		
		$(v).css('top',(($(v).parent().height() - $(v).height()) / 2) + 'px');
	});
	
	if ($("#divDetailBottom").length)
	{		
		$('#divDetail').css('height',($('#tdMiddleRight').height() + $("#divDetailBottom").height()) + 'px');
		$('#divDetailBottom').css('top',($('#divDetail').height() - $("#divDetailBottom").height() - 15) + 'px').show();
	}
	
});