var map = null;
var center = null;
var latitudeString;
var latitudeArray;
var longitudeString;
var longitudeArray;
var nameString;
var nameArray;
var addressOneString;
var addressOneArray;
var addressTwoString;
var addressTwoArray;
var cityStateZipString;
var cityStateZipArray;
var idString;
var idArray;
var typeString;
var typeArray;
var seoNameString;
var seoNameArray;

function LoadMap(onMapLoaded) {
    map = new VEMap('map');
    options = new VEMapOptions();
    options.EnableBirdseye = false;
    map.SetDashboardSize(VEDashboardSize.Small);
    
    if (onMapLoaded != null)
        map.onLoadMap = onMapLoaded;

    center = new VELatLong(43.531359, -96.735306);

    map.LoadMap(center, null, null, null, null, null, null, options);
	
	map.AttachEvent("onmousewheel", ChangeHandler);
}

function LoadPin(LL, title, address1, address2, csz, id, type, seoName) {
    var shape = new VEShape(VEShapeType.Pushpin, LL);
    shape.SetTitle("<a href=\"details/" + escape(id) + "/" + escape(seoName) + "\">" + escape(title) + "</a></span>");
	if(address2 == "")
    	shape.SetDescription(escape(address1) + "<br />" + escape(csz));
	else
		shape.SetDescription(escape(address1) + "<br />" + escape(address2) + "<br />" + escape(csz));

	switch (type)
	{
		case "House":
			shape.SetCustomIcon("../../Content/images/bluepin.gif");
			break;
		case "Townhome":
			shape.SetCustomIcon("../../Content/images/redpin.gif");
			break;
		case "Duplex":
			shape.SetCustomIcon("../../Content/images/orangepin.gif");
			break;
		case "Condo":
			shape.SetCustomIcon("../../Content/images/greenpin.gif");
			break;
		case "Apartment":
			shape.SetCustomIcon("../../Content/images/purplepin.gif");
			break;
		default:
			shape.SetCustomIcon("../../Content/images/bluepin.gif");
			break;
	}

    map.AddShape(shape);
}
 
function ChangeHandler(e) {
  return true;
}
