var $j = jQuery.noConflict();

$j(document).ready(function(){
	
//	$j('ul.menu > li > a').click(
//    function() {
//      var checkElement = $j(this).next();
//      if((checkElement.is('ul.menu ul')) && (checkElement.is(':visible'))) {
//        return false;
//        }
//      if((checkElement.is('ul.menu ul')) && (!checkElement.is(':visible'))) {
//        $j('ul.menu ul:visible').slideUp(200).parent().removeClass('menu-active');
//        checkElement.slideDown('normal').parent().addClass('menu-active');
//        return false;
//        }
//      }
//    );

	$j('.soubor > a').click(
    function() {
      var checkElement = $j(this).next();
      if((checkElement.is('.soubor .popis')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('.soubor .popis')) && (!checkElement.is(':visible'))) {
        $j('.soubor .popis:visible').slideUp(200).parent().removeClass('this');
        checkElement.slideDown('normal').parent().addClass('this');
        return false;
        }
      }
    );

	$j('.login').click(function() {
		$j('#login').slideToggle('slow');
	});
	
	$j("table > tr:odd, table > tbody > tr:odd").addClass("odd");
	
	$j("a[rel^='clearbox']").fancybox({ 'zoomSpeedIn': 1000, 'zoomSpeedOut': 0, 'overlayShow': true }); 

	//$j("a.triger[rel^='clearbox']").bind("click",function(){   });
	
	$j("a.triger[rel^='clearbox']").click();

	var path = location.pathname.substring(1);
  if (path){
    $j('ul.menu ul li ul li a[@href$="' + path + '"]').attr('class', 'selected').parents('ul').css('display','block').parents('li').css('display', 'block').parents('li').css('display', 'block');
		
		path = location.pathname.substring(1);
    var poziceLom = path.lastIndexOf('/');
    path = path.substring(0,poziceLom+1);
	    $j('ul.menu > li > a[href$="' + path + '"]').attr('class', 'selected');
			
		path = location.pathname.substring(1);
	    $j('ul.menu > li > ul > li > a[href$="' + path + '"]').attr('class', 'selected').parents('ul').css('display','block');
  }
		
});
