function switchf() {
 var el = document.getElementById("user");
 if (el) el.focus();
}

function setSeasonResLayer(val){

	var layers_ = new Array()
	
	layers_['runs'] = 'runs';
	layers_['wick'] = 'wick';
	layers_['catch'] = 'catch';

	for(var k in layers_){
		if (layers_[k] == val){
			document.getElementById('tab_'+val).style.display = "block";
		}
		else{
			if(layers_[k] != val){
				document.getElementById('tab_'+layers_[k]).style.display = "none";
			}
		}
	}
}

function changeLayer(val){
	for(var k in layers){
		if (layers[k] == val){
			document.getElementById('tab__'+layers[k]).style.display = "block";
		}
		else
			document.getElementById('tab__'+layers[k]).style.display = "none";
	}
}

function setNextLayer(val){
	for(var k in layers){
		document.getElementById('tab'+val+'_pos').style.display = "none";
		document.getElementById('tab'+val+'_last').style.display = "none";
		document.getElementById('tab'+val+'_next').style.display = "block";
	}
}

function setLastLayer(val){
	for(var k in layers){
		document.getElementById('tab'+val+'_pos').style.display = "none";
		document.getElementById('tab'+val+'_last').style.display = "block";
		document.getElementById('tab'+val+'_next').style.display = "none";
	}
}

function setPosLayer(val){
	for(var k in layers){
		document.getElementById('tab'+val+'_pos').style.display = "block";
		document.getElementById('tab'+val+'_last').style.display = "none";
		document.getElementById('tab'+val+'_next').style.display = "none";
	}
}

function ShowFixture(id)
{
	url = "show_fixture.php?fixture_id="+id;
	eval("window.open(url, 'showFixture"+id+"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=280');");
}

function OnPicture(name, dir, width, height)
{
	if ((width > screen.width * 0.8) || (height > screen.height * 0.8)) {
		width = screen.width / 2;
		height = screen.height / 2;
		popUpX("picture_show.php?picture_dir="+dir+"/pictures&name=" + name, width, height, "1");
	} else {
		popUpX("picture_show.php?picture_dir="+dir+"/pictures&name=" + name, width, height, "0");
	}
}

function popUpX(URL, width, height, sc)
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=' + sc + ',location=0,statusbar=0,menubar=0,resizable=1,width=" + width + ",height=" + height + "');");
}