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") == "external")
     anchor.target = "_blank";
 }
}

function fancyBoxInit() {

    $("a.thickbox").fancybox({   
        'titlePosition' : 'inside',     
        'transitionIn'    : 'elastic',
        'transitionOut'    : 'elastic'
    });

    $("a.pano").fancybox({   
		'width': 850,
		'height': 550,
        'titlePosition' : 'inside',     
        'transitionIn'    : 'elastic',
        'transitionOut'    : 'elastic'
    });
    

    $("a.thickbox[rel=gallery]").fancybox({
        'transitionIn'        : 'elastic',
        'transitionOut'        : 'elastic',
        'titlePosition'     : 'inside',        
        'titleFormat'        : function(title, currentArray, currentIndex, currentOpts) {
            return '<span id="fancybox-title-inside">Obrázek ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
        }

    });
}

window.onload = function() {
    externalLinks();
    $("#menu>li").mouseover(function(){ 
      $(this).addClass("over");
    }).mouseout(function(){
      $(this).removeClass("over");
    });
	fancyBoxInit();

    $("#rightMenu").find("li").mouseover(function(){ 
      $(this).addClass("over");
    }).mouseout(function(){
      $(this).removeClass("over");
    });

	$(".objekt").click(function() {
		window.location.href = $(this).find("a.link").attr("href");
		}
	);

    $(".objDetail").find(".objekt").unbind("click");
    $(".item").unbind("click");

	//$("span.navrcholu").append('<img src="http://toplist.cz/dot.asp?id=567935" width="14" height="14" />');

}
    function openWindow(path, name, width, height) {

        var winl = (screen.width - width) / 2;
        var wint = (screen.height - height) / 2;

        style = eval("'status=no,width="+width+",height="+height+",left="+winl+",top="+wint+",resizable=yes,menubar=no,scrollbars=yes,toolbar=no'");
        window.open(path, name, style) ;
    }

