$(document).ready(function() {
    resize();
    
	$('ul.logos a').hover(
		function() {
			var o = $('img', this);
			o.attr('src', o.attr('src').replace('.png', '_.png'));
		},
		function() {
			var o = $('img', this);
			o.attr('src', o.attr('src').replace('_.png', '.png'));
		}
	);
    
});

if(!$.browser.msie) {
    $(window).resize(function() {
        if(rt) clearTimeout(rt);
        rt = setTimeout(resize, 200);
    });
}

var rt = null;
resize = function() {
    if(document.location.pathname == '/') {
        var wh = $(window).height();
        var ch = $('div.wrap').height() + parseInt($('div.wrap').css('margin-bottom').replace('px', ''));
        
        var diff = 0;
        var lb = $('ul.logos');
        if(wh > 521) {
            if(wh > ch) 
                diff = Math.round((Math.abs(wh-ch))/2);
            else if(wh < ch) {
                var lbh = parseInt(lb.css('margin-top').replace('px', '')) + parseInt(lb.css('margin-bottom').replace('px', ''));
                ch -= lbh;
                diff = Math.round((Math.abs(wh-ch))/2);
            }
            
            
            //$('ul.tizers').css({'marginTop': diff+Math.round(diff/2), 'marginBottom': Math.round(diff/2)});
        }
        lb.css({'marginTop': diff, 'marginBottom': 24+diff});
    }
}
