function zliczdlugosc(wejscie,wyjscie,dlugosc)
{
	aktualnadlugosc = document.getElementById(wejscie).value.length;
	pozostaloznakow = dlugosc-aktualnadlugosc;
	document.getElementById(wyjscie).innerHTML = pozostaloznakow;
	if (aktualnadlugosc>=dlugosc)
	{
		document.getElementById(wejscie).value = document.getElementById(wejscie).value.substr(0,dlugosc);
	}
}
function modyfikujnews(id)
{
	var url = 'index.php?form=modifynews&id='+id;
	var posx = screen.width/2-400;
	var posy = screen.height/2-300;
	window.open(url,'modyfikujnews','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
}
function usunnews(id)
{
	var checker = confirm("Czy na pewno chcesz usunac news?\n Operacja jest nieodwracalna!");
	if (checker)
	{
		var url = 'index.php?action=delnews&id='+id;
		var posx = screen.width/2-200;
		var posy = screen.height/2-150;
		window.open(url,'usunnews','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=400,height=300');
	}
}
function modyfikujnews2(id)
{
	var url = 'index.php?form=modifynews2&id='+id;
	var posx = screen.width/2-400;
	var posy = screen.height/2-300;
	window.open(url,'modyfikujnews2','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
}
function usunnews2(id)
{
	var checker = confirm("Czy na pewno chcesz usunac news?\n Operacja jest nieodwracalna!");
	if (checker)
	{
		var url = 'index.php?action=delnews2&id='+id;
		var posx = screen.width/2-200;
		var posy = screen.height/2-150;
		window.open(url,'usunnews2','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=400,height=300');
	}
}
function modyfikujimpreze(id)
{
	var url = 'index.php?form=modifyparty&id='+id;
	var posx = screen.width/2-400;
	var posy = screen.height/2-300;
	window.open(url,'modyfikujimpreze','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
}
function usunimpreze(id)
{
	var checker = confirm("Czy na pewno chcesz usunac imprezę?\n Operacja jest nieodwracalna!");
	if (checker)
	{
		var url = 'index.php?action=delparty&id='+id;
		var posx = screen.width/2-200;
		var posy = screen.height/2-150;
		window.open(url,'usunimpreze','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=400,height=300');
	}
}
function modyfikujgalerie(id)
{
	var url = 'index.php?form=modifygallery&id='+id;
	var posx = screen.width/2-400;
	var posy = screen.height/2-300;
	window.open(url,'modyfikujgalerie','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
}
function usungalerie(id)
{
	var checker = confirm("Czy na pewno chcesz usunąć galerię?\n Operacja jest nieodwracalna!");
	if (checker)
	{
		var url = 'index.php?action=delgallery&id='+id;
		var posx = screen.width/2-200;
		var posy = screen.height/2-150;
		window.open(url,'usungalerie','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=400,height=300');
	}
}
function addphoto()
{
	index = document.getElementById('addphoto_gallery').selectedIndex;
	value = document.getElementById('addphoto_gallery').options[index].value;
	if (value==0)
	{
		alert('Wybierz galerię!');
	}
	else
	{
		document.getElementById('addphotoform').submit();
	}
}
function listphoto()
{
	index = document.getElementById('listphoto_gallery').selectedIndex;
	value = document.getElementById('listphoto_gallery').options[index].value;
	if (value==0)
	{
		alert('Wybierz galerię!');
	}
	else
	{
		document.getElementById('listphotoform').submit();
	}
}
function delphoto(id)
{
	var checker = confirm("Czy na pewno usunąć zdjęcie?\nOperacja jest nieodwracalna!");
	if (checker)
	{
		var url = 'index.php?action=delphoto&id='+id;
		var posx = screen.width/2-400;
		var posy = screen.height/2-300;
		window.open(url,'usunzdjecie','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
	}
}
function modifyphoto(id)
{
	document.location = './index.php?form=modifyphoto&id='+id;
}
function delmovie(id)
{
	var checker = confirm("Czy na pewno usunąć film?\nOperacja jest nieodwracalna!");
	if (checker)
	{
		var url = 'index.php?action=delmovie&id='+id;
		var posx = screen.width/2-400;
		var posy = screen.height/2-300;
		window.open(url,'usunfilmik','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
	}
}
function showmovie(id)
{
	var url = '../showmovie.php?id='+id;
	var posx = screen.width/2-400;
	var posy = screen.height/2-300;
	window.open(url,'showmovie','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
}
function usundj(id)
{
	var checker = confirm("Czy na pewno usunąć DJ'a?\nOperacja jest nieodwracalna!");
	if (checker)
	{
		var url = 'index.php?action=deldj&id='+id;
		var posx = screen.width/2-400;
		var posy = screen.height/2-300;
		window.open(url,'usundja','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
	}
}
function modyfikujdj(id)
{
		var url = 'index.php?form=modifydj&id='+id;
		var posx = screen.width/2-400;
		var posy = screen.height/2-300;
		window.open(url,'modifydj','scrollbars=no,toolbar=no,left='+posx+',top='+posy+',width=800,height=600');
	
}