Cufon.replace('.sidebar_header, h2, .read_more, .lnk, .box_header, h4', {
    hover: true
});

jQuery(document).ready(function() {
	$('#menu li')
	.mouseover(function(){$(this).addClass('jshover');})
	.mouseover(function(){$(this).removeClass('jshover');})


	if(!$.browser.msie)
	{
		$('.box_1_image .rotate').load(function(){
			var W = 165, H = 115, w = $(this).width(), h = $(this).height();
			if(w/h > (W/H))
			{
				$(this).css({width: W, top: parseInt((H-W*h/w)/2)+16,left: -4});
			}
			else
			{
				$(this).css({height: H,top: 19, left: parseInt((W-H*w/h)/2)-7});
			}
		});
	}
	else
	{
		$('.box_1_image img.rotate').load(function(){
			var W = 165, H = 115, w = $(this).width(), h = $(this).height();
			if(w/h > (W/H))
			{
				$('span',this.parentNode).css({width: W, top: parseInt((H-W*h/w)/2)+12,left: -10});
			}
			else
			{
				$('span',this.parentNode).css({height: H,top: 10, left: parseInt((W-H*w/h)/2)-10});
			}
		});
		$('.box_1_image .r2').css({left: -15,top:5});
		$('.box_1_image .r1').css({left: -8,top:10});
	}
	$('.box_1_image .r1 span').css('border','1px solid red');
	$('.box_1_image .rotate1, .box_1_image .rotate, .box_1_image .rotate2').rotate(350);

	$('.pages').each(function(){
		var numA = parseInt($('a.active',this).html()),
			numL = parseInt($('a:last',this).html()),
			numP = Math.ceil(numL/pagesNumber),
			numB = Math.ceil(numA/pagesNumber);

		$('span:first',this).click(function(){
			var num = Math.ceil(parseInt($('.pages a:visible').html())/pagesNumber);
			if(num > 1) list(num-1);
		});

		$('span:last',this).click(function(){
			var num = Math.ceil(parseInt($('.pages a:visible').html())/pagesNumber);
			if(num < numP) list(num+1);
		});

		function list(num)
		{
			$('.pages a').each(function(){
				var numA = parseInt($(this).html())
				if(numA > (num-1)*pagesNumber && numA <= num*pagesNumber)
				{
					$(this).show();
				}
				else
				{
					$(this).hide();
				}
			})
		}
		list(numB);

		$(this).show();
	});
	
	
});

