// JavaScript Document for Megabyte Graphics Seminar 3


//this function is used to reset the form input fields when the user clicks the cancel button - pg 476

function clearField(obj) {
	if (obj.defaultValue==obj.value) obj.value = '';
}

//this function is used to determine the page's visible dimensions pg 318
function findLivePageWidth() {
	if (window.innerWidth)
		return window.innerWidth;
	if (document.body.clientWidth)
		return document.body.clientWidth;
	return (null);
}
//this function is used to identify the objects that will be changing pg 542. It is applied to the gallery page
function initSlides() {
	objectSlide=document.getElementById('slide');
	objectCover=document.getElementById('cover');
	objectPhotoSlide=document.getElementById('photoSlide');
}

//this function is used to display the gallery images in a larger view with the cover layer in the background to dim out the background - pg 543
function showSlide(evt) {
	objectPhotoSlide.innerHTML='<img src="' + evt.src +'" id="largePhoto"  alt="Large Photo" border="0" />';
	objectPhotoSlide.innerHTML+='<p>' + evt.alt +'</p>';
	objectLargePhoto=document.getElementById('largePhoto');
	livePageWidth = findLivePageWidth();
	newLeft = ((livePageWidth/2)-8) - (200);
	objectSlide.style.left = newLeft + 'px';
	objectSlide.style.display = 'block';
	objectCover.style.display = 'block';
}

//this function is used to hide the larger gallery image and the cover layer - pg 543
function hideSlide() {
	objectSlide.style.display = 'none';	
	objectCover.style.display = 'none';
}

