jQuery(function ($) {
	if ( $('#adminbar > div').length > 1 ) {
		$(document.body).append('<style type="text/css" media="screen">.triple li .inner .long { display: block;}.triple li .regionBoundary a { display: inline; height: auto; width: auto; }.triple .regionBoundary li { height: auto; width: auto;}.triple .textElement, #frm .triple .defaultContent { background: #403e3a;}.triple li .inner .long { display: block;}.triple .light .textElement, #frm .triple .light .defaultContent { background: #615c53;}#header .headerMiddle{padding-top:120px;}#header{height:280px;}</style>');
	} else {
		$('.triple li').hover(function () {
				$(this).find('.short').hide();
				
				$(this).find('.inner:not(:animated)').animate({
					height: '375px'
				}, 500, function() { $(this).find('.long').show(); });
			},
			function () {
				$(this).find('.long').hide();
				$(this).find('.short').show();
				$(this).find('.inner').stop(true);
				$(this).find('.inner').css('height', '75px');
		});
		$('.triple li .inner').click(function() {
			window.location = $(this).closest('li').find('a:first').attr('href')
		});
		
		var __slides_idx = 0;
		function change_the_slide() {
			$('.triple li:eq(' + __slides_idx + ')').each(function () {
				var last_img = $(this).find('img:last');
				var callback;
				if (__slides_idx==2) {
					callback = function() { };
				} else {
					callback = function(){ setTimeout( change_the_slide, 1000) };
				}
				
				if (last_img.is(':hidden')) {
					last_img.fadeIn(200, callback);
				} else {
					last_img.fadeOut(200, callback);
				}
				__slides_idx++;
				if (__slides_idx==3) {
					__slides_idx = 0;
				}
			});
		}
		function init_slides () {
			change_the_slide();
			setInterval(function() {
				change_the_slide();
			}, 8000);
		};
		setTimeout(init_slides, 6000);
	}
});
