var isIE4=false;
var isNav4=false;
var isNav6=false;

function setBrowser()
{
    if (navigator.appVersion.charAt(0) == "4")
    {
        if (navigator.appName.indexOf("Explorer") >= 0) 
			isIE4 = true;
        else 
			isNav4 = true;
    }
    else if (navigator.appVersion.charAt(0) > "4")
          isNav6 = true;
    
}

function getStyleBySelector( selector )
{
    if (!isNav6)
         return null;
    
	var sheetList = document.styleSheets;
    var ruleList;
    var i, j;

    for (i=sheetList.length-1; i >= 0; i--)
    {
        ruleList = sheetList[i].cssRules;
        for (j=0; j<ruleList.length; j++)
        {
            if (ruleList[j].type == CSSRule.STYLE_RULE &&
                ruleList[j].selectorText == selector)
                return ruleList[j].style;            
        }
    }
    return null;
}

function getIdProperty( id, property )
{
    if (isNav6)
    {
        var styleObject = document.getElementById(id);
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            if (styleObject[property])
            {
                return styleObject[ property ];
            }
        }
        styleObject = getStyleBySelector( "#" + id );
        return (styleObject != null) ?
            styleObject[property] :
            null;
    }
    else if (isNav4)
    {
        return document[id][property];
    }
    else
    {
        return document.all[id].style[property];
    }
}

function setIdProperty(id, property, value)
{
   if (isNav6)
    {
        var styleObject = document.getElementById(id);
        if (styleObject != null)
        {
            styleObject = styleObject.style;
            styleObject[property] = value;
        }
    }
    else if (isNav4)
        document[id][property] = value;
    else if (isIE4)
         document.all[id].style[property] = value;
}

function changeImg(id, img)
{
	i = document.getElementById(id);
	i.src = img;
}

function Drukuj()
{
	window.print();
}

function Polec()
{
	alert('Polec');
}

function openPopup(url, name, w, h, perc,sc) 
{        
	var winX = (screen.availWidth - w)*perc*.01;        
	var winY = (screen.availHeight - h)*perc*.01;        
	popupWin = window.open(url, name,'scrollbars='+sc+',resizable=no,status=no,width=' + w + ',height=' + h + ',left=' + winX + ',top=' + winY);
	popupWin.focus()
}

function vis_block(id,nr)
{
	if (getIdProperty(id + nr, "display") != "block")
		{setIdProperty(id + nr, "display", "block"); return true;}
	else  { setIdProperty(id + nr, "display", "none"); return false;}
}

function show_all(id,il,fl) {
	for (var i=1; i<il; i++)
		if (fl) setIdProperty(id + i, "display", "none"); 
		else setIdProperty(id + i, "display", "block");
		
	return !fl;	
}


setBrowser()


