function toggle(item)
{
	ok = document.getElementById ? 1 : 0;
	if(ok)
	{
		obj=document.getElementById(item);
		visible=(obj.style.display!="none");
		key=document.getElementById("x_" + item);
		if(visible)
		{
			obj.style.display="none";
			key.innerHTML="<img src='img/closed.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
		}
		else
		{
			obj.style.display="block";
			key.innerHTML="<img src='img/opened.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
		}
	}
}

function remove_blanks(str)
{
	var result="";
	var i;
	var ch;
	for (i=0; i<str.length; ++i)
	{
		ch=str.charAt(i);
		if(ch!=" ")
			result += ch;
	}
	return result;
}

function scan_in()
{
	ok = document.getElementById ? 1 : 0;
	if(ok)
	{
		var iksy = document.getElementsByTagName("a");

		for(i=0; i<iksy.length; i++)
		{
			if(iksy[i].id.indexOf('x_')==0)
			{
				div_name = iksy[i].id.substr(2,iksy[i].id.length-2);
				visible=(document.getElementById(div_name).style.display!="none");
				if(visible)
				{
					iksy[i].innerHTML="<img src='img/opened.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
				}
				else
				{
					iksy[i].innerHTML="<img src='img/closed.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
				}
			}
		}


		var cook = remove_blanks(document.cookie);
		var splitValues;
		var pa = cook.split(";");
		for(j=0; j<pa.length; j++)
		{
			splitValues = pa[j].split("=");
			if(splitValues[0].indexOf("menu_")==0)
			{
				div_name = splitValues[0].substr(5,splitValues[0].length-5);
				obj = document.getElementById(div_name);
				x = document.getElementById("x_"+div_name);
				visible = (splitValues[1]=="true") ? 0 : 1;
				if(visible)
				{
					obj.style.display = "none";
					x.innerHTML = "<img src='img/closed.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
				}
				else
				{
					obj.style.display = "block";
					x.innerHTML = "<img src='img/opened.gif' width='11' height='11' hspace='0' vspace='0' border='0'>";
				}
			}
		}
	}
}

function scan_out()
{
	ok = document.getElementById ? 1 : 0;
	if(ok)
	{
		var iksy = document.getElementsByTagName("a");
		for(i=0; i<iksy.length; i++)
		{
			if(iksy[i].id.indexOf('x_')==0)
			{
				div_name = iksy[i].id.substr(2,iksy[i].id.length-2);
				visible=(document.getElementById(div_name).style.display!="none");
				cook = "menu_"+div_name+"="+visible;
				document.cookie = cook;
			}
		}
	}
}

function getMenuPos()
{
	var paramExpressions;
	var param;
	var val;
	paramExpressions = window.location.search.substr(1).split("&");
	for(i=0; i<paramExpressions.length; i++)
	{
		param = paramExpressions[i].split("=");
		if(param[0] == "menupos")
		{
			return param[1];
		}
	}
	return "";
}

function nowe_okno(x,y,url)
{
	var no = window.open(url,'no','height='+y+',width='+x+',scrollbars=yes,resizable=yes');
	no.focus();
}

function obr(url)
{
	var no2 = window.open('','no2','height=100,width=100,resizable=yes');
	no2.document.write('<html><title>ELDAR</title><body topmargin="10" leftmargin="10" bgcolor="#FFFFFF">');
	no2.document.write('<img src="img/'+url+'" border="0">');
	no2.document.write('</body></html>');
	no2.document.close();
	no2.resizeTo(no2.document.images[0].width+35,no2.document.images[0].height+50);
	no2.focus();
}

function redir()
{
	wyb1 = document.prod_form.wyb1.value;
	wyb2 = document.prod_form.wyb2.value;
	sg = "index.php?strona=";
	if(wyb2=="unit")
		top.location.href = sg+"unitronics/1";
	if(wyb2=="lika")
		top.location.href = sg+"lika/1";
	if(wyb2=="sh")
		top.location.href = sg+"sh/1";
	if(wyb2=="tops")
		top.location.href = sg+"topsccc/1";
	if(wyb2=="santerno")
		top.location.href = sg+"santerno/1";


	if(wyb1=="plc")
		top.location.href = sg+"unitronics/1";
	if(wyb1=="sys_kont_pom")
		top.location.href = sg+"topsccc/1";
	if(wyb1=="enk_inkr")
		top.location.href = sg+"lika/enkodery_inkrementalne_opis";
	if(wyb1=="enk_abs")
		top.location.href = sg+"lika/enkodery_absolutne_opis";
	if(wyb1=="enk_mag")
		top.location.href = sg+"lika/enkodery_magnetyczne_opis";
	if(wyb1=="enk_akces")
		top.location.href = sg+"lika/enkodery_akcesoria_opis";
	if(wyb1=="sprzeg")
		top.location.href = sg+"lika/sprzegla_opis";
	if(wyb1=="pozyc")
		top.location.href = sg+"lika/pozycjonery_opis";
	if(wyb1=="link")
		top.location.href = sg+"lika/linkowe_opis";
	if(wyb1=="lin_mag")
		top.location.href = sg+"lika/tasmy_magn_opis";
	if(wyb1=="lin_abs")
		top.location.href = sg+"lika/tasmy_magn_abs_opis";
	if(wyb1=="odczyty")
		top.location.href = sg+"lika/wyswietlacze_opis";
	if(wyb1=="lin_opt")
		top.location.href = sg+"sh/linialy_opis";
	if(wyb1=="cnc")
		top.location.href = sg+"sh/cnc_opis";
	if(wyb1=="falowniki")
		top.location.href = sg+"santerno/falowniki";
	if(wyb1=="softstarty")
		top.location.href = sg+"santerno/softstarty";
	if(wyb1=="konwertery")
		top.location.href = sg+"santerno/konwertery_acdc";
	if(wyb1=="serwonapedy")
		top.location.href = sg+"santerno/serwonapedy";
	if(wyb1=="silniki_asyn")
		top.location.href = sg+"santerno/silniki_asynchroniczne";
	if(wyb1=="asyn_silniki_wekt")
		top.location.href = sg+"santerno/asynchr_silniki_wektorowe";
	if(wyb1=="serwomotory")
		top.location.href = sg+"santerno/serwomotory";
	if(wyb1=="remotedrive")
		top.location.href = sg+"santerno/remote_drive";

}

function validate_form(form_)
{
	if ((form_.firma.value == null || form_.firma.value == "") || (form_.tel.value == null || form_.tel.value == "") || (form_.ulica.value == null || form_.ulica.value == "") || (form_.kod.value == null || form_.kod.value == "") || (form_.miasto.value == null || form_.miasto.value == ""))
	{
		alert("Należy wypełnić wszystkie pola wyróżnione na czerwono!");
		return false;
	}
	return true;
}