﻿function stopScroll()
{
	document.getElementById('slideshow').setAttribute('scrollamount','1');
}

function startScroll()
{
	document.getElementById('slideshow').setAttribute('scrollamount','4');
}


function showImage(imgSrc,imgTitle,imgDesc,imgWidth,imgHeight)
{
	var extWidth = parseInt(imgWidth)+6;
	window.location.hash = "#1";
	window.location.hash = "#2";
	window.location.hash = "#3";
	document.getElementById('shaderBox').className = "imageBackground";
	document.getElementById('imageView').className = "imageOverlay";
	document.getElementById('imageView').innerHTML = "<a class='closetag' href='javascript:closeImage();'>&nbsp;&nbsp;close&nbsp;&nbsp;</a><img class='galleryImage' src='gallery/"+imgSrc+"' width='"+imgWidth+"' height='"+imgHeight+"' onclick='javascript:closeImage();'><div class='galleryTitle' style='width:"+extWidth+"px;margin:0 auto;'>"+imgTitle+"</div><div class='galleryCaption' style='width:"+extWidth+"px;margin:0 auto;'>"+imgDesc+"</div>";
}

function showImageNew(imgCount,flagBackground)
{
	//closeImage();

	var imgSrc = imgArray[imgCount] [0]
	var imgTitle = imgArray[imgCount] [1]
	var imgDesc = imgArray[imgCount] [2]
	var imgWidth = imgArray[imgCount] [3]
	var imgHeight = imgArray[imgCount] [4]
	
	var extWidth = parseInt(imgWidth)+6;
	window.location.hash = "#.";
	window.location.hash = "#-";
	window.location.hash = "# ";
	
	if (flagBackground==1)
	{
		document.getElementById('shaderBox').className = "imageBackground";
		document.getElementById('imageView').className = "imageOverlay";
	}
	
	var headerTags = "<div class='topbar'>";
	if(imgCount>0)
	{
		headerTags = headerTags + "<a class='closetag' title='previous' href='javascript:showImageNew("+(imgCount-1)+",0);'>&nbsp;&lt;&nbsp;&lt;&nbsp;</a>&nbsp;";
	} else {
		headerTags = headerTags + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	}
	headerTags = headerTags + "<a class='closetag' title='close' href='javascript:closeImage();'>&nbsp;&nbsp;close&nbsp;&nbsp;</a>";
	if(imgArray.length>(imgCount+1))
	{
		headerTags = headerTags + "&nbsp;<a class='closetag' title='next' href='javascript:showImageNew("+(imgCount+1)+",0);'>&nbsp;&gt;&nbsp;&gt;&nbsp;</a>";	
	} else {
		headerTags = headerTags + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	}
	document.getElementById('imageView').innerHTML = headerTags+"</div><img class='galleryImage' src='gallery/"+imgSrc+"' width='"+imgWidth+"' height='"+imgHeight+"' onclick='javascript:closeImage();' alt='click on the image to close' title='click on the image to close'><div class='galleryTitle' style='width:"+extWidth+"px;margin:0 auto;'>"+imgTitle+"</div><div class='galleryCaption' style='width:"+extWidth+"px;margin:0 auto;'>"+imgDesc+"</div>";
}


function closeOn() {
	document.getElementById('closeWindow').src='images/close-window-on.gif';
	document.body.style.cursor = 'pointer';
}

function closeOff() {
	document.getElementById('closeWindow').src='images/close-window-off.gif';
	document.body.style.cursor = 'auto';
}

function bigPicture(active,thumbId,position) {
	if(active=="on") {
		document.body.style.cursor = 'pointer';
		document.getElementById(thumbId).style.zIndex=100;
		document.getElementById(thumbId).style.width='80px';
		document.getElementById(thumbId).style.height='80px';
		document.getElementById(thumbId).style.border='4px #DDDD99 solid';
		switch (position) {
			case 'left':
				document.getElementById(thumbId).style.marginLeft='-8px';
				document.getElementById(thumbId).style.marginTop='-8px';
				break;
			case 'middle':
				document.getElementById(thumbId).style.marginLeft='-4px';
				document.getElementById(thumbId).style.marginRight='-4px';
				document.getElementById(thumbId).style.marginTop='-8px';
				break;
			case 'right':
				document.getElementById(thumbId).style.marginRight='-8px';
				document.getElementById(thumbId).style.marginTop='-8px';
				break;
		}
	} else {
		document.body.style.cursor = 'auto';
		document.getElementById(thumbId).style.zIndex=10;
		document.getElementById(thumbId).style.width='80px';
		document.getElementById(thumbId).style.height='80px';
		document.getElementById(thumbId).style.margin='0';
		document.getElementById(thumbId).style.border='none';
	}
}

function closeImage()
{
	document.getElementById('shaderBox').className = "hidden";
	document.getElementById('imageView').className = "hidden";
} 

function confirmEmail()
{
	var formEmail = document.contactform.email.value;
	formEmail = formEmail.replace(/ /g,"");
	if (formEmail=="")
	{
		return false;
	}
	var promptEmail = prompt('Please re-enter your e-mail address to confirm\n'+formEmail);
	if (promptEmail==null)
	{
		return false;
	} else {
		if (promptEmail==formEmail)
		{
			document.contactform.submit();
		} else {
			alert('Please check your email address and try again.\nForm email: '+formEmail+'\nConfirmation email: '+promptEmail);
			return false;
		}
	}
}

