window.addEvent("domready", function(){


/* captcha */     
if($$("#button")){

		$$('input[name=captcha]').set('value','23');

}
          /* xbox */
          
var x_box = new XBox(); 

          /* novinky */          

if($("novinka")){
  $$("#novinka a.vice").addEvent("click", function(){
    $$("#"+this.getParent().id+" a.vice").addClass("nocss");
	$$("#"+this.getParent().id+" a.mene").removeClass("nocss");
	$(this.getParent().id + "_content").setStyle("display", "block");
    return false;
  });
  $$("#novinka a.mene").addEvent("click", function(){
    $$("#"+this.getParent().id+" a.vice").removeClass("nocss");
	$$("#"+this.getParent().id+" a.mene").addClass("nocss");
	$(this.getParent().id + "_content").setStyle("display", "none");
    return false;
  });
}


          /* mapa hp */          

if($("mapa_hp")){
  $$("#mapa_hp").addEvent("click", function(){
  	window.location.href = 'preplavby';
    return false;
  });
}

          /* form-validation */
          
var form_validation = new FormValidation({
    default_border : "1px solid #C9C9C9"
});

          /* navi */
if($("navi")){
  $$("#navi .level0").each(function(item){
    item.addEvents({
      "mouseover" : function(){
        if(this.getElement("ul")){
          this.getElement("ul").setStyle("display", "block");
        }
      },
      "mouseout" : function(){
        if(this.getElement("ul")){
          this.getElement("ul").setStyle("display", "none");
        }
      }
    });
  });
}
          /* naviz */

if($("naviz")){
  var looper = looping.periodical(3000);  // set delay in miliseconds 
}

if($("naviz")){
  $$("#naviz a").addEvent("click", function(){
    $$("#naviz a.act").removeClass("act");
    this.addClass("act");
    looper = $clear(looper);
    $$(".naviz_content").setStyle("display", "none");
    $("naviz_" + this.getParent().id + "_content").setStyle("display", "block");
    this.blur();
    return false;
  });
}

          /* search text */

if($$("html").get("lang") == "en"){
  var search_value = "Searched word...";
  var user_value = "User"; 
  var pass_value = "pass"; 
} else {
  var search_value = "Hledaný výraz...";
  var user_value = "Uživatelské jméno"; 
  var pass_value = "heslo"; 
}

if($("search")){
  if($("search").value == ""){
    $("search").value = search_value;
  }
  $("search").addEvent("click", function(){
    if($("search").value == search_value){
      $("search").value = "";
    }    
  });
  $("search").addEvent("blur", function(){
    if($("search").value == ""){
      $("search").value = search_value;
    }    
  });  
}

          /* user text */
          
if($("f_user")){
  if($("f_user").value == ""){
    $("f_user").value = user_value;
  }
  $("f_user").addEvent("click", function(){
    if($("f_user").value == user_value){
      $("f_user").value = "";
    }    
  });
  $("f_user").addEvent("blur", function(){
    if($("f_user").value == ""){
      $("f_user").value = user_value;
    }    
  });  
}

          /* pass text */

if($("f_pass")){
  if($("f_pass").value == ""){
    $("f_pass").value = pass_value;
  }
  $("f_pass").addEvent("click", function(){
    if($("f_pass").value == pass_value){
      $("f_pass").value = "";
    }    
  });
  $("f_pass").addEvent("blur", function(){
    if($("f_pass").value == ""){
      $("f_pass").value = pass_value;
    }    
  });  
}


          /* targetblanks */

$$("a.targetblank").addEvent("click", function(event){
  if(typeof window.open(this.href)=="object"){
    event.stop();
  }
});

});



var looping_index = 2;
var looping = function(looping_steps){
  $$("#naviz a.act").removeClass("act");  
  $$(".naviz_content").setStyle("display", "none");
  $("l"+looping_index).getFirst().addClass("act");
  $("naviz_l" + looping_index + "_content").setStyle("display", "block");  
  if(looping_index == $$(".naviz_content").length){
    looping_index = 1;
  } else {
    looping_index++;
  }
}

