

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function CloseWindow() {
    window.close();    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height) {
    OpenWindow(url, name, height, width, false);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height, enableScrollbars) {
    OpenWindow(url, name, height, width, enableScrollbars, false);
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWindow(url, name, width, height, enableScrollbars, resizable) {
	if(navigator.appName.indexOf("WebTV")!=-1)
		window.location.href=url;
	else
	{
		winhandle=window.open(url, name, "width=" + width + ",height=" + height + ",scrollbars=" + GetWindowBoolString(enableScrollbars) + ",resizable=" + GetWindowBoolString(enableScrollbars) + ",status=no,menubar=no");
		winhandle.focus();
	}
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function GetWindowBoolString(value) {
    if(value) 
        return "yes";
    else
        return "no";   
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ClearStatusText() {
    window.status='';
    return true;
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function SetStatusToToolTip(item) {
    if(item && item.title) window.status=item.title;
    return true;
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function SetStatus(text) {
    if(item) window.status=item.text;
    return true;
}



//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenTeamProfile(teamID, section) {
    var windowName = 'team' + teamID;
    var url = '/gd/TeamProfile/Default.aspx' + '?tid=' + teamID;
    if(section) {
        url += '&section=' + section;
    }

    OpenWindow(url, windowName, 800, 550);
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenPlayerProfile(playerID, section) {
    var windowName = 'player' + playerID;
    var url = '/gd/PlayerProfile/Default.aspx' + '?pid=' + playerID;
    if(section) {
        url += '&section=' + section;
    }

    OpenWindow(url, windowName, 800, 550);
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenRecruitProfile(recruitID, section) {
    var windowName = 'recruit' + recruitID;
    var url = '/gd/RecruitProfile/Default.aspx' + '?rid=' + recruitID;
    if(section) {
        url += '&section=' + section;
    }

    OpenWindow(url, windowName, 800, 550);
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenPlayerRecordProfile(playerID, teamID, recordID, season, section) {
    var windowName = 'playerRecord' + playerID;
    var url = '/gd/PlayerRecordProfile/Default.aspx' + '?pid=' + playerID + '&tid=' + teamID + '&rid=' + recordID + '&season=' + season;
    if(section) {
        url += '&section=' + section;
    }
    
    OpenWindow(url, windowName, 800, 550);
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenBoxscore(gameID) {
    var windowName = 'boxscore' + gameID;
    var url = '/gd/GameResults/BoxScore.aspx' + '?gid=' + gameID;
    
    OpenWindow(url, windowName, 750, 550, false);
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenPBP(gameID, quarter) {
    var windowName = 'pbp' + gameID;
    var url = '/gd/GameResults/PlayByPlay.aspx' + '?gid=' + gameID + '&quarter=' + quarter;
    
    OpenWindow(url, windowName, 750, 555, true);
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenInboxMessage(messageID) {
    var windowName = 'message' + messageID;
    var url = '/gd/Messages/Inbox.aspx' + '?mid=' + messageID;
    
    OpenWindow(url, windowName, 630, 475);
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenCoachProfile(UID, worldID) {
    var windowName = 'coach' + UID;
    var url = '/gd/CoachProfile/Default.aspx' + '?uid=' + UID + '&wid=' + worldID;
    OpenWindow(url, windowName, 600, 550);
    
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenTeamMatchup(gameID) {
    var windowName = 'matchup' + gameID;
    var url = '/gd/TeamMatchup/Default.aspx' + '?gid=' + gameID;
    OpenWindow(url, windowName, 700, 550, true);
    
    
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenRecruitCompare() {
    var windowName = 'recruitcompare';
    var url = '/gd/Recruiting/Compare.aspx';
    OpenWindow(url, windowName, 700, 330, true);
       
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenRecruitCompare(positionID) {
    var windowName = 'recruitcompare' + positionID;
    var url = '/gd/Recruiting/Compare.aspx' + '?pid=' + positionID;
    OpenWindow(url, windowName, 700, 330, true);
       
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function OpenWISProfile(uid) {
    var windowName = 'profile' + uid;
    var url = '/locker/profile.asp?uid=' + uid;
    OpenWindow(url, windowName, 508, 398, false);
       
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
		node = document;
	if ( tag == null )
		tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp('(^|\\s)'+searchClass+'(\\s|$)');
	for (i = 0, j = 0; i < elsLen; i++) {
		if ( pattern.test(els[i].className) ) {
			classElements[j] = els[i];
			j++;
		}
	}
	return classElements;
}

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
function ActivateObjects() {
    if(navigator.appName == "Microsoft Internet Explorer") {
        var objects = document.getElementsByTagName("object");
        for (var i = 0; i < objects.length; i++)
        {
            objects[i].outerHTML = objects[i].outerHTML;
        }
    }
}
