$(function(){
	$('#pro_euro').bind('click', function() {
		changeBoxContent("uleb", "x1011");
	});
	$('#pro_spa').bind('click', function() {
		changeBoxContent("spa", "x1011");
	});
	$('#pro_ita').bind('click', function() {
		changeBoxContent("ita", "x1011");
	});
	$('#pro_fra').bind('click', function() {
		changeBoxContent("fra", "x1011");
	});
	$('#pro_gre').bind('click', function() {
		changeBoxContent("gre", "x1011");
	});
});


function changeBoxContent(nat, year){
	$(".content1").load("standings.php", { nat: nat, year: year });	
	$(".content2").load("upcoming_games.php", { nat: nat, year: year }, bindNewEvent);
	$(".active").removeClass("active");
	$('#pro_'+nat).addClass("active");
}

function bindNewEvent(){
	return true;
	$(".teamname_s").bind('mouseenter', function(event) {
		toogleFullTeamName(this);
	});
}

function toogleFullTeamName(tt){
	if (strpos(tt.text, "...")){
		var aaa = randomBetween(10, 1000);
		$(tt).html("<div class=team_"+aaa+">"+tt.rel+"</div>");
		$("div.team_"+aaa).addClass("long_team_name");
	}else{
		if (strlen(tt.text)>10 && !strpos(tt.text, '...')){
			var name = substr(tt.rel, 0, 7)+'...';
			$(tt).html(name);
		}
	}
}

function random(X){
	return Math.floor(X * (Math.random() % 1));
}

function randomBetween(Min, Max){
	return Min + random(Max - Min + 1);
}

function goTogamea(merk) {
	ga=window.open("http://195.56.77.56/1024eng/enter.phtml?szkod="+merk,"merka","width=1015,height=718,left=0,top=0");
}

function goTogameb(merk) {
	ga=window.open("http://195.56.77.56/1024fra/enter.phtml?szkod="+merk,"merka","width=1015,height=718,left=0,top=0");
}

function goTogamec(merk) {
	ga=window.open("http://195.56.77.56/1024ita/enter.phtml?szkod="+merk,"merka","width=1015,height=718,left=0,top=0");
}

function goTogamed(merk) {
	ga=window.open("http://195.56.77.56/1024isr/enter.phtml?szkod="+merk,"merka","width=1015,height=718,left=0,top=0");
}


