$(document).ready(function(){
    
	//empty links
	$('a[href=#]').click(function(){
		return false;
	});
	
    $('a.fancy').fancybox();
    
    //bg for ie
    if( $.browser.msie ) {
        $('.bgWrap').height($(document).height());
    }
    
    //bg fo text
    if( ! $('body').hasClass('index') ) {
        var mih = $('#right').height() + 20;
        $('.textWrap').css({'min-height':mih, '_height':mih});
    }
        
        
        //шняшки в футере
        //добавляем стрелочки
        var i;
        $('.sitemap ul').each(function(){
            i = 0;
            $(this).children('li').each(function(){
                i++;
            });
            if( i > 4 ) {
                $(this).parent('span').addClass('folder');
                $(this).parents('.wrap:first').append('<b>...</b>');
                //$('<b>...</b>').appendTo($(this).parent('.wrap'));
            }
        });
        $('.sitemap .folder strong a').click(function(){
            if( $(this).parents('.folder').hasClass('current') ) {
                //закрываем
                $(this).parents('span').animate({'height':65, 'top':0}, 100, function(){
                    $(this).removeClass('current').siblings('b').show();
                });
            } else {
                //раскрываем
                var newH = $(this).parents('.folder').find('ul').height() + $(this).parent('strong').height();
                $(this).parents('span').animate({'height':newH, 'top':-newH+60}, 100).addClass('current');
                $(this).parents('.folder:first').siblings('b').hide();
            }
        });
    //}
   
    //table 0
    $('table[border="0"]').addClass('b0');
    
});
