$(document).ready(function() {
   $('.tresc').corner();
   $('.menuLeft').corner("tl bl");
   $('.menuLeft li').corner();
   $('.links li').corner();
   $('.linksSub li').corner();
   $('.content').hide();   
   $('.galeria').corner();   
   $('.mail').corner(); 
   
   Baner();
   
   Shadowbox.init();
});

function GLS() {
    
    setTimeout(GLS, 8000);
    $('.g').animate({'color': '#ff0000'}, 1000);
    $('.g').delay(3000).animate({'color': '#ffffff'}, 1000);
    
    $('.l').delay(1000).animate({'color': '#ff0000'}, 1000);
    $('.l').delay(2000).animate({'color': '#ffffff'}, 1000);
    
    $('.s').delay(2000).animate({'color': '#ff0000'}, 1000);
    $('.s').delay(1000).animate({'color': '#ffffff'}, 1000);
   
}

function Baner() {
   
    setTimeout(Baner, 13000);
    $('.informacja').fadeIn(2000);
    $('.uslugi_med').delay(6000).fadeIn(2000);
     
    $('.informacja').delay(2000).fadeOut(2000);
    $('.uslugi_med').delay(2000).fadeOut(2000);
}

function Ukryj() {     
    $('.content').hide();
    $('.content').fadeIn(1000);
}

function aktualnoscShow(arg) {
    $('.aktualnosc_tresc').hide();
    $('.aktualnosc_1').hide();
    $('.aktualnosc_2').hide();
    $('.aktualnosc_3').hide();
    
    $('.'+arg).show();
    $('.aktualnosc_tresc').fadeIn(1000);
    
    /*
    var maxHeighta = 0;
        $(".aktualnosciContent").each(function() {       
            if($(this).height() > maxHeighta) {
                maxHeighta = $(this).height();;
            }
        }); 
        //alert(maxHeighta);
        var pad = maxHeighta/2-70;
        $(".navi_left").css('paddingTop', pad);
        $(".navi_right").css('paddingTop', pad);
    */
}

function walidacja_mail(form)
{
    if(form.email.value==""||!(/^[0-9a-zA-Z._]+\@[0-9a-zA-Z-]+\.[0-9a-zA-Z.]+$/.test(form.email.value))){ 
	alert("Podaj poprawny mail (np: xx@xx.com)!");
            form.email.focus();
	return (false);
    }
	
    if (form.temat.value == "")
    {
        alert("Podaj temat!");
            form.temat.focus();
        return (false);
    }	
  
  return (true);
}

function zmienPowrot(plik) {
   $("#powrot").attr("src", plik);
}

function wysokoscElementow() {
    $('.content').fadeIn(1000);
        
        $('.tresc tbody tr').css(
            {'background-color': '#ffffff', 'color': '#000000'}
        );

        $('.tresc tbody tr:even').css(
            {'background-color': '#dddddd', 'color': '#000000'}
        );
    
        var maxHeightBox = 0;
        $(".boxContent").each(function() {  
            if($(this).height() > maxHeightBox) {
                maxHeightBox = $(this).height();                
            }
        }); 
        $(".boxContent").each(function() {
            $(".boxContent").height(maxHeightBox);
        });
    
        var maxHeight = 0;
        $(".tresc").each(function() {       
            if($(this).height() > maxHeight) {
                maxHeight = $(this).height();
            }
        });               
        
        var maxHeightMenu = 0;
        $(".menuLeft").each(function() {       
            if($(this).height() > maxHeightMenu) {
                maxHeightMenu = $(this).height();
            }
        });  
        
        if (maxHeight>maxHeightMenu) {
            var heightContent = $(".tresc").height()-5;
            
            $(".boxContent").height(maxHeight);               
            $(".menuLeft").height(heightContent);               
        }
        
        else {
            var heightContent = $(".menuLeft").height();
            
            $(".tresc").height(heightContent);               
            $(".menuLeft").height(maxHeightMenu);
        }
}

function logos(ile) {
        
    $(".logoBox").each(function() {       
            $(this).hide();
      });  
    
    pokazLogo(ile,0)
}

function pokazLogo(ile,ktory) {          
    
    if (ktory == 0) ktory = 1;
    else ktory = ktory+1;
    
    if (ktory>ile) ktory=1;
    setTimeout(function(){ pokazLogo(ile,ktory); },6000);
    $("#logo_"+ktory).fadeIn(2000).delay(2000).fadeOut(2000);
    
}


