$(document).ready(function(){
  $(".showsubmenu").hover(function(){
    $(this).children(".submenu").css('display','block');
  },function(){
    $(this).children(".submenu").css('display','none');
  })
})

var displayed=0;

function badanie(){
  $("#right_logo_image").css('top','-300px');
  if (displayed==0){
    displayed=1;
  var background=$("<div>").css('position','absolute').css('zIndex','10000').css('opacity','0.7').css('left','50%').css('backgroundColor','white').css('top','50%').corner();
  $("body").append(background);
  background.animate({'width':'5px','height':'5px'},400,function(){
    background.animate({'height':'100%','top':'0'},400,function(){
      background.animate({'width':'100%','left':'0'},400,function(){
          var front=$("<div>").css('position','absolute').css('border','1px solid #CCC').css('zIndex','10001').css('left','50%').css('backgroundColor','white').css('top','50%').corner();
            $("body").append(front);
            front.animate({'width':'5px','height':'5px'},400,function(){
              front.animate({'height':'98%','top':'1%'},400,function(){
                front.animate({'width':'1000px','marginLeft':'-500px'},400,function(){

                  //początek zamykania okna

                  front.append($("<img>").attr('src',$("#baseUrl").text()+'/public/images/x.png').css('float','right').css('width','30px').css('height','30px').css('cursor','pointer').click(function(){

                    front.html('');
                      front.animate({'width':'5px','marginLeft':'0'},400,function(){
                        front.animate({'height':'5px','marginTop':'0'},400,function(){
                          front.fadeOut('fast',function(){
                            $("#right_logo_image").css('top','0px');
                            $(this).remove();
                          })
                          background.animate({'width':'5px','left':'50%'},400,function(){
                            background.animate({'height':'5px','top':'50%'},400,function(){
                              background.fadeOut('fast',function(){
                                $(this).remove();
                                displayed=0;
                              })
                            })
                          })
                        })
                      });
                    
                  }));

                  //koniec zamykania okna

                  var p=$("<p>").css("textAlign",'center').css('margin','0').css('padding','0');
                  front.append($("<a>").css('backgroundImage','url('+$("#baseUrl").text()+'/public/images/DrukujPasek.png)').text("Drukuj").css('float','left').css('color','white').css('height','20px').css('paddingLeft','10px').css('paddingRight','10px').css('fontWeight','bold').css('margin','5px').corner().css('paddingTop','3px').attr('href',$("#baseUrl").text()+'/public/files/test_amslera.pdf').css("textDecoration",'none').hover(function(){$(this).css('textDecoration','underline')},function(){$(this).css('textDecoration','none')}));
                  front.append(p);
                  p.append($("<img>").attr('src',$("#baseUrl").text()+"/public/images/amsler.png").css('height','85%'))
                  p.append($("<h3>").text('JEŚLI LINIE, KTÓRE WIDZISZ SĄ ZNIEKSZTAŁCONE LUB JEŚLI BRAKUJE FRAGMENTU SIATKI, KONIECZNIE ZGŁOŚ SIĘ DO LEKARZA OKULISTY!').css('color','#0061C2'))
                });
              });
            });
      });
    });
  });
  }
}

$(document).ready(function(){
  $("#medium").click(function(){
    $("#textcontent").children('p').css('font-size','18px');
    $("#textcontent").children('div').children('p').css('font-size','18px');
    $("#textcontent").children('h2').css('font-size','20px');
    $("#text").children('h1').css('font-size','22px');
    $("#textcontent").children('table').children('tbody').children('tr').children('td').children('table').children('tbody').children('tr').children('td').css('font-size','18px');
    $("#textcontent").children('h3').css('font-size','19px');
    $("#textcontent").children('div').children('h3').css('font-size','19px');
    $("#textcontent").children('ul').children('li').css('font-size','18px');
  })

  $("#small").click(function(){
    $("#textcontent").children('p').css('font-size','13px');
    $("#textcontent").children('div').children('p').css('font-size','13px');
    $("#text").children('h1').css('font-size','19px');
    $("#textcontent").children('table').children('tbody').children('tr').children('td').children('table').children('tbody').children('tr').children('td').css('font-size','13px');
    $("#textcontent").children('h2').css('font-size','17px');
    $("#textcontent").children('h3').css('font-size','15px');
    $("#textcontent").children('div').children('h3').css('font-size','15px');
    $("#textcontent").children('ul').children('li').css('font-size','13px');
  })


  $("#large").click(function(){
    $("#textcontent").children('p').css('font-size','24px');
    $("#textcontent").children('div').children('p').css('font-size','24px');
    $("#text").children('h1').css('font-size','30px');
    $("#textcontent").children('table').children('tbody').children('tr').children('td').children('table').children('tbody').children('tr').children('td').css('font-size','26px');
    $("#textcontent").children('h2').css('font-size','28px');
    $("#textcontent").children('h3').css('font-size','26px');
    $("#textcontent").children('div').children('h3').css('font-size','26px');
    $("#textcontent").children('ul').children('li').css('font-size','24px');
  })

  var imgwidth=0;

  $(".produktyimage").hover(function(){
    imgwidth=parseInt($(this).css('width').replace('px',''));
    $(this).stop().animate({'width':parseInt(imgwidth)+5+'px'},200)
  },function(){
    $(this).stop().animate({'width':parseInt(imgwidth)+'px'},200)
  })

  var zoomin=0;

  $("#zoom").click(function(){
    if (zoomin==0){
    zoomin=1;
    var holder=$("<div>").css("position","absolute").css('padding','5px').css('border','1px solid #CCC').css('top','450px').corner().css('left','50%').css('zIndex','400').css('backgroundColor','white').css('width','5px');
    $("body").append(holder);
    holder.animate({'height':'460px','marginTop':'-230px'},400,function(){
      $(this).animate({'width':'600px','marginLeft':'-300px'},400,function(){
        $(this).append($("<img>").attr('src',$("#baseUrl").text()+'/public/images/x.png').css('width','25px').css('height','25px').css('float','right').click(function(){
          holder.html('');
          holder.animate({'width':'5px','marginLeft':'0'},400,function(){
            $(this).animate({'height':'5px','marginTop':'0'},400,function(){
              $(this).remove();
              zoomin=0;
            })
          })
        }))
        $(this).append($("<img>").attr('src',$("#baseUrl").text()+'/public/images/budowa_oka.png'))
      })
    })
    }
  })

})

