﻿
var dataType;
var sclassID;
var matchSeason;
var year;
var month;
var matchKind;
function Odds(id)
{
window.open('http://www.nowgoal.com/OddsCompBasket.aspx?id='+id,'_blank');
}
function OddsDetail(id,flag)
{
 var window_width = 500;
    var window_height = 300;
    var window_top = 200;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open('/Basketball/OddsDetail.aspx?oddsID='+id+"&flag="+flag,'odds','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + '');


}
function Analysis(id)
{
window.open('http://www.nowgoal.com/nbaAnalysis/'+id+'.html','_blank');
}
function GoBySclassID(value)
{
    sclassID=value;
    self.location.href="/Basketball/League/"+dataType+"/"+sclassID+"/"+matchSeason+"/"+matchKind+"/"+year+"_"+month+".htm";
}
function GoByMatchSeason(value)
{
    if(value=="0")
    return false;
    matchSeason=value;
    self.location.href="/Basketball/League/"+dataType+"/"+sclassID+"/"+matchSeason+"/";
}
function GoByYearMonth(yy,mm)
{
    year=yy;
    month=mm;
    var teamID=GetTeamID();
    if(teamID<1)
        self.location.href="/Basketball/League/"+dataType+"/"+sclassID+"/"+matchSeason+"/"+matchKind+"/"+year+"_"+month+".htm";
    else
        self.location.href="/Basketball/League/"+dataType+"/"+sclassID+"/"+matchSeason+"/"+matchKind+"/"+year+"_"+month+".htm?teamID="+teamID;
}
function GoByMatchKind(value)
{
    matchKind=value;
    self.location.href="/Basketball/League/"+dataType+"/"+sclassID+"/"+matchSeason+"/"+matchKind+"/";
}
function GoByTeamID(value)
{
var teamID=parseInt(value);
if(teamID<1)
   self.location.href="/Basketball/League/"+dataType+"/"+sclassID+"/"+matchSeason+"/"+matchKind+"/"+year+"_"+month+".htm";
else
   self.location.href="/Basketball/League/"+dataType+"/"+sclassID+"/"+matchSeason+"/"+matchKind+"/"+year+"_"+month+".htm?teamID="+teamID;
}
function GoByTeamAB()
{
var hometeamID=parseInt(document.getElementById("dropTeam1").value);
var guestteamID=parseInt(document.getElementById("dropTeam2").value);
var arrTr=document.getElementsByName("teamList");
var row=0;
for(i=0;i<arrTr.length;i++)
{
    if(hometeamID>0&&guestteamID>0)
    {
        if((arrTr[i].childNodes[1].id==hometeamID&&arrTr[i].childNodes[3].id==guestteamID)||(arrTr[i].childNodes[1].id==guestteamID&&arrTr[i].childNodes[3].id==hometeamID))
        {
            arrTr[i].style.display="";
            row++;
        }
        else
             arrTr[i].style.display="none";
    }
    else if(hometeamID>0)
    {
        if(arrTr[i].childNodes[1].id==hometeamID||arrTr[i].childNodes[3].id==hometeamID)
        {
            arrTr[i].style.display="";
            row++;
        }
        else
             arrTr[i].style.display="none";
    }
    else if(guestteamID>0)
    {
        if(arrTr[i].childNodes[1].id==guestteamID||arrTr[i].childNodes[3].id==guestteamID)
        {
            arrTr[i].style.display="";
            row++;
        }
        else
             arrTr[i].style.display="none";
    }
    
    if(row%2==0)
        arrTr[i].className="row1";
    else
        arrTr[i].className="row3";
}

}
function GetTeamID()
{
    var teamID=request("teamID");
    if(teamID=="")
        return 0;
    else
        return parseInt(teamID);
}

function request(paras){ 
    var url = location.href;  
    var paraString = url.substring(url.indexOf("?")+1,url.length).split("&");  
    var paraObj = {};
    for (i=0; j=paraString[i]; i++){  
    paraObj[j.substring(0,j.indexOf("=")).toLowerCase()] = j.substring(j.indexOf("=")+1,j.length);  
    }  
    var returnValue = paraObj[paras.toLowerCase()];  
    if(typeof(returnValue)=="undefined"){  
    return "";  
    }else{  
    return returnValue;  
    }  
} 
function SetParam(type,sID,mSeason,yy,mm,mKind)
{
dataType=type;
sclassID=sID;
matchSeason=mSeason;
year=yy;
month=mm;
matchKind=mKind;
}
function showByTeamID()
    {
        var teamID=document.getElementById("dropTeam").value;

        if(parseInt(teamID)>0)
        {
            var arrTr=document.getElementsByName("teamList");
            for(i=0;i<arrTr.length;i++)
            {
                if(arrTr[i].childNodes[1].id==teamID||arrTr[i].childNodes[1].id==teamID)
                    arrTr[i].style.display="";
                else
                     arrTr[i].style.display="none";
            }
        }
    }