function GetWidth()
{
        var x = 0;
        if (self.innerHeight)
        {
                x = self.innerWidth;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                x = document.documentElement.clientWidth;
        }
        else if (document.body)
        {
                x = document.body.clientWidth;
        }
        return x;
}
 
function GetHeight()
{
        var y = 0;
        if (self.innerHeight)
        {
                y = self.innerHeight;
        }
        else if (document.documentElement && document.documentElement.clientHeight)
        {
                y = document.documentElement.clientHeight;
        }
        else if (document.body)
        {
                y = document.body.clientHeight;
        }
        return y;
}

function displayImage (imgId) {
// find unique image
	var doneFlag = false;
	while (doneFlag != true) {
		var found = false;
		for (var x = 1; x <= 5; x++) {
			var ranNum= (Math.floor(Math.random()*135))+1; 
			if (ranNum <100) {ranNum = '0'+ranNum;}
			if (ranNum <10) {ranNum = '0'+ranNum;}
			var imageTag=document.getElementById ('img'+x);
			if (imageTag != null) {
				if (imageTag.src == ranNum+'.jpg') {
					found = true;
				} // end if
			} // end if
		} // end for
		if (found == false) {
			doneFlag = true;
		} // end if
	} // end while
		
	// write image tag
	var tempImg = "./images/home/"+ranNum+".jpg";
	document.write ("<img width='100' heigh='100' class='photoThumbnail' onmouseover='swapInImage ("+imgId+")' onmouseout='swapOutImage()' id='img"+imgId+"' src='"+tempImg+"' alt='Image #"+ranNum+"'>");		
} // end function

function swapInImage (imgId) {
	var mainImage = document.getElementById('mainImage');
	var smallImage = document.getElementById('img'+imgId);
	mainImage.src = smallImage.src;
	mainImage.className = 'mainimg';
	mainImage.height = '300px'
	mainImage.width = '640px';
}

function swapOutImage () {
	mainImage.src = './images/HDR_venice_italy.jpg';
	mainImage.height = '300px';
	mainImage.width = '580px';


}


function swapStyle (thisObj, cssStyle) {
	thisObj.setAttribute("className", cssStyle);
	thisObj.setAttribute("class", cssStyle);
}
