
 $(document).ready(function()
 {
  $("#zdarzenie_przypomnij").click(function()
     {
       $("div#przypomnij_kal").toggle();   
     });   
     $("#zdarzenie_dokumentyteczka").click(function()
     {
       $("div#dokumentyteczkapole").toggle();  
     }); 
     $("#dodaj").click(function()
     {
       $("div#innenotatki").toggle(); 
       $("div#fullnotatkatresc").toggle();    
     });      
     $(".fg").click(function()
       { 
          $('#szukaj_form li').removeClass("activszukaj"); 
           $(this).parent().addClass("activszukaj"); 
            var typ = $(this).attr("name");   
            
            switch  (typ){
            
             case "dokszukaj":
                 $('#typszukaj').val(1);
               break;
      
              case "kalszukaj":
                  $('#typszukaj').val(2);
               break;
               
           case "podszukaj":
                $('#typszukaj').val(3);
               break;
                    
            }
       }
       );

       $(".mt").click(function()
       { 
          $('#teczka_tab li').removeClass("activteczkatab"); 
           $(this).parent().addClass("activteczkatab");    
           var typ =  $(this).attr("name"); 
        
            name="#"+typ;  
            $(".tabs_teczka").css("display", "none");
            
            $(name).show();  

             zak=1;
             switch (typ){
             
             case 'td':
                 zak=1;
             break;
              
              case 'ap':
               zak=2;
              break;
              
              case 'ak':
              zak=3;
              break;            
            }
 
            $('#zakl').val(zak);

            if (typ=='oe' || typ=='tt'){
              $("#teczka_submit").css("display", "none");
            }else{
              $("#teczka_submit").css("display", "");
            }
   
       }
       );

         $(" .atoogle").click(function(){
 
            var name=$(this).attr('name'); 
            
            
            
            $("#"+name).toggle();     
            
            
              return false;
            } 
          );

      $("div.tabn_rts a").click(function()
        {
          $("div.tabn_rts").removeClass("tabn_active");   
          $(" .tabn_rts").removeClass("tabn_active");   
          $(this).parent().addClass("tabn_active"); 
           
           /*  $(this).removeClass("noactiv"); */ 
           var typ = $(this).attr("name");
           refreshteczka(typ);        
           
           $(this).parent().removeClass("noactiv");  
           return false;
           });
            
});


    function zwin(id){ 
       nametootle="div#toogle_"+id;
      $(nametootle).hide();
       nametootle="div#dok_results_"+id;
      $(nametootle).toggle();     
   } 


 function valueOnClick(obj,text)
 {
 if (obj.value==text) obj.value='';
 }

 function valueOnBlur(obj,text)
 {
if (obj.value.length == 0) obj.value=text;
 } 

    function rozwin3(obj,name){ 
       if ($(name).is(':hidden')){
     
         $(name).show('slow');
         $(obj).html('zwiń  &uarr;&uarr;');
       }else{
        $(obj).html('rozwiń &darr;&darr;');
        $(name).hide('slow');
       } 
    }
    
     function rozwin(obj,name){ 
       if ($(name).is(':hidden')){
     
         $(name).show('slow');
         $(obj).html('zwiń');
       }else{
        $(obj).html('czytaj wszystkie');
        $(name).hide('slow');
       } 
    }
    

        function rozwin2(obj,name){ 
       if ($(name).is(':hidden')){
     
         $(name).show('slow');
         $(obj).children().attr("src", '/images/zwin.png');

       }else{

        $(obj).children().attr("src", '/images/pokaz_wszystkie.png');
        $(name).hide('slow');
       } 
    }
    
    
   
   
   function changeThis(obj){
    if(!obj.tmpvalue){
        obj.tmpvalue=obj.value;
    }
    if(obj.value==obj.tmpvalue){
        obj.value="";
    }
}
function changeThisBack(obj){
     if(obj.value==""){
        obj.value=obj.tmpvalue;
    }
} 
    
function togglejs(name){
$("#"+name).toggle();
}
    
function rectimefull(secs) {
	var hr = Math.floor(secs / 3600);
	var min = Math.floor((secs - (hr * 3600))/60);
	var sec = secs - (hr * 3600) - (min * 60);
	if (hr < 10) {hr = "0" + hr; }
	if (min < 10) {min = "0" + min;}
	if (sec < 10) {sec = "0" + sec;}
	if (hr) {hr = "00";}
	return hr + ':' + min + ':' + sec;
}


function rectime(secs) {
	var min = Math.floor(secs/60);
	var sec = secs - (min * 60);
	if (min < 10) {min = "0" + min;}
	if (sec < 10) {sec = "0" + sec;}
	return min + ':' + sec;
}



function pokazJumpingBox() {
            var top = ($(window).height() - $('#jumpingBoxContener').outerHeight()) / 2;
            var left = ($(window).width() - $('#jumpingBoxContener').outerWidth()) / 2;
            $('#jumpingBoxContener').css({position:'absolute', margin:0, top: (top > 0 ? top : 0)+'px', left: (left > 0 ? left : 0)+'px'});
            $("#jquery-overlay").show();
            $("#jumpingBoxContener").show();
 }
       

function zamknijJumpingBox() {
           $("#jquery-overlay").hide();
           $("#jumpingBoxContener").hide();
}

    
    
    
    
    
    
    
    
    
