

  function mapa(numer,idk) {
    
    
  if( $('#koment_'+numer).css('display') != 'none' ) {$('#koment_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#ocen_'+numer).css('display') != 'none' ) {$('#ocen_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#rezerw_'+numer).css('display') != 'none' ) {$('#rezerw_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#medics_'+numer).css('display') != 'none' ) {$('#medics_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#map_'+numer).css('display') == 'none' ) { 
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=mapax&id=' + numer +'&foto='+ idk ,
  success:function(data){
$('#map_'+numer).slideToggle("slow");
  $('#map_'+numer).html(data);
  }
  });
  }else{
$('#map_'+numer).slideToggle("slow");
  }
  
  }





  function oceny(numer,idk) {
  if( $('#map_'+numer).css('display') != 'none' ) {$('#map_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#ocen_'+numer).css('display') != 'none' ) {$('#ocen_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#rezerw_'+numer).css('display') != 'none' ) {$('#rezerw_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#medics_'+numer).css('display') != 'none' ) {$('#medics_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#koment_'+numer).css('display') == 'none' ) {
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=ocenyx&id=' + numer +'&foto='+ idk ,
  success:function(data){
$('#koment_'+numer).slideToggle("slow");
  $('#koment_'+numer).html(data);
  }
  });
  }else{
$('#koment_'+numer).slideToggle("slow");
  }
  }


  function ocena(numer,idk) {
  if( $('#map_'+numer).css('display') != 'none' ) {$('#map_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#koment_'+numer).css('display') != 'none' ) {$('#koment_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#rezerw_'+numer).css('display') != 'none' ) {$('#rezerw_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#medics_'+numer).css('display') != 'none' ) {$('#medics_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#ocen_'+numer).css('display') == 'none' ) {
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=ocenax&ledit=' + numer +'&foto='+ idk ,
  success:function(data){
$('#ocen_'+numer).slideToggle("slow");
  $('#ocen_'+numer).html(data);
  }
  });
  }else{
    $('#ocen_'+numer).slideToggle("slow");
    
  }
  }
  
  
    function lekarze(numer,idk) {
  if( $('#map_'+numer).css('display') != 'none' ) {$('#map_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#koment_'+numer).css('display') != 'none' ) {$('#koment_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#rezerw_'+numer).css('display') != 'none' ) {$('#rezerw_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#ocen_'+numer).css('display') != 'none' ) {$('#rezerw_'+numer).hide("slide", { direction: "up" }, 100);}
   
 $('#medics_'+numer).slideToggle("slow");

    
  }
  
  
  
    function rezerwacja(numer,idk) {
  if( $('#map_'+numer).css('display') != 'none' ) {$('#map_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#koment_'+numer).css('display') != 'none' ) {$('#koment_'+numer).hide("slide", { direction: "up" }, 100);}
  //if( $('#medics_'+numer).css('display') != 'none' ) {$('#rezerw_'+numer).hide("slide", { direction: "up" }, 100);}
  if( $('#ocen_'+numer).css('display') == 'none' ) {
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=rezerwacja&ledit=' + numer +'&foto='+ idk ,
  success:function(data){
$('#rezerw_'+numer).slideToggle("slow");
  $('#rezerw_'+numer).html(data);
  }
  });
  }else{
    $('#rezerw_'+numer).slideToggle("slow");
    
  }
  }
  
   function recepcja(numer,idk) {
     

  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=newrez&id=' + numer +'&data='+ idk ,
  success:function(data){

  $('#rezerwac_'+numer).html(data);

  }
  });
   }
   
   
      function zarezerwuj(numer,kiedy) {
	
	
	
	
	
	
var imie = $("input#imie").val(); 
var nazwisko = $("input#nazwisko").val();  	
var idpacjenta = $("input#idpacjenta").val();  	
var imie_z = $("input#imie_z").val();  	
var gatunek = $("select#gatunek").val(); 
var wizyta = $("select#wizyta").val(); 
var opis = $("textarea#opis").val(); 
var telefon = $("input#telefon").val(); 
var email = $("input#email").val(); 
var validate = $("input#validate").val(); 
	
var wtac=0;

if(!imie){$('#imie').addClass('input_err'); var wtac=1;}
if(!nazwisko){$('#nazwisko').addClass('input_err'); var wtac=1;}
if(!imie_z){$('#imie_z').addClass('input_err');  var wtac=1;}
if(!telefon){$('#telefon').addClass('input_err');  var wtac=1;}
if(!email){$('#email').addClass('input_err');  var wtac=1;}
if(!validate){$('#validate').addClass('input_err');  var wtac=1;}

if(wtac==0){

var dataString = 'imie='+ imie + '&nazwisko=' + nazwisko + '&idpacjenta=' + idpacjenta +'&imie_z=' + imie_z +'&gatunek=' + gatunek +'&wizyta=' + wizyta +'&opis=' + opis +'&telefon=' + telefon +'&email=' + email +'&validate=' + validate;  

	$.ajax({
  type: 'POST',
   url: 'ajax.php?mod=weterynarz&action=newrez&id=' + numer +'&data='+ kiedy+'&posted=1',
  data: dataString,
  success:function(data){


    
  $('#rezerwac_'+numer).html(data);
  
  
  

  }
});
	
      }else{
	
	$('#infoblock').css('display', 'block');
$('#blockinfo').css('backgroundColor', 'red');
      }
	
	
	
      }
   
   


  function specjalizacje(numer,idk) {
  if( $('#specl_'+numer).css('display') == 'none' ) {
  $('#specl_'+numer).slideToggle("slow");
  }else{
  $('#specl_'+numer).slideToggle("slow");
  }
  }

  function nieglosuj(numer,idk) {
$('#det_'+numer).slideToggle("slow");
  }
  	
	
  function nowa_ocena(numer,idk,wet) {
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=nowa_ocena&ocena='+ numer +'&pytanie='+ idk+'&wet='+ wet ,
  success:function(data){
  $('#glosowano_' +wet+'_'+idk).html(data)
  document.form_a.ocen.value=((document.form_a.ocen.value*1)+1)
  document.form_a.ocena.value=((document.form_a.ocena.value*1)+numer)
  }
  });
  }	
  	
  		
  function zapisz_ocene(numer,idk) {
  var ocen = $("input#ocen").val();  
  var ocena = $("input#ocena").val();  
  var wet = $("input#wet").val();   
  var dataString = 'ocen='+ ocen + '&ocena=' + ocena + '&wet=' + wet;  

  $.ajax({
  type: "POST",  
  url: 'ajax.php?mod=weterynarz&action=nowa_ocena&wet='+ numer ,
  data: dataString,  
  success:function(data){
  $('#ocen_'+numer).html(data)
  }
  });
  }
  	
  	
  	
  function resetuj_ocene(numer, idk){
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=ocenax&ledit=' + numer +'&foto='+ idk ,
  success:function(data){
  $('#ocen_'+numer).html(data)
  }
  });
  }
  	
  	
  	
  function mapam(numer) {
    
    
    //alert("mapam");
    
  if($('#mapka').css('display') == 'none' ) {
$('#mapka').slideToggle("slow");
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=mapam&ledit=' + numer ,
  success:function(data){
  $('#mapka').html(data)
  }
  });
  }else{
    
    $('#mapka').slideToggle("slow");
    
  
  }
  }



  function zapal(numer, idk){
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=akcje&id=' + numer+'&usl='+ idk,
  success:function(data){
  $('#lsd_div_'+numer).html(data)
  }
  });

  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=count&id=' + numer+'&usl='+ idk,
  success:function(data){
  $('#lsd_count').html(data)
  }
  });
  }



  function notes(numer) {
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=notes&id=' + numer,
  success:function(data){
  $('#not_'+numer).html(data)
  }
  });
  }



/* checker*/

function checkrequest(which){
var pass=true

if (document.request.nazwisko.value ==""){
document.request.nazwisko.style.backgroundColor="yellow";
return false
}

if (document.request.ulica.value ==""){
document.request.ulica.style.backgroundColor="yellow";
return false
}

if (document.request.kod.value ==""){
document.request.kod.style.backgroundColor="yellow";
return false
}

if (document.request.miasto.value ==""){
document.request.miasto.style.backgroundColor="yellow";
return false
}


if (document.request.wojew.value ==""){
document.request.wojew.style.backgroundColor="yellow";
return false
}

if (document.request.telefon.value ==""){
document.request.telefon.style.backgroundColor="yellow";
return false
}

if (document.request.email.value ==""){
document.request.email.style.backgroundColor="yellow";
return false
}

if (document.request.nip.value ==""){
document.request.nip.style.backgroundColor="yellow";
return false
}


return true
}


  function pre_search(numer,woj,powiat,cotam,gdzie){
    
$('#remo').html('<img src="themes/default/images/loader.gif" alt="Wait" />');
    




    
  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=presearch&city=' + numer+'&cotam='+ cotam+'&woj='+ woj+'&finder=1&powiat='+powiat,
  success:function(data){
  $('#center_block').html(data)
  }
  });
  
  
  if(gdzie!="adv"){
  $('#'+gdzie).html('<img src="themes/default/images/ajax-loader.gif" alt="Wait" />');

}
  
  
  }
  
  
 
function showsearch(inID) {
  
  
if (document.getElementById(inID).style.display == 'none') {
$('#'+inID).slideToggle("slow");

  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=open&cotam=opon',

  });

  
$("#opens").addClass("awansa"); 
$("#opens").removeClass("awans");   
  
  

} else {
$('#'+inID).slideToggle("slow");

  $.ajax({
  url: 'ajax.php?mod=weterynarz&action=open&cotam=opof',

  });
  
$("#opens").addClass("awans"); 
$("#opens").removeClass("awansa");   
}



}

function loadmkt(wet){
  
    $.ajax({
url: 'ajax.php?mod=weterynarz&action=load_mark&type=1&id=' + wet,
  success:function(data){
    $('#lomark_'+wet).html(data);
    
    
    $('#lomark_'+wet).animate({ backgroundColor: "green " }, 100);
    $('#lomark_'+wet).animate({ backgroundColor: "#FF9" }, 500);
    
    
     }
  });
  
  
  

  
  
}		
	

	
	function savemsg(wet){

 
 
 
 
   
  var data = $("input#datamk_"+wet).val(); 
var godzina = $("input#godzinamk_"+wet).val();  	
 var touser = $("select#touser_"+wet).val();  
  var uwagiu = $('textarea#uwagiu_' + wet).val();  
 
 




var dataString = 'data='+ data + '&godzina=' + godzina+ '&touser=' + touser+ '&uwagiu=' + uwagiu;  




	$.ajax({
  type: 'POST',
   url: 'ajax.php?mod=weterynarz&action=add&type=3&id='+wet,
  data: dataString,
  success:function(data){
    
  $('#uwagiu_' + wet).animate({ backgroundColor: "white" }, 100);
  $('#uwagiu_' + wet).animate({ backgroundColor: "yellow" }, 100);

  $('#uwagiu_' + wet).animate({ backgroundColor: "green " }, 50);
	 $('#uwagiu_' + wet).val('');   
  $('#uwagiu_' + wet).animate({ backgroundColor: "green " }, 50);

  $('#uwagiu_' + wet).animate({ backgroundColor: "yellow" }, 100);
  $('#uwagiu_' + wet).animate({ backgroundColor: "white" }, 100);
    


  var info="wiadomość wysłana :)";
  $('#infopan_' + wet).html(info);
  
//$('#msgcnt').html(data); 	   
	   

  
  
      $.ajax({
url: 'ajax.php?mod=weterynarz&action=load_mark&type=1&id=' + wet,
  success:function(data){
    $('#lomark_'+wet).html(data);
    
    
    $('#lomark_'+wet).animate({ backgroundColor: "green " }, 100);
    $('#lomark_'+wet).animate({ backgroundColor: "#FF9" }, 500);
    
    
     }
  });
  

  }
});
 

 
 
  
}
