﻿/* PEOPLE */
function FindPeople(type, id, siteID, league)
{
    document.location.href="/IBA/People.aspx?siteid="+siteID+"&"+type+"="+id+"&l="+league;
}

function SetMainVote(refID, siteId)
{
	var val = $j('input[name=Vote' + refID + ']:checked').val() ;
	if (val == undefined) { alert("אנא בחר תשובה על מנת להשתתף במשאל"); return false; }

	var voteUrl = "http://"+serviceHost+"/Cat/General/Counter.aspx?type=7&id="+refID+"&an="+val;
	var imgVote = new Image();
	imgVote.onerror = function () { window.setTimeout("VoteRedirect(" + siteId + ")", 10); }
	imgVote.onload = function () { window.setTimeout("VoteRedirect(" + siteId + ")", 10); }
	imgVote.src = voteUrl;
	
	SetCookieDays("vote"+refID, "1", 7);
}

function VoteRedirect(siteId)
{
    window.location.href = "/General/Votes.aspx?siteId=" + siteId;
}

function UnderConstruction()
{
    alert("יהיה פעיל בקרוב");
}

function SwitchNationalTeam(teamId)
{
    window.location.href = "NationalTeams.aspx?teamId=" + teamId;
}

function SwitchSeason(leagueId) {
    var url = window.location.href
    var idx = url.indexOf("&s=");
    var season = ($j("#ddlSeason").val() == 0)? "" : "&s=" + $j("#ddlSeason").val();
    
    if (idx > 0)
        url = url.replace(/&s=[\d]*/, season);
    else
        url = url + season;
    
    window.location.href = url;

}

//fixes the top menu width problem in IE7. 
function FixIE7TopMenu() {
    if ($j.browser.msie && parseInt($j.browser.version) == 7)
        $j.each($j("#TopMenu > div > ul"), function (i, ul) {
            var sum = 0;
            $j.each($j(ul).children(), function (i, li) {
                sum += $j(li).outerWidth(true);
            });
            $j(ul).parent().width(sum);
        });
}
