//<script>
var pwd
var pht
var doc
var prop

function GetOrgSizes()
{
 doc = parent.mainpage.document
 pwd = doc.pic.width;
 pht = doc.pic.height;
 prop = pwd/pht;
}

function sizeImage()
{
 	var swd = document.body.clientWidth - 20;
	var sht = document.body.clientHeight - 70;

	if(pwd > swd && pht > sht)
	{
//both dimesions too small
	 if(pwd / swd > pht / sht)
	 {
//width smallest
	 	doc['pic'].width = swd;
	 	doc['pic'].height = pht * swd / pwd;
	 }
	else		
	 {
//height smallest
	 doc['pic'].height = sht;
	 doc['pic'].width = pwd * sht / pht;
	 }
	}
	else if(pwd > swd)
//width only too small
	{
	 doc['pic'].width = swd;
	 doc['pic'].height = pht * swd / pwd;
	}
	else if(pht > sht)
//height only too small
	{
	 doc['pic'].height = sht;
	 doc['pic'].width = pwd * sht / pht;
	}
	else
//size adequate
	{
	 doc['pic'].height = pht;
	 doc['pic'].width = pwd;
	}
}
