function resize_image(which) {
  var elem = document.getElementById(which);
  if (elem == undefined || elem == null) return false;
  var div_elem = document.getElementById('eval("div_" + which)');
  if (div_elem == undefined || div_elem == null) return false;
  var max_height = div_elem.height * 0.8;
  var max_width =  div_elem.width * 0.8;
  if (elem.width > elem.height) {
    if (elem.width > max_width) elem.width = max_width;
  } else {
    if (elem.height > max_height) elem.height = max_height;
  }
}

    function createMarker(point,html,party) {
        var icon = new GIcon(G_DEFAULT_ICON);
//set up pins - see http://code.google.com/apis/chart/docs/gallery/dynamic_icons.html#special_pins
		switch(party)
		{
		case 'labour':
		icon.image ="/media/images/labour_pin.png";
		  break;
		case 'conservative':
		icon.image ="/media/images/tory_pin.png";
		  break;
		case 'liberal_democrat':
				icon.image ="/media/images/libdem_pin.png";
		  break;
		case 'scottish_national_party':
				icon.image ="/media/images/other_pin.png";	
			  break;
		case 'plaid_cymru':
				icon.image ="/media/images/other_pin.png";
		  break;
		case 'green':
				icon.image ="/media/images/green_pin.png";
		  break;
		default:
				icon.image ="/media/images/other_pin.png";
				//icon.image ="http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=location|CCCCCC";
		//  icon.image ="http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,FF9999,000000&ext=.png";
		}
        var marker = new GMarker(point, {icon: icon});
        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(html);
        });
        return marker;
    }
