// JavaScript to proportionally resize the logos and images
// Copy of the same function exist in the 
//  1) http://ams.lacba.org site
//  2) http://www.expert4law.org site
  function resize_logo_image() {
	MaxWidth = 200; 
	MaxHeight = 200; 
	p = document.getElementById('mainpic'); 
	if (p != null )
	{	w = p.clientWidth; 
		h = p.clientHeight;  
	if (w+h>0) {
		pr = (w*h)/(MaxWidth*MaxHeight);
		if (pr>1)
		{	wprc= w/pr;
			hprc= h/pr;
			if (wprc<hprc)	 
				{mult = MaxWidth/wprc;
				w=w/mult;
				h=h/mult;	}
			else
				{mult = MaxHeight/hprc;
				w=w/mult;
				h=h/mult;	}
		}
		else{
			wprc= w*pr;
			hprc= h*pr;
			if (wprc>hprc)	 
				{mult = MaxWidth/wprc;
				w=wprc*mult;
				h=hprc*mult; }
			else
				{mult = MaxHeight/hprc;
				w=wprc*mult;
				h=hprc*mult; }
		}
		p.style.width = w+'px';
		p.style.height = h+'px';
	}
	}
  }
