function $(id)
{
	return document.getElementById(id);
}

function showElement(elementID, show)
{
    var domObj = $(elementID);
    if (domObj != undefined && domObj != null)
        if (show)
            domObj.style.display = "block";
        else
            domObj.style.display = "none";
}


function showTab(tabControlContainerID, activeTab, check)
{
	var activeTabID = tabControlContainerID+activeTab;
	if (!$(activeTabID))
		return;
	var parent = $(activeTabID).parentNode.parentNode;
		
	
    for (var i=0;i<=parent.childNodes.length;i++)
    {
		var node = $(tabControlContainerID+i);
		if (node == null)
			continue;
        var tabName = tabControlContainerID+i;

        if (tabName != activeTabID)        
            showElement(tabName, false);
        else
        {
        	if (check == undefined || !check)
        	{
		        ecBlock = document.getElementById(tabName);        
		        if (ecBlock != undefined && ecBlock != null)
		        {
		        	var style = "";
		            if (ecBlock.currentStyle)
		            	style = ecBlock.currentStyle.display;
			        else if (window.getComputedStyle)
		          		 style = document.defaultView.getComputedStyle(ecBlock,null).getPropertyValue("display");
		
		            if (style == "none" || style == null || style == "")
		                ecBlock.style.display = "block";
		            else if (style == "block")
		                ecBlock.style.display = "none";
		            else
		                ecBlock.style.display = "block";
		        }        	
        	}
        	else
            	showElement(tabName, true);
        }
    }                    
}
function expandCollapse(name)
{
    var elem = name + "BlockID";
        ecBlock = document.getElementById(elem);        
        if (ecBlock != undefined && ecBlock != null)
        {
        	var style = "";
            if (ecBlock.currentStyle)
            	style = ecBlock.currentStyle.display;
	        else if (window.getComputedStyle)
          		 style = document.defaultView.getComputedStyle(ecBlock,null).getPropertyValue("display");

            if (style == "none" || style == null || style == "")
                ecBlock.style.display = "block";
            else if (style == "block")
                ecBlock.style.display = "none";
            else
                ecBlock.style.display = "block";
        }
}

function setTabInfo(name, text)
{
    var elem = name + "BlockID";            
    var param2 = name + "TextID";
    var param3 = name + "ImageID";
    
    var bElement = document.getElementById(param2);
    var bImageElement = document.getElementById(param3);            
    var ecBlock = document.getElementById(elem);
    
    var style = "", br="";
    if (ecBlock.currentStyle)
        style = ecBlock.currentStyle.display;
    else
    {
        style = document.defaultView.getComputedStyle(ecBlock,null).getPropertyValue("display");
        br = "ff";
    }   
    if ((ecBlock != undefined && ecBlock != null) && (style == "none" || style == null || style == ""))
    {
        if (br == "ff")
            bElement.innerHTML = "Pokaz "+text;
        else
            bElement.innerText = "Pokaz "+text;
        bImageElement.src="img/down.png";
    }
    else
    {
        if (br == "ff")
            bElement.innerHTML = "Ukryj "+text;
        else
            bElement.innerText = "Ukryj "+text;
        bImageElement.src="img/up.png";
    }
    bImageElement.border="0";
}