function isNumberKey(evt)
 {
   var charCode = (evt.which) ? evt.which : event.keyCode
   if(charCode>31 && (charCode<48 || charCode>57))
    {
      alert('Toto pole môže obsahovať len čísla.');
      return false;      
    }

   return true;
 }


$(document).ready(function(){
  
	$('#productFilter').change(function(){
		value = $(this).val();
		$('.productAll').hide();
		$('.product' + value).show();
	});
	
  tooltip();
	
  $(".onmoseovergray").mouseover(function(){
    malogray=0;
    if($(this).hasClass('gray'))
     {
       malogray=1;
     }
    $(this).removeClass('gray');
    $(this).addClass('oznaceny_riadok');
  }).mouseout(function(){
    $(this).removeClass('oznaceny_riadok');
    if(malogray==1) $(this).addClass('gray');
  });

  $(".onmoseovergray").click(function(){
    hodnota=$(this).attr('id');
    window.top.location.href=hodnota;
  });
  
  $(".edit_contact").click(function(){
     $(".contact_editor").hide('slow');
     hodnota=$(this).attr('title');
     $("#c_"+hodnota).slideToggle('slow'); 
  });
  
  $(".display_novy_kontakt").click(function(){
   $("#novy_kontakt").slideToggle('slow'); 
  });

	$(".menuPolozka").hover(function(){
		if(!($(this).hasClass("on")))
		  {
        $(this).css("opacity",0.5);
        $(this).addClass("polozka_gray");
        $(this).fadeTo(200,1.0);
      }
    if(($(this).hasClass("last")))
      $(this).addClass("last_gray");
	},function(){	  
	  if(!($(this).hasClass("on")))
	   {
       $(this).removeClass("polozka_gray");   

       if(($(this).hasClass("last")))
         $(this).removeClass("last_gray");
     }
	});

  
 $("#button_klientska_zona").click(function()
    {
      $("#kz_content").slideToggle('slow',function(){
      $("#input_login").focus();
      });
            
    });
});

function potvrdenie(vstup)
{
potvrdenie=window.confirm("Skutočne chcete túto položku odstrániť?");

  if(potvrdenie)
   {
    window.top.location.href=vstup;
   }	
}

/// funkcie skrolovania noviniek na homepage
function movedowndva(){
if (iens6&&parseInt(crossobjdva.style.top)>=(contentheightdva*(-1)+153))
crossobjdva.style.top=parseInt(crossobjdva.style.top)-speed+"px"
else if (ns4&&crossobjdva.top>=(contentheightdva*(-1)+153))
crossobjdva.top-=speed
movedownvardva=setTimeout("movedowndva()",20)
}
function moveupdva(){
if (iens6&&parseInt(crossobjdva.style.top)<=0)
crossobjdva.style.top=parseInt(crossobjdva.style.top)+speed+"px"
else if (ns4&&crossobjdva.top<=0)
crossobjdva.top+=speed
moveupvardva=setTimeout("moveupdva()",20)
}
function getcontent_height_dva(){
if (iens6)
contentheightdva=crossobjdva.offsetHeight
else if (ns4)
document.nscontainer.document.nscontent.visibility="show"
}

/// funkcie skrolovania noviniek na homepage
function movedown(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+470))
crossobj.style.top=parseInt(crossobj.style.top)-speed+"px"
else if (ns4&&crossobj.top>=(contentheight*(-1)+470))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",20)
}
function moveup(){
if (iens6&&parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+speed+"px"
else if (ns4&&crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout("moveup()",20)
}
function getcontent_height(){
if (iens6)
contentheight=crossobj.offsetHeight
else if (ns4)
document.nscontainer.document.nscontent.visibility="show"
}
