var id_div = "";
var sWx = "";
var sWy = "";
var nEx = "";
var nEy = "";
var Px = "";
var Py = "";
var Title = "";

function setMParam (l_id_div,l_sWx,l_sWy,l_nEx,l_nEy,l_Px,l_Py,l_Title)
{
  id_div = l_id_div;
  sWx = l_sWx;
  sWy = l_sWy;
  nEx = l_nEx;
  nEy = l_nEy;
  Px = l_Px;
  Py = l_Py;
  Title = l_Title;
  YMaps.load(init);
}

function init ()
{
  var obj = document.getElementById(id_div+'_Panel');
  if(obj)
  {
    obj.style.display = 'block';
    var map = new YMaps.Map(document.getElementById(id_div));
    var southWest = new YMaps.GeoPoint(sWx,sWy,false);
    var northEast = new YMaps.GeoPoint(nEx,nEy,false);
    var geoBounds = new YMaps.GeoBounds(southWest, northEast);
    
    map.setBounds(geoBounds);
    var expopoint = new YMaps.Placemark(new YMaps.GeoPoint(Px,Py));
    
    expopoint.setBalloonContent(Title);
    map.addOverlay(expopoint);
    map.addControl(new YMaps.Zoom());
    map.enableScrollZoom();
    var typeControl = new YMaps.TypeControl();
    map.addControl(typeControl);
    typeControl.removeType(YMaps.MapType.HYBRID);
  }
}

function setMParam2 (l_sWx,l_sWy,l_nEx,l_nEy,l_Px,l_Py,l_Title, key){
	var nav = navigator.userAgent.toLowerCase();

	//alert('<img src="http://static-maps.yandex.ru/1.x/?pt=' + l_Px + ','+ l_Py +',pmwtl&z=16&l=map&size=300,300&key='+ key +'" />');
	if(nav.indexOf("msie 6.0") != -1){
		alert(1);
		$('.mapContainer').removeClass("hidden");
		$('#mapContainerImage').html('<img src="http://static-maps.yandex.ru/1.x/?pt=' + l_Px + ','+ l_Py +',pmwtl&z=16&l=map&size=300,300&key='+ key +'" />');
	}else{
		$('.mapContainer').removeClass("hidden");
		sWx = l_sWx;
		sWy = l_sWy;
		nEx = l_nEx;
		nEy = l_nEy;
		Px = l_Px;
		Py = l_Py;
		Title = l_Title;
		YMaps.load(init2);
	}
}

function init2 (){
	
	var map = new YMaps.Map(document.getElementById('mapContainerImage'));
	var southWest = new YMaps.GeoPoint(sWx,sWy,false);
	var northEast = new YMaps.GeoPoint(nEx,nEy,false);
	var geoBounds = new YMaps.GeoBounds(southWest, northEast);
	map.setBounds(geoBounds);
	var expopoint = new YMaps.Placemark(new YMaps.GeoPoint(Px,Py));
	map.addOverlay(expopoint);
	expopoint.openBalloon(Title, {maxWidth: 150});
	map.addControl(new YMaps.Zoom());
	//map.disableScrollZoom();
	//map.enableScrollZoom();
	var typeControl = new YMaps.TypeControl();
	map.addControl(typeControl);
	typeControl.removeType(YMaps.MapType.HYBRID); 
}