//wykrycie przegladarki
var DOM		= (document.getElementById ? true : false); 
var NN		= (document.layers ? true : false);
var MISIO	= ((document.all && !DOM) ? true : false);

function podswietl() {
	window.event.srcElement.className = "MainMenuOver";
}

function wygas() {
     window.event.srcElement.className = "MainMenu";
}


function podswietl_1() {
	window.event.srcElement.className = "mm_menu_over";
}

function wygas_1() {
     window.event.srcElement.className = "mm_menu";
}

function podswietlSub() {
	window.event.srcElement.className = "SubMenuOver";
}


function zmianKlase(nazwaKlasy) {
	window.event.srcElement.className = nazwaKlasy;
}

function wygasSub() {
     window.event.srcElement.className = "SubMenu";
}


var oldBgColor = "";

function zmienColor(color){

		window.event.srcElement.style.backgroundColor = color;

}

function belka(elem){
	if (oldBgColor == elem.style.backgroundColor) {
		oldBgColor = elem.style.backgroundColor;
		elem.style.backgroundColor = "#E4E4E4";	//kolor najechanej belki
		}
	else {
		elem.style.backgroundColor = oldBgColor;
		oldBgColor = "";
		}
}
function getElem_ie(warstwaName) {
	var elem;
	if (DOM)	elem = document.getElementById(warstwaName);
	if (MISIO)	elem = document.all.warstwaName;

	return elem;
}

// zwraca obiekt
function getElem(warstwaName) {
	
	var elem;
	if (DOM)	elem = document.getElementById(warstwaName);
	if (MISIO)	elem = document.all.warstwaName;
	if (NN)		elem = document.layers.warstwaName;
	return elem;
}

function pokaz_warstwe(to_show, to_hide)
{
	eval("document.all." + to_hide + ".style.display = 'none'");
	eval("document.all." + to_show + ".style.display = 'block'");
}
function hideWarstwa(sNazwaWarstwy)
{
	elem = getElem(sNazwaWarstwy);
	elem.style.display = 'none';
}

function showWarstwa(sNazwaWarstwy)
{
	//alert(sNazwaWarstwy);
	elem = getElem(sNazwaWarstwy);
	elem.style.display = 'block';
}

function onOff_warstwa(sNazwaWarstwy)
{
	//alert(sNazwaWarstwy);
	elem = getElem(sNazwaWarstwy);

	if(elem.style.display == 'none')
		elem.style.display = 'block';
	else
		elem.style.display = 'none'
}

function hideWarstwa_v(sNazwaWarstwy)
{
	elem = getElem(sNazwaWarstwy);
	elem.style.visibility = "hidden";
}

function showWarstwa_v(sNazwaWarstwy)
{
	elem = getElem(sNazwaWarstwy);
	elem.style.visibility = "visible";
}

function clearForm(forma) {
	for (i=0; i < forma.length; i++)
		if (forma[i].name != 'newKryteria'  && forma[i].name != 'pr_dz_id')
			forma[i].value = '';
}


function openSlownik(slownik, nazwa_pola, nazwa_pola_id, nazwa_formularza, parametr, path) {
	window.name = 'mainWindow';
	if (nazwa_formularza == undefined)
		nazwa_formularza = 'formWyszukiwarka';
	if (path == undefined)
		path = '';
	window.open(path + 'slownik_mini_lst.asp?slownik=' + slownik + '&pole=' + nazwa_pola + '&pole_id=' + nazwa_pola_id + '&formName=' + nazwa_formularza + '&parametr=' + parametr, 'slownik' , 'width=360, height=500, toolbars=yes, resizable=yes');
}

function open_file_NewWindow(file,nazwa,szerokosc,wysokosc,typ,qString)
{

switch (typ) {
   case 1 :
		w_toolbar	 = "yes";
		w_menubar	 = "yes";
		w_scrollbars	= "yes";
		w_status	 = "yes";
		w_location	 = "yes";
		w_resizable	 = "yes";

		break;
   case 2 :
		w_toolbar	 = "no";
		w_menubar	 = "no";
		w_scrollbars	= "no";
		w_status	 = "no";
		w_location	 = "no";
		w_resizable	 = "no";

		break;
   case 3 :
		w_toolbar	 = "no";
		w_menubar	 = "no";
		w_scrollbars = "yes";
		w_status	 = "no";
		w_location	 = "no";
		w_resizable	 = "yes";

		break;
} 
opcje_okna = "toolbar="+ w_toolbar+",menubar="+ w_menubar +",scrollbars="+ w_scrollbars +",status="+ w_status +",location="+ w_location +",resizable="+ w_resizable +",width="+ szerokosc +",height="+ szerokosc;
file = file + qString;

window.open(file, "windowName", opcje_okna);

}

function wyczysc_zawartoscWarstwy(sNazwaWarstwy)
{

	elem = getElem(sNazwaWarstwy);
	//alert(elem.innerText);
	elem.innerText = "";

}
