function search_check(form) {
	var f = document.forms.namedItem(form);
	try {
		var since = (f.since_0.value || f.since_1.value || f.since_2.value);
		var till = (f.till_0.value || f.till_1.value || f.till_2.value);
	}
	catch(err) {
		var since = "0";
		var till = "0";
	}
	
	if(f.q.value == 'Wpisz szukaną frazę...')
	{
		alert('Wpisz szukaną frazę w polu wyszukiwarki.');
		return false;
	}
	
	if(f.q.value.length<=3 && (since=="0" && till=="0"))
	{
		alert('Wyszukiwana fraza musi być dłuższa niż 3 znaki.');
		return false;
	}
	return true;
}
	
function switcher_switch(story_id){
    $(".bigstory").css("display",'none');
    $(story_id).css("display",'block');
}
function SS(element,story_id){
    $(element).addClass("active").siblings(".active").removeClass("active");
    $(".bigstory").css("display",'none');
    $(story_id).css("display",'block');
}
/*
function changepicture(pictureID){	
	if(window.mainFlash) window.document["mainFlash"].SetVariable("pictureID", pictureID);
	if(document.mainFlash) document.mainFlash.SetVariable("pictureID", pictureID);
}
*/
function show_photo(photo_id){
	$("img.big-photo").css("display","none");
	$("#photo_"+photo_id).css("display",'block');
}
$(document).ready(function(){
$("#menu li.parent>a").mouseover(function() {
    $("#menu").attr('class',$(this).parent().attr('id'));
});
$('#voting_form :radio.star').rating({
    callback: function(value, link){
        $("div.last").removeClass("last");
        $(".measure-mark em").html(value);
        $("div.star_on:last").addClass("last");
    }
});
	setTimeout(function(){$("#messages_alert").hide("slow");}, 3000);
})


// tabele


function stripeTable(t) {
	var odd = true;
	for (var i=0; i<t.rows.length; i++) {
		t.rows[i].className += odd ? ' odd' : ' even';
		odd = !odd;
	}
}

function make_it() {

	var a1 = document.getElementById('artykul');
	var a2 = document.getElementById('text');
	var a3 = document.getElementById('main-bar');

	if ((a1) || (a2) || (a3)) {
		var d = document.getElementsByTagName('table');
		for (var i=0; i<d.length; i++) {
			if (d[i].className=='') {
				stripeTable(d[i]);
			}
		}
	}
}
$(document).ready(function() {
	make_it();
	$('a.lightbox').lightBox();
});

function show_eska_player_song(song_id, div_id){      
    songs = $('*[name='+ div_id + ']');
    for (i=0; i<songs.length; i++){
        if (i == song_id){
            songs[i].style.display = "block";
        } else {
            songs[i].style.display = "none";
        }
    }
}
function podajIdKomentarza(id) {
	form_div = $('#abuse_comment_id');
	form_div.val(id);
}

function switchForm(id)
{
	form_div = $('#abuse_form')
	if (form_div.css('display') == 'none')
	{
		form_div.show()
	}
	else
	{
		form_div.hide()
	}
	return false;
}
function ST(elem, tabid){
    $(elem).addClass("current").siblings(".current").removeClass("current");
	$(tabid).addClass("show").siblings(".show").removeClass("show");
}

function ST_NEW(elem, tabid, cla, wraper){
	$(wraper).attr('class', 'new-box ' + cla);
	$(tabid).addClass("show").siblings(".show").removeClass("show");
}

function changepicture(img, title, headline, url){
 if(title){
     var flashMovie=getFlashMovieObject("mainFlash");
     flashMovie.SetVariable("Publish", 'False');
     flashMovie.SetVariable("Image", img);
     flashMovie.SetVariable("Title", title);
     flashMovie.SetVariable("Headline", headline);
     flashMovie.SetVariable("URL", url);
     flashMovie.SetVariable("Publish", 'True');
 }
 return false;
}

function getFlashMovieObject(movieName)
{
 if (window.document[movieName])
 {
 return window.document[movieName];
 }
 if (navigator.appName.indexOf("Microsoft Internet")==-1)
 {
 if (document.embeds && document.embeds[movieName])
 return document.embeds[movieName];
 }
 else
 {
 return document.getElementById(movieName);
 }
}
function left_intro_ST(name){
	$('#left-intro-new').attr('className',name);
	$("#left-intro-new.current_news #t-news div.story_preview-right:first").click();
	$("#left-intro-new.current_plotki #t-plotki div.story_preview-right:first").click();
	$("#left-intro-new.current_wydarzenia #t-wydarzenia div.story_preview-right:first").click();
	$("#left-intro-new.current_sport #t-sport div.story_preview-right:first").click();
	$("#left-intro-new.current_porady #t-porady div.story_preview-right:first").click();
	return false;
}
function setActive(){
    //$("#left-intro div.show li a:first").click();
	return false;
}
var switchIntervalId = 0;

$(document).ready(function(){
	$(".main .tabs ul li a").click(setActive);
	$("#left-intro-new div.show li a:first").click();
	var total_length = 5;
	var counter = 0;
    var slide_array = ["#tn-news", "#tn-plotki", "#tn-wydarzenia", "#tn-sport", "#tn-porady"]
	function auto_slide(){
		$(slide_array[counter]).click();
		counter = (counter + 1) % total_length;
	}
	switchIntervalId = setInterval(auto_slide,6000);
	
    $("#eska-slide2").slideVertical({ elementWidth: 52, lastElementWidth: 20, numberOfVisibleElements: 3 });
//   $('div.ads > div:empty').parent().css("display","none");
    setTimeout(function(){ $("#sky").css("top",$("#intro").offset().top); },1000);
})

function repair_ads() {
        bloki = $('.ads div div');
        for(i=0; i < bloki.length;i++) {
        	jest_reklama = false;
            for(j=0; j < bloki[i].childNodes.length; j++) {
            	if (bloki[i].childNodes[j].tagName && bloki[i].childNodes[j].tagName != 'SCRIPT' && bloki[i].childNodes[j].tagName != '!') {
                	jest_reklama = true;
                	break;
                }
            }
            if (jest_reklama) {
            	bloki[i].style.padding = "11px 0px";
            }
        }
}

function LI_ST(){
	var elem = $(this);
	if(elem.length){
		$("div.story_preview").hide();
		var item_id = elem.attr("id");
		$(item_id.replace('goto_','#')).fadeIn("slow");
	}
	return false;
}

a = '';
function swap_gallery_image(id){
	$("#main-big img").addClass("hide");
    $('#main-big #im_'+id).removeClass("hide");
	$('#photo-big-slider .mask ul li a').removeClass("active");
	$('#photo-big-slider .mask ul li #li_'+id).addClass("active");
	$("div.photos_desc p").css("display","none");
	$("div.photos_desc #photo_desc_"+id).css("display","block");
}

$(document).ready(function() {$('div[id^=bmone2t-]').css({'padding-bottom': '10px', 'padding-top': '10px'})});