/* mGallery - by MarkWillis.co.uk */

/***********************
	Dependancies: 
	 mLib
	 mFloat
	 mSlide
***********************/

var mImgHeight = 200; var mImgWidth = 100; var mGalleryImg = ''; var mGalleryTitle = ''; var mGalleryDesc = '';

function showMGallery(mImgPath, mImgTitle, mImgDesc)
{
	mLoadImage(mImgPath); mGalleryTitle = mImgTitle; mGalleryDesc = mImgDesc; mGalleryImg = mImgPath; 
	mBviewportScan();
	mCloak();
	document.getElementById('mFloatBlock').style.left = ((mFloatViewportWidth / 2) - 440) + "px";
	document.getElementById('mFloatBlock').style.top = (200 + 10) + "px";
	document.getElementById('mFloatBlock').innerHTML = '<div class="mFloat-inner" id="mFloatInner"><div class="mFloat-close"><a href="#" onclick="return mFloatClose();"><!-- close --></a></div><div class="mFloat-main"> <div class="mFloatAreaLoading"><!-- --></div> </div></div>';
	document.getElementById('mFloatBlock').className = 'mFloatBlock-on';
	document.getElementById('mFloatBlock').style.display = "block";
	document.getElementById('mFloatInner').innerHTML = '<div class="mFloat-close"><a href="#" onclick="return mFloatClose();"><!-- close --></a></div><div class="mGalleryArea"><h1>' + mGalleryTitle + '</h1><p>' + mGalleryDesc + '</p> <div class="mGalleryLoad"><div class="mFloatAreaLoading" id="mGalleryLoadArea"><!-- --></div></div></div>';
		
	return false;
}

function mLoadImage(mImgPath)
{var mImage = new Image(); mImage.name = mImgPath; mImage.onload = mImgGo; mImage.src = mImgPath;}

function mImgGo()
{mImgHeight = this.height; mImgWidth = this.width; mLoadGallery(); return true;}

function mLoadGallery()
{
	//alert("Image = " + mGalleryImg + "\n X:Y = " + mImgHeight + ":" + mImgWidth + "\n\nTitle = " + mGalleryTitle + "\n Desc = " + mGalleryDesc);
	document.getElementById('mFloatBlock').style.width = (mImgWidth + 20) + "px";
	document.getElementById('mFloatBlock').style.left = ((mFloatViewportWidth / 2) - ((mImgWidth + 20)/2)) + "px";
	mSlide('mGalleryLoadArea', 0, mImgHeight, 40, 0, 1, 0, '');
	document.getElementById('mGalleryLoadArea').innerHTML = '<div style="background: url(\'' + mGalleryImg + '\') center center no-repeat; height: ' + mImgHeight + 'px;"><!-- --></div>';
}