function Realizacje(newId)
{
	var obiekty = new Array();
	var otwarte=0;
	var otwierane;
	var obj = document.getElementById(newId);
	var nodes = obj.childNodes;
	var animacja;
	var height=25;
	var heightOld;
	var predkosc=0;
	
	for(a=0;a<nodes.length;a++)
	{
		var node = nodes.item(a);
		if(node.tagName=='LI' && node.parentNode==obj)
		{
			obiekty[obiekty.length]=node;
		}
	}
	
	for(a=0;a<obiekty.length;a++)
	{
		if(a!=otwarte)
		{
			obiekty[a].style.height='24px';
		}
	}
	
	function animuj()
	{
		window.status=obiekty[otwierane].clientHeight+' '+obiekty[otwarte].clientHeight;
		if(obiekty[otwierane].clientHeight>24) { heightOld-=Math.round(predkosc/2); }
		obiekty[otwarte].style.height=heightOld+'px';
		
		if(obiekty[otwierane].clientHeight<172) { height+=Math.round(predkosc/2); }
		obiekty[otwierane].style.height=height+'px';
		if(predkosc>2) { predkosc-=1.9; }
		
		if(((obiekty[otwarte].clientHeight <= 43 && otwarte==0) || (obiekty[otwarte].clientHeight <= 57 && otwarte!=0) ) && obiekty[otwierane].clientHeight > 138 )
		{
			otwarte=otwierane;
			otwierane=null;
			clearInterval(animacja);
			animacja=null;
		}
	}
	
	
	function open(nr)
	{
		if(animacja==null&&otwarte!=nr)
		{
			predkosc=28;
			heightOld = 138;
			height=25;
			otwierane=nr;
			animacja = setInterval(animuj, 20);
		}
		//obiekty[nr].style.height='138px';
		
	}
	this.open = open;
}
	
function getElementsByClassName(className){
	var testClass = new RegExp("(^|\\s)" + className + "(\\s|$)");
	var elements = document.getElementsByTagName("*");
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++)
	{
		current = elements[i];
		if(testClass.test(current.className))
		{
			returnElements.push(current);
		}
	}
	return returnElements;
}

function email(before, after){return before+'@'+after}

function zamienEmail(id)
{
	try {
		objA = document.createElement('a');
		objText = document.createTextNode(email('mail','procod.pl'));
		objA.setAttribute('href','mailto:'+email('mail','procod.pl'));
		objA.appendChild(objText);
		objDD = document.getElementById(id);
		child = objDD.firstChild;
		objDD.removeChild(child);
		objDD.appendChild(objA);
	} catch (e) {alert(e)};
}

function addSpan()
{
	var elements = getElementsByClassName('addSpan');
	var length = elements.length;
	var current;
	var newNode;
	for(var i=0; i<length; i++)
	{
		current = elements[i];
		try
		{
			newNode = document.createElement('span');
			current.appendChild(newNode);
		}
		catch (e) {alert(e)}
	}
	zamienEmail('insertEmail');
}
