function changeImg(imgName, filename)
{	im = new Image();
	im.src = filename;
	document.images[imgName].src = im.src;
}

function switchImg(imgName, filename1, filename2)
{
	i = new Image();
	im = new Image();
	i.src = filename1;
	if(document.images[imgName].src==i.src)
		im.src = filename2;
	else
		im.src = filename1;
	document.images[imgName].src = im.src;
}

function changeImgAndText(imgName, filename, textName, imgText)
{
	im = new Image();	im.src = filename;	document.images[imgName].src = im.src;
	document.getElementById(textName).innerHTML = imgText;
}

function nextImg()
{
	img_active = img_active + 1;
	if(img_active>img_max) img_active = img_max;
	changeImg('picture', pictures[img_active-1]);
}

function prevImg()
{
	img_active = img_active - 1;
	if(img_active<1) img_active = 1;
	changeImg('picture', pictures[img_active-1]);
}

function mediaViewer(img)
{
	mv = window.open("fileadmin/scripts/mediaViewer.php?i=" + escape(img),'MediaViewer','height=400,width=400,locationbar=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes,top=' + (screen.height-400)/2 + ',left=' + (screen.width-400)/2 + ',status=yes');
}

function imageViewer(img)
{
	mv = window.open("fileadmin/scripts/imageViewer.php?img=" + escape(img),'ImageViewer','height=400,width=400,locationbar=no,menubar=no,toolbar=no,scrollbars=no,resizable=yes,top=' + (screen.height-400)/2 + ',left=' + (screen.width-400)/2 + ',status=yes');
}
