// These functions courtesy GoobNet Football, http://football.goobnet.net/
// Nathan S Brown, 2001-6
// Please use or modify these functions, but give me credit.
// Have a nice day...

var imgarr=new Array();
function loadimg(i) {
	var newimg=new Image;	newimg.src="http://football.goobnet.net/_images/"+i;
	imgarr[imgarr.length]=newimg;
}

if (document.images) {
	if (window.location.href.indexOf("/worldcup2006/")>=0) {
		loadimg("worldcup2006/grpbtn_a__.gif");	loadimg("worldcup2006/grpbtn_a_a.gif");
		loadimg("worldcup2006/grpbtn_b__.gif");	loadimg("worldcup2006/grpbtn_b_a.gif");
		loadimg("worldcup2006/grpbtn_c__.gif");	loadimg("worldcup2006/grpbtn_c_a.gif");
		loadimg("worldcup2006/grpbtn_d__.gif");	loadimg("worldcup2006/grpbtn_d_a.gif");
		loadimg("worldcup2006/grpbtn_e__.gif");	loadimg("worldcup2006/grpbtn_e_a.gif");
		loadimg("worldcup2006/grpbtn_f__.gif");	loadimg("worldcup2006/grpbtn_f_a.gif");
		loadimg("worldcup2006/grpbtn_g__.gif");	loadimg("worldcup2006/grpbtn_g_a.gif");
		loadimg("worldcup2006/grpbtn_h__.gif");	loadimg("worldcup2006/grpbtn_h_a.gif");
	}
	loadimg("zonebtn_afc__.gif");	loadimg("zonebtn_afc_a.gif");
	loadimg("zonebtn_caf__.gif");	loadimg("zonebtn_caf_a.gif");
	loadimg("zonebtn_concacaf__.gif");	loadimg("zonebtn_concacaf_a.gif");
	loadimg("zonebtn_conmebol__.gif");	loadimg("zonebtn_conmebol_a.gif");
	loadimg("zonebtn_ofc__.gif");	loadimg("zonebtn_ofc_a.gif");
	loadimg("zonebtn_uefa__.gif");	loadimg("zonebtn_uefa_a.gif");
	loadimg("btnrowopen_0.gif");	loadimg("btnrowopen_1.gif");
	loadimg("btntreeopen_0.gif");	loadimg("btntreeopen_1.gif");
}

function hilite(i,v) {
	switch (v) {
		case 0: c='_'; break;
		case 1: c='h'; break;
		case 2: c='a'; break;
	}
	if (document.images) document.images[i].src="http://football.goobnet.net/_images/"+i+"_"+c+".gif";
}

function hilitegrp(comp,i,v) {
	switch (v) {
		case 0: c='_'; break;
		case 1: c='h'; break;
		case 2: c='a'; break;
	}
	if (document.images) document.images[i].src="http://football.goobnet.net/_images/"+comp+"/"+i+"_"+c+".gif";
}

// Highlights row. sw is 0 for normal, 1 for hover, 2 for active.
function hiliterow(row,sw) {
    var bgcol,txtcol,linkcol;
    switch (sw) {
        case 1:     bgcol="202020"; txtcol=linkcol="C0C0C0";    break;
        case 2:     bgcol="401040"; txtcol=linkcol="FF40FF";    break;
        default:    bgcol=linkcol="";   txtcol="00FF00";        break;
    }
    var item=document.getElementById("treerow"+row);
    item.style.backgroundColor=bgcol;
    item.style.color=txtcol;
    document.getElementById("treeitem"+row).style.color=linkcol;
}

// Activates row and jumps to dest.
function jump(dest,row) {
    hiliterow(row,2);
    window.location.href=dest;
}

// Activates row and jumps to dest.
function jumpcell(dest,cell,st) {
    hilitecell(cell,2,st);
    window.location.href=dest;
}

// Switches a row on or off.
function togglerow(row) {
    var disp=(navigator.userAgent.indexOf("MSIE")==-1) ? "table-row" : "block";
    var t=document.getElementById(row).style.display;
    document.getElementById(row).style.display=(t=="none") ? disp : "none";
}

// Switches a matchnote row on or off.
function togglematchnote(mid) {
    togglerow("matchnotes"+mid);
    var i=(document.getElementById("matchnotes"+mid).style.display=="none") ? "0" : "1";
    if (document.images) document.images["btnnoteopen"+mid].src="http://football.goobnet.net/_images/btnrowopen_"+i+".gif";
}

// Switches a dynatree row on or off. def indicates the default setting.
function toggletreerow(rid,def) {
    togglerow("subtree"+rid);
    var i=(document.getElementById("subtree"+rid).style.display=="none") ? "0" : "1";
    if (document.images) document.images["btntreeopen"+rid].src="http://football.goobnet.net/_images/btntreeopen_"+i+".gif";
}
