document.onload = tryInit();

function redirect(url)
{
	window.location = url;
	return false;
}

function getElementsByClassName(cn)
{
	var arr = new Array(); 
	var els = document.getElementsByTagName("*");
	var exp = new RegExp("^(.* )?"+cn+"( .*)?$", "g");
	
	for (var i = 0; i < els.length; i++ )
	{
		if (exp.test(els[i].className))
		{
			arr.push(els[i]);
		}
	}
	
	return arr;
}

function tryInit()
{
	var pageLoaded = window.onload;
	
	window.onload = function()
	{
		if (pageLoaded)
		{
			try
			{
				pageLoaded();
			} catch(e) {
				;
			}
		}
		this.initElements();
	}
}

function initElements()
{
	var nofocus = getElementsByClassName('nofocus');
	if(nofocus.length>0)
	{
		for (i = 0; i < nofocus.length; i++)
		{
			nofocus[i].onclick = function()
			{
				this.blur();
			}
		}
	}

	var chlangpl = document.getElementById('ch-lang-pl');
	if(chlangpl != null)
	{
		chlangpl.onmouseover = function() { this.src = './gfx/flag_pl_mo.jpg'; }
		chlangpl.onmouseout = function() { this.src = './gfx/flag_pl.jpg'; }
	}

	var chlangen = document.getElementById('ch-lang-en');
	if(chlangen != null)
	{
		chlangen.onmouseover = function() { this.src = './gfx/flag_en_mo.jpg'; }
		chlangen.onmouseout = function() { this.src = './gfx/flag_en.jpg'; }
	}
	
	
	//var h = document.getElementById('footer').offsetHeight;
	//alert('h = ' + h);
	//alert(' y = ' + window.self.height  );
	//setTimeout('startMilkbox()', 250);
}

function startMilkbox()
{
	Milkbox = new Milkbox();
}

function showImportInfo(id)
{
	var info;
	var link;
	
	var i;
		
	for(i=1; i<11; i++)
	{
		info = document.getElementById('import-info-' + i);
		link = document.getElementById('import-link-' + i);
			
		if(info != null)
		{
			info.style.display = 'none';
		}
		if(link != null)
		{
			link.className = '';
		}
	}
		
	info = document.getElementById('import-info-' + id);
	link = document.getElementById('import-link-' + id);
		
	if(info != null)
	{
		info.style.display = 'block';
	}
	if(link != null)
	{
		link.className = 'aktual';
	}
	
}

function poczta(login,domena,temat)
{
  link="mailto:"+login+"@"+domena+"?subject="+temat;
  window.location=link;
}


/*
window.addEvent('domready', function()
{
	setTimeout('setMenuDisplay()', 1000);
});

function setMenuDisplay()
{
	var sectionSell = document.getElementById('menu-section-sell');
	var sectionRent = document.getElementById('menu-section-rent');
		
	sectionSell.style.display = 'block';
	sectionRent.style.display = 'block';
}
*/
