/*
	Copyright 2010 the circle squared Limited
	All rights reserved
*/

function lightBox(image, width, height) {
	var viewport = document.getSize();
	if (width > viewport.x) {
		height = height * (viewport.x - 40) / width;
		height = height.toFixed();
		width = viewport.x - 40;
		width = width.toFixed();
	}
	if (height > viewport.y) {
		width = width * (viewport.y - 40) / height;
		width = width.toFixed();
		height = viewport.y - 40;
		height = height.toFixed();
	}
	var doc = window.getScrollSize();
	$('lBox').style.height = doc.y + 'px';
	$('lBox').style.display = 'block';
	$('lBoxImg').style.display = 'block';
	$('lBoxImg').innerHTML = '<img id="lBox_image" alt="Justin Wilson gallery" width="' + width + '" height="' + height + '" src="' + image + '" />';
	var scroll = window.getScroll();
	$('lBox_image').style.marginTop = scroll.y + 'px';
}

function lBoxClose() {
	$('lBox').style.display = 'none';
	$('lBoxImg').style.display = 'none';
	$('lBoxImg').innerHTML = '';
}

function clearForm(id, text) {
	if ($(id).value == text) { $(id).value = ''; }
}

function checkForm(id, text) {
	if ($(id).value == '') { $(id).value = text; }
}


