noweOkienko = null;

function lupka(plik_strony, w, h, przew){
    if (!w) {w=600;}
    if (!h) {w=400;}
if (!przew) {przew='yes';}

  if (window.screen){
    aw=screen.availWidth;
    ah=screen.availHeight;
  }else{
     aw=640;
     ah=450;
  }

    ustawienia=
     "left=" + (aw-w)/2 + ","
    +"top=" + (ah-h)/2 + ","
    +"screenX=" + (aw-w)/2 + ","
    +"screenY=" + (ah-h)/2 + ","
    +"width=" + w + ","
    +"height=" + h + ","
    +"innerWidth=" + w + ","
    +"innerHeight=" + h + ","
    +"toolbar=no,"
    +"location=no,"
    +"directories=no,"
    +"status=no,"
    +"menubar=no,"
    +"scrollbars=" +przew+ ","
    +"resizable=no"
self.window.name='glowne';
    noweOkienko = window.open(plik_strony,'noweOkienko',ustawienia);

noweOkienko.document.close();
noweOkienko.focus();

}

//kalkulatorek
//cena*ilosc + sumwowanie
function sprawdz_form(fname) {
	i	=	0;
	suma	=	0;
	while (document.forms[fname].elements["cena_kalk["+i+"]"]) {
	//	alert(document.forms[fname].elements["cena_kalk["+i+"]"].value);
		idx = document.forms[fname].elements["ilosc["+i+"]"].value;
		suma	+=	(document.forms[fname].elements["cena_kalk["+i+"]"].value)*idx;
		i++;
	}
	document.forms[fname].elements["suma"].value	=	suma;
}

//function sprawdz_form(fname, elem_ilosc, jaka_cena) {
//	idx = document.forms[fname].elements[elem_ilosc].value;
//	alert (document.forms[fname].elements[elem_okres].options[idx].value);
//	alert (document.forms[fname].elements[elem].selectedIndex);
//	alert (document.forms[fname].elements[elem].value);
//	cena_kalk

//	Math.round((1*3*3.2)*100)/100;

//	document.forms[fname].elements[elem_cena].value = Math.round(document.forms[fname].elements[elem_ilosc].value * document.forms[fname].elements[elem_okres].options[idx].value * document.forms[fname].elements[jaka_cena].value*100)/100;

//	calc(fname);

//}

function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;

function preloadImages() {
	if (document.images) {
		up_ik_tyt_info = newImage("images/buttony/up_ik_tyt_info.gif");
		up_ik_tyt_h_wydan = newImage("images/buttony/up_ik_tyt_h_wydan.gif");
		up_ik_tyt_c_reklam = newImage("images/buttony/up_ik_tyt_c_reklam.gif");
		up_ik_tyt_f_reklam = newImage("images/buttony/up_ik_tyt_f_reklam.gif");
		up_ik_tyt_d_tech = newImage("images/buttony/up_ik_tyt_d_tech.gif");
		//up_ik_tyt_ = newImage("images/menu_left_24-over.jpg");
		preloadFlag = true;
	}
}

function checkAction () {
	if (document.search.akcja[0].checked)  {
		document.search.miesiac_od.disabled = true;
		document.search.rok_od.disabled = true;
		document.search.miesiac_do.disabled = true;
		document.search.rok_do.disabled = true;
	} else {
		document.search.miesiac_od.disabled = false;
		document.search.rok_od.disabled = false;
		document.search.miesiac_do.disabled = false;
		document.search.rok_do.disabled = false;
	}
}

function okno(){
	w = 800;
	h = 600;
	aw=800;
    ah=600;

    ustawienia=
     "left=" + (aw-w)/2 + ","
    +"top=" + (ah-h)/2 + ","
    +"screenX=" + (aw-w)/2 + ","
    +"screenY=" + (ah-h)/2 + ","
    +"width=" + w + ","
    +"height=" + h + ","
    +"innerWidth=" + w + ","
    +"innerHeight=" + h + ","
    +"toolbar=yes,"
    +"location=yes,"
    +"directories=yes,"
    +"status=yes,"
    +"menubar=yes,"
    +"scrollbars=yes,"
    +"resizable=yes"
	self.window.name='glowne';
	opcja = document.adresy_www.adresy.selectedIndex;
	adres_www =  document.adresy_www.adresy.options[opcja].value;
	plik_strony = "http://"+adres_www;

	if(opcja > 0) {
    	noweOkienko = window.open(plik_strony,'',ustawienia);
		noweOkienko.document.close();
	  	noweOkienko.focus();
	}
}

var openedLay = '';

function showLay(name) {
	  openedLay = name;
	  var agt=navigator.userAgent.toLowerCase();
	  var is_ie5 = ((parseInt(navigator.appVersion) == 4) && (agt.indexOf("msie 5.0")!=-1) && (agt.indexOf("opera") == -1));
 	  var color = '#c7c1c1';

	if (document.getElementById && !is_ie5) {
		obj=document.getElementById(name).style.visibility = "visible";
		document.getElementById(name).style.display = "block";
		document.getElementById(name).style.position = "relative";
		//tytuly
		document.getElementById(name+ "-tyt").style.visibility = "visible";
		document.getElementById(name+ "-tyt").style.display = "block";
		document.getElementById(name+ "-tyt").style.position = "relative";
		//li kolor
		document.getElementById(name+ "-li").style.backgroundColor = color;
		document.getElementById(name+ "-li").backgroundColor = color;
	} else if (document.layers) {
		 obj=document.layers[name].visibility = "show";
		 document.layers[name].display = "block";
		document.layers[name].position = "relative";
		//tytuly
		document.layers[name+ "-tyt"].visibility = "show";
		document.layers[name+ "-tyt"].display = "block";
		document.layers[name+ "-tyt"].position = "relative";
		 //li kolor
		 document.layers[name+ "-li"].backgroundColor = color;
	} else if (document.all) {
		obj=document.all[name].style.visibility = "visible";
		document.all[name].display = "block";
		document.all[name].position = "relative";
		//tytuly
		document.all[name+ "-tyt"].style.visibility = "visible";
		document.all[name+ "-tyt"].display = "block";
		document.all[name+ "-tyt"].position = "relative";
		//li kolor
		document.all[name+ "-li"].backgroundColor = color;
	} else {
		  obj=false;
	}
	if (document.getElementById(name+'-dyrwyd') != null) {
		document.getElementById(name+'-dyrwyd').style.display = "none";
	}

}

function closeLay(name) {

		openedLay = '';
		var agt=navigator.userAgent.toLowerCase();
		var is_ie5 = ((parseInt(navigator.appVersion) == 4) && (agt.indexOf("msie 5.0")!=-1) && (agt.indexOf("opera") == -1));
		var color = 'transparent';

	if (document.getElementById && !is_ie5) {
		obj=document.getElementById(name).style.visibility = "hidden";
		document.getElementById(name).style.display = "none";
		//tytuly
		document.getElementById(name+ "-tyt").style.visibility = "hidden";
		document.getElementById(name+ "-tyt").style.display = "none";
		//li kolor
		document.getElementById(name+ "-li").style.backgroundColor = color;
	} else if (document.layers) {
		 obj=document.layers[name].visibility = "hide";
		 document.layers[name].display = "none";
		 //tytuly
		 document.layers[name+ "-tyt"].visibility = "hide";
		 document.layers[name+ "-tyt"].display = "none";
		 //li kolor
		 document.layers[name+ "-li"].backgroundColor = color;
	} else if (document.all) {
		obj=document.all[name].style.visibility = "hidden";
		document.all[name].display = "none";
		//tytuly
		document.all[name+ "-tyt"].style.visibility = "hidden";
		document.all[name+ "-tyt"].display = "none";
		//li kolor
		document.all[name+ "-li"].backgroundColor = color;
	} else {
		 obj=false;
	}
	if (document.getElementById(name+'-dyrwyd') != null) {
		document.getElementById(name+'-dyrwyd').style.display = "block";
	}
}

function OpenCloseLay(name) {
	if ( (openedLay == '') || (openedLay != name) ) {
		if (openedLay != '') closeLay(openedLay);
		showLay(name);
	} else {
		closeLay(name);
	}
}

function show_dyr_wyd(id, value) {
	var lay = document.getElementById(id+'-dyrwyd');
	if (lay != null) {
		lay.innerHTML = lay.innerHTML+value+'<br />';
	}
}
