 	
	function GalleryImage(thisimage,reqwidth,reqheight)
	{
	
	img = new Image();
	img.src = document.getElementById(thisimage).src;
	//alert(img.width);
	//alert(rewidth);
	
	var imgWidth = img.width;
	var imgHeight = img.height;
	
	if (imgWidth > imgHeight)
	{
		//setting image width
		if ( reqwidth > imgWidth )
			document.getElementById(thisimage).width = imgWidth;
		else
			document.getElementById(thisimage).width = reqwidth;
			
		//setting image height
		if ( reqheight > imgHeight )
			document.getElementById(thisimage).height = imgHeight;
		else
			document.getElementById(thisimage).height = reqheight;
	}
	else 
	if (imgWidth == imgHeight)
		{
			document.getElementById(thisimage).width=reqwidth;
			document.getElementById(thisimage).height=reqheight;
		}
	
	else
	if (imgHeight > imgWidth)
	{
		//setting image width
		if (reqheight > imgHeight )
		document.getElementById(thisimage).height = imgHeight;
		else
		document.getElementById(thisimage).height = reqheight;	
		
		//setting image height
		if ( reqheight > imgHeight )
			document.getElementById(thisimage).height = imgHeight;
		else
			document.getElementById(thisimage).height = reqheight;	
	}
	
	
	//individual setting of image for resizing small pics
	if (imgHeight < reqheight && imgWidth < reqwidth)
	{
			document.getElementById(thisimage).width=reqwidth;
			document.getElementById(thisimage).height=reqheight;
	}
	
	
	document.getElementById(thisimage).style.display="";	
	}
	

function sizeOfImage(thisimage,rewidth)
{
//alert(thisimage.src);
//alert(document.getElementById(thisimage).src);
img = new Image();
img.src = document.getElementById(thisimage).src;
imgWidth = img.width;
imgHeight = img.height;
if (imgWidth > imgHeight)
if ( rewidth>imgWidth )
thisimage.width = imgWidth;
else
thisimage.width = rewidth;
else
if ( rewidth>imgHeight )
thisimage.height = imgHeight;
else
thisimage.height = rewidth; 
//thisimage.style.display="";

}
