function showHideTeams(layer_ref,request,layer2) {
	var id = getSelectedFromField('teamsSelect');
	
	if(id==''){
		id = document.getElementById('teamsSelect').value;
	}
	
	if (id == 0) {
		state = 'none';
	} else {
		state = 'block';
	}
	
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].display = state;
	}
	if (document.getElementById &&!document.all) {
		hza = document.getElementById(layer_ref);
		hza.style.display = state;
	}
	
	if(id!=0){
		ajaxRequest(request+';1','hotNews');
		ajaxRequest(request+';2','infoDnia');
		ajaxRequest(request+';3','topZespol');
	}
	showHideSecondLayer(layer2, id);
}
function showHideSecondLayer(layer_ref,id) {
	if (id == 0) {
		state = 'none';
	} else {
		state = 'block';
	}
	
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].display = state;
	}
	if (document.getElementById &&!document.all) {
		hza = document.getElementById(layer_ref);
		hza.style.display = state;
	}
}

function getSelectedFromField(fieldName){
	var selObj = document.getElementById(fieldName);
	if(selObj!=null){
		var selIndex = selObj.selectedIndex;
		if(selIndex!=undefined){
			return selObj.options[selIndex].value;
		}
	}
	return '';
}

function areYouSureScriptForHotNews(id){
	if(document.dodajWiadomosc.hot.checked==true){
		var name = document.getElementById(id).getElementsByTagName('tr');
		if(name.length>1){
			var confirmResult = confirm('Akualnie jest "'+name[1].childNodes[1].innerHTML+'" artykuł na głównej, chcesz kontunuować?');
			if(confirmResult==false){
				document.dodajWiadomosc.hot.checked=false;
			}else{
				document.dodajWiadomosc.hotNewsUpload.disabled=false;
			}
		}else{
			document.dodajWiadomosc.hotNewsUpload.disabled=false;
		}
	}
	if(document.dodajWiadomosc.hot.checked!=true){
		document.dodajWiadomosc.hotNewsUpload.disabled=true;
	}
}

function areYouSureScriptForTopTeamNews(id){
	if(document.dodajWiadomosc.top.checked==true){
		var name = document.getElementById(id).getElementsByTagName('tr');
		if(name.length>1){
			var confirmResult = confirm('Akualnie jest "'+name[1].childNodes[1].innerHTML+'" artykuł na główny w zespole, chcesz kontunuować?');
			if(confirmResult==false){
				document.dodajWiadomosc.top.checked=false;
			}else{
				document.dodajWiadomosc.topNewsUpload.disabled=false;
			}
		}else{
			document.dodajWiadomosc.topNewsUpload.disabled=false;
		}
	}
	if(document.dodajWiadomosc.top.checked!=true){
		document.dodajWiadomosc.topNewsUpload.disabled=true;
	}
}
function areYouSureScriptForTopDayNews(){
	if(document.dodajWiadomosc.day.checked==true){
		var confirmResult = confirm('Jesteś pewny?');
		if(confirmResult==false){
			document.dodajWiadomosc.day.checked=false;
		}
	}
}

function hideAllMenu(){
	showhide('menuTable1');
	showhide('menuTable2');
	showhide('menuTable3');
	showhide('menuTable4');
	showhide('menuTable5');
	showhide('menuTable6');
}

function showhide(layer_ref) {
	var state = 'none';
	// get state for this moment
	hza = document.getElementById(layer_ref);
	state = hza.style.display;
	// get state to IE (state will be empty)
	if(state.lenght==0){
		state = hza.display;
	}
	
	if (state == 'none') {
		state = 'block';
	} else {
		state = 'none';
	}
	
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].display = state;
	}
	
	if (document.getElementById) {
		hza = document.getElementById(layer_ref);
		hza.style.display = state;
	}
}

function test(){
	alert('dziala');
}

