$(document).ready(function(){
	$('#highlightGroup.four .highlight:nth-child(4n+1)').css({
		'width':'206px'
	});
	$('#highlightGroup.four .highlight:nth-child(4n)').css({
		'width':'206px',
		'background':'none'
	});
	$('#highlightGroup.three .highlight').css({
		'width':'210px'
	});
	$('#highlightGroup.three .highlight:nth-child(3n+1)').css({
		'width':'208px'
	});
	$('#highlightGroup.three .highlight:nth-child(3n)').css({
		'width':'208px',
		'background':'none'
	});
	$('#content.pages img:not(.right, .left)').css({
			'margin-bottom':'15px'
	});
	$('#content.pages img.left').css({
			'margin':'0 15px 15px 0',
			'float':'left'
	});
	$('#content.pages img.right').css({
			'margin':'0 0 15px 15px',
			'float':'right'
	});
	$('#blocks>div').css({
		'position':'relative',
		'top':'0',
		'left':'0',
		'float':'left',
		'width':'215px',
		'height':'195px',
		'margin':'0 0 20px 20px',
		'padding':'0',
		'overflow':'hidden'
	});
	if ($.browser.msie && $.browser.version.substr(0, 1) <  7) {
		$('#blocks').css({
			'left':'-5px'
		});
		$('#blocks>div').css({
			'margin':'0 0 20px 16px'
		});
	}
	$('#blocks .double').css({
		'width':'450px'
	});
	$('#header').append('<img src="/images/corner_br.png" class="corner br" /><img src="/images/corner_bl.png" class="corner bl" />');
	slideNumber = 0;
	$('#banner div.slide').fadeOut(10);

	function animate(i) {
		if (i < ($('#banner div.slide').length)) {
			$('#banner div.slide').fadeOut(1000);
			$('#banner div.slide:eq('+i+')').fadeIn(1000).fadeTo(4000, 1, function() {
				i++;
				animate(i);													 
			});
		}
		else {
			i = 0;			
			$('#banner div.slide').fadeOut(1000);
			$('#banner div.slide:eq('+i+')').fadeIn(1000).fadeTo(4000, 1, function() {
				i++;
				animate(i);													 
			});
		}
	}
	$('.sub_level_0 ul').each(function() {
		$(this).parent().children('a').after('<span class="menuExpand"><img src="/images/filter_show.png" /></span>');
	})
	$('.sub_level_0:not([class*="here"]) ul').slideUp(250);
	$('[class*="here"]>span').remove();
	$('li.here:not(.sub_level_0)>a').css({
		'background':'#9AA238 none repeat scroll 0 0',
		'color':'#FFFFFF'				 
	});
	$('.menuExpand').click(function(){
		$(this).next('ul').slideToggle(250);
		return false;			
	}).toggle(
		function() {
			$(this).html('<img src="/images/filter_hide.png" />');
		},
		function() {
			$(this).html('<img src="/images/filter_show.png" />');
		}
	);
	if ($('.sub_level_0:not([class*="here"])').length == $('.sub_level_0').length) {
		$('.sub_level_0:eq(0) .menuExpand').trigger('click');
	}
	$('h1.cat + p').css({
		'width':'420px',
		'display':'block',
		'float':'left',
		'margin':'0 20px 10px 0',
		'padding':'29px 0 30px 0',
		'vertical-align':'middle'
	});
	if ($('h1.cat').height() < $('h1.cat + p').height()) {		
		newHeight = $('h1.cat + p').height() - $('h1.cat').height() + 60;
		$('h1.cat').css({
			'padding-top':newHeight / 2,
			'padding-bottom':newHeight / 2
		});
	}
	else {
		newHeight = $('h1.cat').height() - $('h1.cat + p').height() + 60;
		$('h1.cat + p').css({
			'padding-top': newHeight / 2,
			'padding-bottom': newHeight / 2
		});
	}
	$('h1.cat + p').after('<hr style="clear:both;visibility:hidden;" />');
	animate(0);
});