$(function(){
	var newsHeight = $('#newsBlock').height();

	var gameBlockHeight = 0;	
	var gameBlockContentHeight = 0;	
	var gameBlockCount = 0;
	$.each($("#gamesBlock").children('.block'), function() {
		gameBlockHeight = gameBlockHeight + $(this).height();
		gameBlockContentHeight = gameBlockContentHeight + $(this).children('.content').height();
		gameBlockCount = gameBlockCount + 1;
	});
	
	var space = (gameBlockCount -1) * 15;
	gameBlockHeight = gameBlockHeight + space;
	
	
		if (gameBlockHeight > newsHeight)
		{
			var difference = (gameBlockHeight - newsHeight);
			$('#newsBlock .content').height($('#newsBlock').children('.content').height() + difference);
		}
		else if (newsHeight > gameBlockHeight)
		{
			var difference = (newsHeight - gameBlockHeight)/gameBlockCount;			
			
			$.each($("#gamesBlock").children('.block').children('.content'), function() {
				$(this).height($(this).height()+difference);
			});
		}
});

var existingOnload = window.onload;
window.onload = function()
{
    if (typeof existingOnload == 'function')
    {
         existingOnload();
    }

    setupPopups();
}


function setupPopups()
{
    var map = document.getElementById('Map');
    if (!map)
    {
        return;
    }
    
    var areas = map.getElementsByTagName('area');
    for (var i = 0; i < areas.length; i++)
    {
        areas[i].onclick = function() 
        { 
            return popup( this, 'notes' );  
        }
    }
    
}
var cnt=0;
function popup(mylink, windowname)
{
	cnt++;
    if (!window.focus)
    {
        return true;
    }
    var href = (typeof mylink == 'string') ?  myLink : mylink.href;
    window.open(href, (cnt), 'width=820,height=350,scrollbars=yes' );
    return false;
}


