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

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

          /* form-validation */
          
var form_validation = new FormValidation({
    default_border : "1px solid #CCCCCC",
    error_border : "1px solid #E80000",
    error_background : "#E80000"
});

          /* targetblanks */

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

         /* search text */
                                   
if($$("html").get("lang") == "en"){
  var search_value = "Search term...";
} else {
  var search_value = "Hledaný výraz...";
}

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

if($('authorized_users')){


var tmp;

tmp = $$('.authorized_user_item_in h2.name','.authorized_user_item_in h3.name');
if (tmp && tmp.length > 0) {
	tmp.each(function(h2, i){
		var t = h2.getNext(), q, a;
		q = new Element('div');
		while(t && t.get('tag') === 'div') {
			a = t.getNext();
			q.adopt(t);
			t = a;
		}
		q.injectAfter(h2);
		h2.addEvent('click', function() {
			this.retrieve('slide:fx').toggle();
		});
		q = new Fx.Slide(h2.getNext(), {
			link: 'cancel'
		});
		q.addEvent('complete', function(qq) {
			if (qq.open) {
				this.addClass('act');
			}
			else {
				this.removeClass('act');
			}
		}.bind(h2, q));
		h2.store('slide:fx', q);
		if (i > 0) {
			q.hide();
		}
		else {
			h2.addClass('act');
			q.show();
		}
	});

	if($('toggleAll')){
    $('toggleAll').addEvent('click', function() {
  		if (this.hasClass('allOpen')) {
  			this.removeClass('allOpen');
  			tmp.each(function(h){
  				h.retrieve('slide:fx').slideOut();
  			});
  		}
  		else {
  			this.addClass('allOpen');
  			tmp.each(function(h){
  				h.retrieve('slide:fx').slideIn();
  			});
  		}
  	});
  }
}
}


});

