var document_all;

if(document.all) document_all=true;
else document_all=false;

//funkcje do podmiany zdjec
function fon(n){document.images[n].src='grafika/'+n+'1.gif';}
function foff(n){document.images[n].src='grafika/'+n+'.gif';}

//funkcja do wyswietlania popupu
var okno_pop='';
function popup(wi,he,uerel,alignx,aligny,scrol)
{
	// Bartosz Szczecinski
  // 20.04.2006
  // Opera 8.x nie obsluguje !okno_pop.closed
	if(okno_pop && okno_pop.closed==false) {
  	okno_pop.close()
  }
	if(wi=='100%'){wi=screen.availWidth-30}
	if(he=='100%'){he=screen.availHeight-0}
	if(alignx=='left'){xx=0}
	else if(alignx=='right'){xx=(screen.availWidth-wi)-10}
	else{xx=(screen.availWidth-wi)/2}
	if(aligny=='top'){yy=0}
	else if(aligny=='bottom'){yy=(screen.availHeight-he)}
	else{yy=(screen.availHeight-he)/2}
	okno_pop=window.open(uerel, '_blank', 'scrollbars='+scrol+',height='+he+',width='+wi+',top='+yy+',left='+xx);
}

function blurall() {
	var links = document.getElementsByTagName('a');
	for (var i=0;i<links.length;i++){
		links[i].onfocus = blurme;
  	}
}

function blurme()
{
	this.blur();
}


function printversion(id,path)
{
	var okno='';
	(okno && !okno.closed)?okno.close():'';
	he=400;
    wi=730;
	xx=(screen.availHeight-he)/2-10;
	yy=(screen.availWidth-wi)/2;
	okno=window.open('print_version.php?id='+id, '_blank', 'menubar=yes,scrollbars=yes,height='+he+',width='+wi+',top='+xx+',left='+yy);
}


/*ladowanie do casch-u zdjec
foto=new Array('pl','en');
menuA=new Array();menuB=new Array();
for(n=0;n<foto.length;n++){
	menuA[n]=new Image();
	menuA[n].src='grafika/'+foto[n]+'.gif';
	menuB[n]=new Image();
	menuB[n].src='grafika/'+foto[n]+'1.gif';
}
*/

function changeKonfiguratorTab(id,action)
{
	if(document_all) var klasa=document.getElementById(id).className;
	else var klasa=document.getElementById(id).getAttribute("class");
	var parent=document.getElementById('konfigurator');
	
	/*
	var form=document.getElementById(id.replace("konfigurator_","form_"));
	alert(form.action);
	form.action='sklep/' + action;
	*/

	if(!klasa)
	{
	
	for(i=0;i<parent.childNodes.length;i++)
	{
		if(parent.childNodes[i].tagName=='DIV')
		{
			if(parent.childNodes[i].className=='konfigurator_box_hide' || parent.childNodes[i].className=='konfigurator_box_show')
			{
				if(document_all) parent.childNodes[i].className="konfigurator_box_hide";
				else parent.childNodes[i].setAttribute("class","konfigurator_box_hide");
			}
		}
	}
	
	if(document_all) document.getElementById(id + '_box').className="konfigurator_box_show";
	else document.getElementById(id + '_box').setAttribute("class","konfigurator_box_show");
		
	var ul=document.getElementById(id).parentNode.parentNode;	
		for(i=0;i<ul.childNodes.length;i++)
		{
			if(ul.childNodes[i].tagName=='LI')
			{
			if(document_all) ul.childNodes[i].childNodes[0].className="";
			else ul.childNodes[i].childNodes[0].removeAttribute("class");
			}
		}

	if(document_all) document.getElementById(id).className="active";
	else document.getElementById(id).setAttribute("class","active");
	}
}

function temp_chart(id,value,file)
{
var item_id=id.replace("dodatkowe_wyposazenie_item_","");
var adres='';

	if(value==true) adres = 'produkt/' + file + '?add_to_temp_chart=' + item_id;
	else adres = 'produkt/' + file + '?del_from_temp_chart=' + item_id;

	document.location.href = adres.replace('produkt/produkt/','produkt/');
}

