

function updatePicture($name) {
	
	Effect.Fade('thePicture');
	$('thePicture').src = '../masters/' + $name;
	Effect.Appear('thePicture');
	
}

function initTransition(path) {
	//oTransition = new Transition('thePictureContainer', path);
}

function resizePortrait(id) {
	alert(document.body.clientWidth + 'x' + document.body.clientHeight);
	document.getElementById("imgTag").style.width = document.body.clientWidth;
	document.getElementById("imgTag").style.height = document.body.clientHeight;
}

function caption() {
		
	if ($('caption').getStyle('display') == 'none') {
		Effect.BlindDown('caption');
		//$('captionControl').toggleClassName('enabled');
		$('captionControl').src = '/graphics/caption_on.gif';
	} else {
		Effect.BlindUp('caption');
		//$('captionControl').toggleClassName('enabled');
		$('captionControl').src = '/graphics/caption_off.gif';		
	}
	
}

function caption2() {
		
	if ($('caption').getStyle('display') == 'none') {
		Effect.BlindDown('caption');
		//$('captionControl').toggleClassName('enabled');
		//$('captionControl').src = '/graphics/caption_on.gif';
	} else {
		Effect.BlindUp('caption');
		//$('captionControl').toggleClassName('enabled');
		//$('captionControl').src = '/graphics/caption_off.gif';		
	}
	
	$('captionControl').toggleClassName('selected')
	
}

function e() {

	u = 'ma' + 'il' + 'to:';
	u += 'ryan' + '@';
	u += 'ryanbrooksphoto';
	u += '.com';
	
	document.location = u;

}

function resizePicture(imageId) {

	image = $(imageId);
	
	$('thePictureContainerContainer').style.width = document.viewport.getWidth() - 300 + 'px';
	$('thePictureContainerContainer').style.height = document.viewport.getHeight() - 180 + 'px';

	portWidth = $('thePictureContainerContainer').getWidth();
	portHeight = $('thePictureContainerContainer').getHeight();

	var imageWidth = image.width;
	var imageHeight = image.height;
	var bothDimensions = true;
	
	// freakin' IE
	if (navigator.appName == 'Microsoft Internet Explorer') {
		imageWidth = image.getWidth();
		imageHeight = image.getHeight();
		bothDimensions = false;
	}

	// Find which dimension is scaled the most
	var scaleW = portWidth / imageWidth;
	var scaleH = portHeight / imageHeight;


	// Scale the image
	if (scaleH < scaleW) {
		image.style.height = portHeight + "px";
		if (bothDimensions) {
			image.style.width = Math.round(imageWidth * scaleH) + "px";
		}
	} else {
		image.style.width = portWidth + "px";
		if (bothDimensions) {
			image.style.height = Math.round(imageHeight * scaleW) + "px";
		}
	}

	$('spinner').style.display = 'none';	
	Effect.Appear(imageId);
		
}


function checkResize(imageId, containerId, containerContainerId) {
	width = document.viewport.getWidth();
	height = document.viewport.getHeight();
	
	image = $(imageId);
	
	resizeFactor = 1;
	if (width > height) {

		// fit to height
		resizeFactor = height / image.getHeight();
		
	} else {
		
		// fit to height
		resizeFactor = width / image.getWidth();
	}
		
	newWidth = image.getWidth() * resizeFactor;
	newHeight = image.getHeight() * resizeFactor;

	
	image.width = newWidth;
	image.height = newHeight;
	$(containerId).width = newWidth;
	$(containerId).height = newHeight;
	$(containerContainerId).width = newWidth;
	$(containerContainerId).height = newHeight;
		
}

