// JavaScript Document
  function ax_przypomnijhaslo(){
 em = $('#mailto').val();
 msg = $('#status_msg');
 
 if(em==''){
      msg.html('Podaj email.');
 }
 else{
    $.ajax({
      type: "POST",
      url: "ax_przypomnijhaslo.php",
      data:({
					'mail':em         			
			}),
      success: function(info){
       if(info=='ok'){
         $('#active_bg').fadeOut('fast',function(){
          $('#accept_mode_password').fadeIn('slow');
        });
       }      
       else{                      
        msg.html(info);
        }
       } 
  });  
 }
}

     function ax_zaglosuj_sonda(id,title,scores){
      $('#preloader').fadeIn('slow');
     em = id;
     t = title;
     em1 = $('#sonda_id').val();
     msg = $('#status_msg1');
     if(!scores) scores = false;
     
     if(em==''){
          msg.html('Musisz wybrać jedną odpowiedź.');
          $('#preloader').fadeOut('slow');
     }
     else{
        $.ajax({
          type: "POST",
          url: "ax_zaglosuj_sonda.php",
          data:({
    					'id':em, 
    					'title':t, 
    					'scores':scores, 
              'sonda_id':em1       			
    			}),
          success: function(info){
             
           if(info=='cookie_error')
           {
           $('#sonda_question').fadeOut('fast',function(){
              $('#sonda_right_denied').fadeIn('slow');
            });
            $('#preloader').fadeOut('slow');
           }
           else if(info=='vote_error')
           {
           $('#vote_error').fadeIn('fast',function(){
             $('#vote_error').html('Aby zagłosować należy wybrać jedną z pozycji sondy!');
             $('#preloader').fadeOut('slow');
             });
           }
           else{
              $('#sonda_question').fadeOut('fast',function(){
               $('#sonda_right_accept').fadeIn('slow');
             });
             $('#sonda_content').html(info);
             $('#preloader').fadeOut('slow');
           }    
          // else{                      
          //  msg.html(info);
          // }
           } 
      });  
     }
    }
  
      function tooltips(s) {
      (s != "") ? d = "block" : d = "block";
      if (s!="")
      {
      document.getElementById("tip").style.display = d;
      document.getElementById("tip").innerHTML = s;
      }
      else
      {
      s = "Trwa ładowanie danych...";
      document.getElementById("tip").innerHTML = s;
      }
      } 


    
    
    $(document).ready(function(){    
      $(".btn-slide").click(function(){
    		$("#panel").slideToggle("fast");
    		$(this).toggleClass("active"); return false;
    	});
    
      $("#btn-slide-reminder").click(function(){
    		$("#password-reminder").slideToggle("fast");
    		$(this).toggleClass("active"); return false;
    	});
    	
    	$("#btn-slide-right").click(function(){
    		$("#right_log").slideToggle("fast");
    		$(this).toggleClass("active"); return false;
    	});	
      
      $(".btn-slide-wzor").click(function(){
    		$("#send_wzor").slideToggle("fast");
    		$(this).toggleClass("active"); return false;
    	});
       
    });
    

      function button(ob, act, nr)
      {
       ob.src = 'img/read_'+nr+'_'+act+'.png';
      }
      
       function button_right(ob, act, nr) 
      {
       ob.src = 'img/button_right_'+nr+'_'+act+'.png';
      }
 	
   function showmenu(pId) 
   {
		if (!pId) return false;
		var i = 1;
		while (el = document.getElementById('menu_' + i)) {
			i == pId ? el.className='m_'+i+'_a' : el.className='m_'+i+'_i';
			i++;
			}
	 }
	 
 function changeborder(name, id) {
 var boxphoto = document.getElementById(name+'_'+id); 
 var i=1;
 while (el = document.getElementById(name+'_'+i)) { 
 var box = document.getElementById(name+'_'+i);
 if(i==id){
  box.style.border='1px solid #e00000';
 }
 else
 {
  box.style.border='';
 }
  i++; 
 }	
 }
 

