//Autofill
function autoFill(id, v){
	$(id).css({ color: "#d5d5d5" }).attr({ value: v }).focus(function(){
		if($(this).val()==v){
			$(this).val("").css({ color: "black" });
		}
	}).blur(function(){
		if($(this).val()==""){
			$(this).css({ color: "#d5d5d5" }).val(v);
		}
	});
}
//shadowbox
$(window).load(function(){
 var options = {
  animate: true,
  animateFade: true,
  animSequence: "sync",
  resizeDuration: 0.15,
  fadeDuration: 0.2,
  flvPlayer: 'template/rest/flvplayer.swf',
  modal: false,
  continuous: true,
  counterType: "skip",
  counterLimit: 10,
  overlayColor: "black",
  overlayOpacity: 0.8,
  viewportPadding: 10,
  initialHeight: 250,
  initialWidth: 400
 };
 Shadowbox.init(options);
});
var down;

$(document).ready(function(){
$('.fix-z-index').bgiframe(); // ie bigframe fix
// bubble
$('.minicalendar .days a').tooltip({ 
    track: true, 
    delay: 0, 
    showURL: false, 
    showBody: " ; ", 
    fade: 250,
    positionLeft: true
});
//cycle
$('#index-slider').cycle({ 
    fx:     'fade', 
    timeout: 6000, 
    delay:  -2000 
});
  var navTimeOut;
  autoFill($("#searchString"), "Hľadať...");
  //submenu
   $("#menu_lft").children("ul").children("li").mouseover(function () {
     if($(this).children("ul").attr("id") == "" || $(this).children("ul").attr("id") == null)
      return false;
     if($(this).children("ul").attr("id") != down)
     {
       $(".subMenu:visible").parent().children("a").removeClass("menuHover");
       $(".subMenu").hide();    
       if($(this).children("ul").is(":hidden"))
       {
         $(this).children("ul").fadeIn("normal"); 
         $(this).children("a").addClass("menuHover");  
       }
       down = $(this).children("ul").attr("id");
     }
     clearTimeout(navTimeOut);
     return false;
   });
   $("#menu_lft").children("ul").children("li").mouseout(function() {
    if($(this).children("ul").attr("id") == down) 
      navTimeOut = setTimeout("hide()" , 1500);  
   });   
});
 
function hide(){
  $(".subMenu:visible").fadeOut("normal", function() {
    $(this).parent().children("a").removeClass("menuHover");  
  });
  down = null;
  
}