function resize_pic(maxwidth, maxheigth, thispicid)
{
	var javascrexpr = "exec_resize_pic(" + maxwidth + ", " + maxheigth + ", '" + thispicid + "')";
	var random = (Math.random())*600;
	random = Math.abs(random);
	var t=setTimeout(javascrexpr,random);
}
function exec_resize_pic(maxwidth, maxheigth, thispicid)
{
	var thepiconmypage = document.getElementById(thispicid);
	var image_source = thepiconmypage.src;
	var oImg = new Image();
	oImg.src = image_source;
	if (oImg.complete)
	{
		var width_of_this_pic_is_what_pr1_of_max = oImg.width / maxwidth;
		var height_of_this_pic_is_what_pr1_of_max = oImg.height / maxheigth;
		if(width_of_this_pic_is_what_pr1_of_max >= height_of_this_pic_is_what_pr1_of_max)
		{
			var newwidth = Math.floor(oImg.width / width_of_this_pic_is_what_pr1_of_max);
			var newheigth = Math.floor(oImg.height / width_of_this_pic_is_what_pr1_of_max);
			thepiconmypage.style.width = newwidth + 'px';
			thepiconmypage.style.height = newheigth + 'px';
		}
		else
		{
			var newwidth = Math.floor(oImg.width / height_of_this_pic_is_what_pr1_of_max);
			var newheigth = Math.floor(oImg.height / height_of_this_pic_is_what_pr1_of_max);
			thepiconmypage.style.width = newwidth + 'px';
			thepiconmypage.style.height = newheigth + 'px';
		}
	}
	else
	{resize_pic(maxwidth, maxheigth, thispicid);}
}
