Cufon.set('fontFamily', 'museo').replace('#nav_left div.menu-header ul li a',{hover: true})('#date p')('#name_day p')('#name_day_tip p')('#search label')('#record h3 a',{hover: true})('#guest h3 a',{hover: true})('#lastaudition h3 a',{hover: true})('.tabs-nav a',{hover: true})('#links li a',{hover: true})('#weather p')('h3')('#special_report h3 a',{hover: true})('#contest h3 a',{hover: true})('h1')('h2.entry-title a',{hover: true})('#author-description h2')('#on_air p')('.user-thumbnail span')('.forecast span')('h2.jaaw-author_name')('h2.program_day');

$(function(){
	$('#loopedSlider1').loopedSlider({autoStart: 9000,slidespeed: 1500});
	$('#loopedSlider2').loopedSlider({autoStart: 9000,slidespeed: 1500});
	$('#loopedSlider3').loopedSlider({autoStart: 9000,slidespeed: 1500});
	$('#loopedSlider4').loopedSlider({autoStart: 9000,slidespeed: 1500});
	$('#loopedSlider5').loopedSlider({autoStart: 9000,slidespeed: 1500});
});

function zIndexWorkaround() {
	// If the browser is IE,
	/*
	 * * For each div with class menu (i.e., * the thing we want to be on top),
	 */
	$(".ie7fix").parents().each(function() {
		var p = $(this);
		var pos = p.css("position");
		// If it&#8217;s positioned,
		if (pos == "relative" || pos == "absolute" || pos == "fixed") {
			/*
			 * * Add the "on-top" class name when the * mouse is hovering over
			 * it, and remove * it when the mouse leaves.
			 */
			p.hover(function() {
				$(this).addClass("on-top");
			}, function() {
				$(this).removeClass("on-top");
			});
		}
	});
}

$(function() {
	$('#tabs').tabs({
		'fxFade': true,
		'fxSpeed': 'fast',
		onClick: function() {
			Cufon.refresh('.tabs-nav a');
		},
		onHide: function() {
			Cufon.refresh('.tabs-nav a');
		},
		onShow: function() {
			Cufon.refresh('.tabs-nav a');
			// 1. sprawdzam który z kolei element jest wybrany
			var coll = $('.tabs-nav li');
			var selected = coll.index($('.tabs-nav li.tabs-selected'));
			// 2. zamieniam wszystkie na widoczne
			$('div.a0').css('display', '');
			$('div.a1').css('display', '');
			$('div.a2').css('display', '');
			$('div.a3').css('display', '');
			$('div.a4').css('display', '');
			// 3. zamieniam wybrany na niewidoczny
			$('div.a' + selected).css('display', 'none');
			if (selected == 4) {
				$('div.a3').css('margin-right', '0');
			} else {
				$('div.a3').css('margin-right', '10px');
			}
			// 4. robie, zeby zakladka byla linkiem
			//$('a.t'+selected).attr('href', 'http://onet.pl');
		}
	});
});

function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	//group.height(tallest);
	if ($.browser.webkit) {
		group.height(tallest+60);
	} else {
		group.height(tallest);
	}
}

$(document).ready(function() {

	zIndexWorkaround();

	$("a.fancy").fancybox({
		'titleShow'		: false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic',
		'padding' : 10
	});

	$("a.guest").fancybox({
		'width'			: 500,
		'height'		: 230,
		'autoScale'		: true,
		'transitionIn'	: 'none',
		'transitionOut'	: 'none',
		'type'			: 'iframe',
		'titleShow'		: false,
		'showNavArrows'	:	true
	});

	equalHeight($(".article_box"));
	//equalHeight($(".height1"));

});
