var InsJs = {
	GalleryCounter: 0,
	GalleryStep: 0,
    showNews: function(num)
	{
		$('#newsBox > .boxItem:visible').each(function() {
			$(this).fadeOut('fast', function() {
				$('#newsBox_'+num).fadeIn('slow');
			});
		});
		return false;
	},
    showGallery: function(num)
	{
        InsJs.GalleryStep = num;
        $('.galleryImg:visible').each(function() {
			$(this).fadeOut('slow', function() {
                $('#galleryImg_'+num).fadeIn('slow');
			});
            kolo2 = $('#naviImgKolo_'+num).html();
            kolo1 = $('.naviImgActive').html();
            $('.naviImgActive').html(kolo2).attr('class', '');
            $('#naviImgKolo_'+num).html(kolo1).attr('class', 'naviImgActive');
		});
        setTimeout(InsJs.switchGalery, 10000);
		return false;
	},
    switchGalery: function()
    {
        if (InsJs.GalleryCounter) {
            InsJs.GalleryStep++;
            if (InsJs.GalleryStep > InsJs.GalleryCounter)
                InsJs.GalleryStep = 0;
            InsJs.showGallery(InsJs.GalleryStep);
        }
    }
};
function clickFnc() {
    href = this.href.replace('http://', '');
    document.location.hash = href.substr(href.indexOf('/'));
    $('#ajaxContent').load(this.href, {}, function() {
        initLinks();
        initLightBox();
    });
    return false;
}
function initLinks() {
    $('#mainMenu > li > a').bind('click', clickFnc);
    $('a.norefresh').bind('click', clickFnc);
}
function clickFncIe6() {
    href = this.href.replace('http://', '');
    document.location.hash = href.substr(href.indexOf('/'));
    $('#ajaxContent').load(this.href, {}, function(a) {
        document.getElementById('ajaxContent').innerHTML = a;
        $(this).css('visibility', 'hidden');
        setTimeout(function() {$('#ajaxContent').css('visibility', 'visible');}, '300');
        initLinksIe6();
        initLightBox();
    });
    return false;
}
function initLinksIe6() {
    $('#mainMenu > li > a').unbind('click', clickFnc);
    $('#mainMenu > li > a').bind('click', clickFncIe6);
    $('a.norefresh').unbind('click', clickFnc);
    $('a.norefresh').bind('click', clickFncIe6);
}
function initPage(ie6) {
    if (document.location.hash && document.location.hash.indexOf('#/') > -1) {
        href = document.location.href.replace('http://', '');
        url = href.substr(0, href.indexOf('/'))
        $('#ajaxContent').load('http://'+url+document.location.hash.substr(1), {}, function(a) {
            if (ie6) {
                document.getElementById('ajaxContent').innerHTML = a;
                $(this).css('visibility', 'hidden');
                setTimeout(function() {$('#ajaxContent').css('visibility', 'visible');}, '300');
                initLinksIe6();
            }
            else initLinks();
            initLightBox();
        });
    }
}
function dispSpeMenu(n) {
	$('.halfRight:visible').slideUp('slow', function() {
		$('#showMenu_'+n).slideDown('slow');
	})
	return false;
}
