var img1 = new Image();
var img2 = new Image();
var img3 = new Image();
var img4 = new Image();
img1.src = "images/homeover.gif";
img2.src = "images/contactover.gif";
img3.src = "images/galleryover.gif";
img4.src = "images/aboutover.gif";

var imgGallery = new Image();

function swapImg(sID, sSrc)
{
	if (document.getElementById(sID))
	{
		document.getElementById(sID).src = 'images/' + sSrc;
	}
}

function gallerySwap(sNum, sTitle, sDesc, sPrice, sWidth, sHeight)
{
	document.getElementById('imgGall').src = 'images/loadingbig.gif';
	document.getElementById('imgGall').style.paddingTop = '116px';
	document.getElementById('imgGall').style.paddingBottom = '116px';
	document.getElementById('imgGall').width = 32;
	document.getElementById('imgGall').height = 32;
	imgGallery.onload = new Function('doSwap(' + sWidth + ', ' + sHeight + ')');
	imgGallery.src = 'images/gallery/' + sNum + '.jpg'
	document.getElementById('divDesc').innerHTML = sTitle;
	document.getElementById('divPrice').innerHTML = sPrice;
	document.getElementById('imgFull').href = 'images/gallery/' + sNum + '.jpg';
	document.getElementById('imgFull2').href = 'images/gallery/' + sNum + '.jpg';
}

function doSwap(sWidth, sHeight)
{
	var date = new Date();
	var curDate = null;

    	document.getElementById('imgGall').style.paddingTop = '0px';
    	if (sHeight < 264)
    	{
        	document.getElementById('imgGall').style.paddingBottom = Math.round((264 - sHeight) / 2) + 'px';
		document.getElementById('imgGall').style.paddingTop = Math.round((264 - sHeight) / 2) + 'px';
    	}else{
        	document.getElementById('imgGall').style.paddingBottom = '0px';
		document.getElementById('imgGall').style.paddingTop = '0px';
    	}
    	document.getElementById('imgGall').src = imgGallery.src;
	do { curDate = new Date(); } 
	while(curDate-date < 500);
    	document.getElementById('imgGall').width = sWidth;
    	document.getElementById('imgGall').height = sHeight;
}

function swapHead(iNum)
{
    	document.getElementById('topcorner').src = 'images/topcorner' + iNum + '.jpg';
}