var slide = null;
function bannerRotate() {
  clearTimeout(slide);
  var $active = $('#banner div.active');
  if ( $active.length == 0 ) $active = $('#banner div:first');
  var $next =  $active.next().length ? $active.next() : $('#banner div:first');
  $active.addClass('last-active');
  $next.css({opacity: 0.0})
  .addClass('active')
  .animate({opacity: 1.0}, 700, function() {
    slide = setTimeout('bannerRotate()', 6000);
    $active.removeClass('active last-active');
  });
}
$(document).ready(function() {
	$("#banner_swf").flash({swf:"/domeny/img/banner3.swf", width:918, height:253});
	setTimeout('bannerRotate()', 6000);
	$("#body .lang a[class!=a]").css({'opacity':0.4});
	search_default = $("#search_box input[type='text']").attr("alt");
	$("#search_box input[type='text']").blur(function() {if($(this).val()=="") $(this).val(search_default);}).focus(function() {if($(this).val()==search_default) $(this).val("");});
	$("#search_box input[type='image']").hover(function() {$(this).attr("src", "/domeny/i/search_btn_a.png");}, function() {$(this).attr("src", "/domeny/i/search_btn.png");});
	$("#charts").flash({swf:"/open-flash-chart.swf", width:610, height:300, flashvars: {"data-file":"/domeny/charts.php"}});
	$("#charts_en").flash({swf:"/open-flash-chart.swf", width:610, height:300, flashvars: {"data-file":"/domeny/charts.php?lang=en"}});

	$("a.register").click(function() {
		$("input[name=domain]").val($(this).attr("title"));
		document.postdomain.submit();
	});

	$("a[rel=fancybox]").fancybox();

	$("span.more").css({'cursor':'pointer'}).each(function(i, item) {
	  if($(item).parent().find("div.mini")[0].scrollHeight <= $(item).parent().find("div.mini").height()) {
	    $(item).remove();
	  } else {
	    $(item).click(function() {
	      $(".mini").each(function(j, item2) {
		if($(item2).css("display") == "block") {
		  $(item2).parent().find("div.mini").stop().animate({'height':'58px'});
		  $(item2).parent().find("span.more").show();
		}
	      });

	      $(this).parent().find("div.mini").stop().animate({'height':$(this).parent().find("div.mini")[0].scrollHeight}, function() {
		$(this).parent().find("span.more").hide();
	      });
	  });
	  }
	});
});

