var iconFile = '/i/ssm/gmaps/markergreen.png';
var iconShadowFile = '/i/ssm/gmaps/markershadow.png';

$0(document).ready(function(){
	$0('#mapContainer').jqm({onShow: center}).jqDrag('.contentDecoratedGray4HeaderBottom');
})

var latToLoad;
var lngToLoad;

function showMap(lat, lng)
{
	latToLoad = lat;
	lngToLoad = lng;
	loadScript('showMap1');
}

function showMap1(lat, lng)
{
	if ((!$0.browser.safari || ($0.browser.safari && $0.browser.version >= 419)) && GBrowserIsCompatible())
	{
		$0('#mapContainer').jqmShow();
		var map = new GMap2(document.getElementById("map"));
		map.addControl(new GLargeMapControl());
		map.addControl(new GScaleControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(latToLoad, lngToLoad), 15);

		var baseIcon = new GIcon();
		baseIcon.image = iconFile;
		baseIcon.shadow = iconShadowFile;
		baseIcon.iconSize = new GSize(20, 34);
		baseIcon.shadowSize = new GSize(37, 34);
		baseIcon.iconAnchor = new GPoint(9, 34);
		baseIcon.infoWindowAnchor = new GPoint(9, 2);
		baseIcon.infoShadowAnchor = new GPoint(18, 25);


		var icon = new GIcon(baseIcon);
		var marker = new GMarker(new GLatLng(latToLoad, lngToLoad), icon);
		map.addOverlay(marker);
	}
	else
	{

		alert('You browser does not support this feature!');
	}
}
/*center*/
function center(hash) {
	if (document.all)
	{
		hash.w.css('position', 'absolute');
		x = document.documentElement.clientWidth/2 + (document.documentElement.scrollLeft );
		y = document.documentElement.clientHeight/2 + (document.documentElement.scrollTop);
	}
	else
	{
		hash.w.css('position', 'fixed');
		x = document.documentElement.clientWidth/2;
		y = document.documentElement.clientHeight/2;
	}
	hash.w.css('top', (y - hash.w.height()/2) + 'px');
	hash.w.css('left', (x - hash.w.width()/2) + 'px');
	hash.w.show();
}
