function showPopup(URLtoOpen, windowName, width, height) 
{
	if(myLightWindow)
	myLightWindow.activateWindow({
		href: URLtoOpen, 
		title: windowName, 
		caption: windowName,
		width:width,
		height:height
		});
}

function onEditorInit(instance) 
{
	if(instance.formElement.id == 'articleEditor')
	{
		var form = document.getElementById('articleEditForm');
		var waitSymbol = document.getElementById('waitSymbol');
		var originalContent = document.getElementById('originalContent');
		if(form)
			form.style.display='block';
		if(waitSymbol)
			waitSymbol.style.display='none';
//		alert(getComputedHeight('originalContent'));
		if(originalContent)
			originalContent.style.display='none';
		return;
	}
}

/**
src: http://www.bytemycode.com/snippets/snippet/298/
**/
function getComputedHeight(theElt){
	var browserName=navigator.appName;
	if (browserName=="Microsoft Internet Explorer"){
		var is_ie=true;
	} else {
		var is_ie=false;
	}
//	if(is_ie){
		tmphght = document.getElementById(theElt).offsetHeight;
/*	}
	else{
		docObj = document.getElementById(theElt);
		var tmphght1 = document.defaultView.getComputedStyle(docObj, null).getPropertyValue("height");
		tmphght = tmphght1.split('px');
		tmphght = tmphght[0];
	}*/
	return tmphght;
}

function showRights(username)
{
	if(!Rules)
		return;
	var rights = document.getElementById('rights');
	rights.options.length = 0;
	if(Rules[username])
		for(var i = 0; i < Rules[username].length; i++)
		{
			var option = document.createElement('option');
			option.text = Rules[username][i]['data'];
			option.value = Rules[username][i]['id'];
			rights.add(option, null);
		}
	if(Rules[username].length == 0)
	{
		var option = document.createElement('option');
		option.text = '--Brak dostępu--';
		option.value = 0;
		rights.add(option, null);
	}
	var rightsPanel = document.getElementById('rightsPanel');
	if(rightsPanel)
		rightsPanel.style.display = 'block';
}

function closeBanner(banner_name)
{
	var banner = document.getElementById(banner_name);
	if(banner)
		banner.style.display='none';
}

function showSubpage(page)
{
	if(!Subpages)
		return;
	var subpages = document.getElementById('subpages');
	subpages.options.length = 0;
	if(page == 0)
		return;
	var option = document.createElement('option');
	option.text = 'Wszystkie';
	option.value = 0;
	subpages.add(option, null);
	if(Subpages[page])
		for(var i = 0; i < Subpages[page].length; i++)
		{
			var option = document.createElement('option');
			option.text = Subpages[page][i]['data'];
			option.value = Subpages[page][i]['id'];
			subpages.add(option, null);
		}
}
