

var initialtab=[1, '@PAGE_ACTIVE']
var turntosingle=0 //0 for no (default), 1 for yes
var disabletablinks=0 //0 for no (default), 1 for yes

var previoustab=""
if (turntosingle==1)
document.write('<style type="text/css">\n#tabcontentcontainer{display: none;}\n</style>')

var hilight;
function change(id, newClass, oldClass) {
	identity=document.getElementById(id);
	
	if (hilight) {
		oldidentity=document.getElementById(hilight);
		oldidentity.className=oldClass;
	}
	
	identity.className=newClass;
	hilight = id;
}

function expandcontent(cid, class1, class2) {
	change('tab_'+cid, class1, class2)

	// if (disabletablinks==1)
	// aobject.onclick=new Function("return false")
	if (document.getElementById) {
		// highlighttab(aobject)
		if (turntosingle==0){
			if (previoustab!="")
				document.getElementById(previoustab).style.display="none"
			document.getElementById(cid).style.display="block"
			previoustab=cid
		}
	}
}

function collecttablinks(){
	var tabobj=document.getElementById("tablist")
	tabobjlinks=tabobj.getElementsByTagName("A")
}


function popup(url, width,height) { 
	window.open(url, '', "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=auto, resizable=yes,copyhistory=no,width="+width+",height="+height); return false;
}

function NewWindow(url, width, height) {
	return window.showModalDialog(url, '',"dialogWidth:"+width+"px;dialogHeight:"+height+"px;help:no;status:no;scroll:no;resizable:no;");
}

function pot(pytanie, url) {
	if ( confirm(pytanie))
   		window.location.href=url;
	else
		return false;
}


function zaokr(liczba) {
	liczba = liczba * 100;
	var wynik = Math.round(liczba)/100;
	return wynik;
}

function str_repeat(i, m) {
for (var o = ''; m-- > 0; o += i);
return o;
}

function EditComment(id) {
	NewWindow('/sp2/?option=commentedit&id='+id, 900, 400);

}

function EditMaterial(id) {
	NewWindow('/sp2/?option=edit&id='+id, 900, 700);

}

function AddMaterial(idcategory) {
	NewWindow('/sp2/?option=add&idcategory='+idcategory, 900, 700);

}

function EditDialog(option, p1, p2) {
	NewWindow('/sp2/?option='+option+'&p1='+p1+'&p2='+p2, 900, 700);

}
