
function on_menu_field(co){document.getElementById(co).style.color='#66FF00';}
function off_menu_field(co){document.getElementById(co).style.color='#D1E3FA';}
function on_menu(){menu.style.visibility='visible';}
function off_menu(){menu.style.visibility='hidden';}

function addbookmark(bookmarkurl,bookmarktitle){
if (document.all)
window.external.AddFavorite(bookmarkurl,bookmarktitle)
} 

function search(){
	if (F1.search.value!='')	{
		var search = F1.search.value;
		adres="index.php?search="+search;
		window.location.href = adres;
	}
}

function nws_add(){
	if (F2.email.value!='')	{
		adres="index.php?kat="+kat+"&id="+id+"&action=add_"+F2.email.value;
		window.location.href = adres;
	}
}

function nws_remove(){
	if (F2.email.value!='')	{
		adres="index.php?kat="+kat+"&id="+id+"&action=rem_"+F2.email.value;
		window.location.href = adres;
	}
}

function menuclick(co){// kliknięcie na rozwijanym menu
	t=new String("");
	t=menu.style.left;
	t=t.substring(0,t.length-2);
	r=parseInt(t);

	u=parseInt(get_position(document.getElementById('a2')));
	a=parseInt((r-u)/145);
	
	if (a==0) kat= parseInt(co) + 2
	if (a==1) kat= parseInt(co) + 8
	if (a==2) kat= parseInt(co) + 16
	
	menu.style.visibility='hidden';
	mouseclicka(co);
	go_to(0);
}

function mouseclick(co) {
	if (co==15){ // forum otwieramy w nowym oknie
		window.open('forum/','','');
		}
	else {
		if (kat!=co){first=0}
		kat=co;
		sprzet=0;
		document.getElementById("pic").src="images/index_12_b0.jpg";
		go_to(0);
	}
}
function left_menu_click(co){ // kliknięcie na lewym menu
	if ((kat==14) || (kat>=17 && kat<22)){
		adres="index.php?id=0&kat="+(parseInt(co)+parseInt(16));
	} else {adres="index.php?id=0&kat=99&sp="+co;}
	window.location.href = adres;
}
function mouseclicka(co){
	document.getElementById("pic").src="images/index_12_b"+co+".jpg";
	sprzet=co;
	for (i=1;i<6 ;i++ ){
		if (i==co){
			document.getElementById('b'+i).style.color="#66FF00";}
		else{ document.getElementById('b'+i).style.color="#c8c8c8";}
	}
}

function off(co) {
	document.getElementById(co).style.backgroundImage = "url(images/index_04.jpg)";
	document.getElementById(co).style.color ="#dddddd";
	menu.style.visibility='hidden';
}

function on(co)  {// przesunięcie myszki nad poziome menu główne
przycisk=document.getElementById(co);
przycisk.style.backgroundImage = "url(images/index_04a.jpg)";
przycisk.style.color="#aaaaaa";
if (co=='a2'||co=='a3'||co=='a4'){
	pos=get_position(przycisk);
	menu.style.left=pos[0];	
	menu.style.top=pos[1]+22;
	menu.style.visibility='visible';
	}		
}

function get_position(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
	curleft = obj.offsetLeft;
	curtop = obj.offsetTop;
	while (obj = obj.offsetParent) {
		curleft += obj.offsetLeft;
		curtop += obj.offsetTop;
		}
	}
return [curleft,curtop];
}
function ona(co) {if (sprzet!=co)  document.getElementById('b'+co).style.color="#ffffff";
}
function offa(co) {
	if (sprzet==co)
		{document.getElementById('b'+co).style.color ="#66FF00"	}
	else {document.getElementById('b'+co).style.color ="#c8c8c8"}
}
function go_to(art){
	adres="index.php?kat="+kat+"&id="+art;
	if (kat==99)	{adres=adres+"&sp="+sp;	};
	if (first!=0)	{adres=adres+"&f="+first;	};
	window.location.href = adres;
}
function ulubione(){
	var nazwa = 'Komputerki - małe jest piękne';
	var url = 'http://www.komputerki.pl';
	if (window.external) window.external.AddFavorite(url, nazwa)
	if (window.sidebar) window.sidebar.addPanel(nazwa, url, "");
}