$(document).ready(function(){
	externalLinks();
	
	$(".main-menu li ul li a").hover(function(){
		im = $(this).children("img");
		im.attr("src",im.attr("src").replace("/menu/","/menu/hover/"));
	},function(){
		im = $(this).children("img");
		im.attr("src",im.attr("src").replace("/menu/hover/","/menu/"));
	});
	
	$("a.aktual-nav").click(function(){
		nav = $(this).children("img").attr("src");
		cont = $(this).prevAll(".aktual-content");
		gal = $(this).prevAll(".gallery");
		
		if (nav.indexOf("off") > 0 ) {
			$(this).children("img").attr("src",nav.replace("off","on"));
			cont.children(".aktual-short").hide();
			cont.children(".aktual-full").show();
			gal.children("a.gal-small").show();
		}else{
			$(this).children("img").attr("src",nav.replace("on","off"));
			cont.children(".aktual-full").hide();
			cont.children(".aktual-short").show();
			gal.children("a.gal-small").hide();			
		}
		return false;
	});
	
	$("h2.collapsed").click(function(){
		nav = $(this).next(".content").css("display");
		if ($(this).hasClass("collapsed")) {
			
			$(".pomahejte-item h2.expanded").toggleClass("collapsed");
			$(".pomahejte-item h2.expanded").toggleClass("expanded");
			$(".pomahejte-item").removeClass("expand");
			$(".pomahejte-item .content").hide();
			
			$(this).toggleClass("collapsed");
			$(this).toggleClass("expanded");
			$(this).parents(".pomahejte-item").toggleClass("expand");			
			$(this).next(".content").show();
		} else {
			$(this).toggleClass("collapsed");
			$(this).toggleClass("expanded");
			$(this).parents(".pomahejte-item").toggleClass("expand");
			$(this).next(".content").hide();
		}
		
		return false;
	});
	
	$(".pomohli-vice").click(function(){
		img = $(this).children("img").attr("src");
		if (img.indexOf("off")>0){
			$("#content"+$(this).attr("href")).hide();
			$(this).children("img").attr("src",img.replace("arrow-off","arrow"));
		}else {
			$("#content"+$(this).attr("href")).show();
			$(this).children("img").attr("src",img.replace("arrow","arrow-off"));			
		}
		return false;
	});
	
    $('a.highslide').each(function() {
    	
	    this.onclick = function() {
	      id_akt = $(this).parent().children(".hsmain").attr("id");	
	      return hs.expand(this,{slideshowGroup: id_akt});
	    };
	});	
});
function externalLinks() { 
    if (!document.getElementsByTagName) return; 
   var anchors = document.getElementsByTagName("a"); 
       for (var i=0; i<anchors.length; i++) { 
          var anchor = anchors[i];
          if (anchor.getAttribute("href") && anchor.getAttribute("rel") != "internal") {
            anchor.target = "_blank"; 
          }
       } 
} 
