function swapImage(imageId, newSrc)
{
	document.getElementById(imageId).src = newSrc;
}

function showPhotoSimple(source)
{
	anw=window.open(source, 'w_n', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizeable=no, width=660, height=660');
	return false;
}

function toggleInputs(elem)
{
	divs=elem.getElementsByTagName('div');
	for (i=0;i<divs.length;i++)
	{
		div=divs.item(i);
		inps=div.getElementsByTagName('input');
		if (inps.length<2) {continue}
		else
		{
			if (inps.item(0).checked)
			{
				inps.item(1).disabled=false;
				inps.item(1).focus();
			}
			else
			{
				inps.item(1).disabled=true;
			}
		}
	}
}

var imageCounter;
var t;
var toSec = 4000;

function prevImage()
{
	clearTimeout(t);
	imageCounter--;
	if (imageCounter < 0) imageCounter = mainImages.length - 1;
	nextPreloader = new Asset.image(mainImages[imageCounter], {id: 'switch_image', onload: nextImage2});
	return false;
}

function nextImage()
{
	clearTimeout(t);
	imageCounter++;
	if (imageCounter >= mainImages.length) imageCounter = 0;
	nextPreloader = new Asset.image(mainImages[imageCounter], {id: 'switch_image', onload: nextImage2});
	return false;
}

function goMainAnimation() {
	banner = setInterval("setBanner()", 8000);
	t = setTimeout("nextImage()", 4000);
}

function setBanner() {
	//nextPreloader = new Asset.image('/images/main/banner/banner.gif', {id: 'switch_image', onload: nextImage2});
	
	return false;
}

function nextImage2()
{
	new Fx.Style(nextPreloader, 'opacity').set(0);
	trans = new Fx.Style('switch_image', 'opacity', {onComplete: nextImage3}).start(1,0);
}

function nextImage3()
{
	$('switch_image').replaceWith(nextPreloader);
	new Fx.Style('switch_image', 'opacity').start(0,1);
	clearTimeout(t);
	if (toSec) t = setTimeout("nextImage()", toSec);
}