var isPreviewLoadad = false;
var galleryRolloverObj = null;
var galleryRolloverImg = null;
var tempX = 0;
var tempY = 0;
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE);
if (IE) document.execCommand("BackgroundImageCache", false, true);

function buildPreview() {
	if (isPageLoaded) {
		galleryRolloverObj = document.getElementById("galleryRollover").style;
		galleryRolloverImg = document.getElementById("galleryRolloverImage").style;
		isPreviewLoadad = true;
	} else {
		setTimeout("buildPreview();", 500);
	}
}
buildPreview();

function turnOffPreview() {
	
}

function mouseCoords(e) {
	if (IE) {
		tempX = event.clientX + document.body.scrollLeft;
		tempY = event.clientY + document.body.scrollTop;
	} else {
		tempX = e.pageX;
		tempY = e.pageY;
	}
	if (isPreviewLoadad) {
		galleryRolloverObj.left = tempX - 50;
		galleryRolloverObj.top = tempY - 135;
	}
}

function showGalleryPreview(strImgFilename, strTopMargin, strLeftMargin) {
	if (isPreviewLoadad) {
		document.preview_image.src = strGalleryImagePath + strImgFilename;
		galleryRolloverImg.margin = strTopMargin + "px 0px 0px " + strLeftMargin + "px";
		document.onmousemove = mouseCoords;
		galleryRolloverObj.visibility = "visible";
	}
	
}
function hideGalleryPreview() {
	if (isPreviewLoadad) {
		galleryRolloverObj.visibility = "hidden";
		document.preview_image.src = "/_images/blank.gif";
		galleryRolloverImg.margin = "0px 0px 0px 0px";
		document.onmousemove = turnOffPreview;
	}
}
