
var interestingPlaces_dflathousing=[
        [6,[
        ["esade_icon.gif","esade_big_icon.gif",'ESADE',40.4674747, -3.6821147, "http://www.esade.edu","C/ de Mateo Inurria, 25 28036 Madrid"]
        ,["icade_icon.gif","icade_big_icon.gif",'',40.4299499, -3.7112746, 13, "http://www.upcomillas.es/","C/ Alberto Aguilera, 23 28015 Madrid"]
        ,["ie_icon.gif","ie_big_icon.gif",'IE',40.4377992, -3.6878707, "http://www.ie.edu","C/ Mar&iacute;a  De Molina 10 Madrid"]
        ,["ceu_icon.gif","ceu_big_icon.gif",'CEU Postgrado',40.4428369, -3.7191503, "http://www.ceu.es/","c/Juli&aacute;n Romea, 23 - 28003 Madrid"]
        ,["ese_icon.gif","ese_big_icon.gif",'European School of Economics',40.4287557, -3.6840134, "http://www.eselondon.ac.uk","C/ Vel&aacute;zquez 57 28001 Madrid"]
        ,["ieb_icon.gif","ieb_big_icon.gif",'IEB',40.4186433, -3.6905098, "http://www.ieb.es/","C/Alfonso XI, 6, 28014 Madrid"]
        ,["schiller_icon.gif","schiller_big_icon.gif",'Schiller',40.4482123, -3.6835495, "http://www.schillermadrid.edu/","Calle Serrano 156 Madrid 28002"]
        ,["uc3m_icon.gif","uc3m_big_icon.gif",'Universidad Carlos III',40.5462953, -4.0112894, "http://www.uc3m.es","Avda. de la Universidad Carlos III, 22 - 28270 Colmenarejo"]
        ,["iede_icon.gif","iede_big_icon.gif",'IEDE',40.5319947, -3.6352984, "http://www.iede.edu/Madrid","Avda. de Bruselas, 14 28108 Alcobendas (Madrid)"]
        ,["een_icon.gif","een_big_icon.gif",'Escuela Europea de Megocios',40.4691056, -3.669133, "http://www.master-een.es/","Calle de la Bausa, 21 - 28033 Madrid"]
        ]],
        [14,[

        ["accent_icon.gif","accent_big_icon.gif","accent_big_icon.gif",'ACCENT',40.4337523, -3.691108, "http://www.accentintl.com/madrid/","C/ Miguel Angel, 6 Bajo 9 - 28010 Madrid"]
        ,["adm_icon.gif","adm_big_icon.gif",'ADM',40.4283681, -3.6836942, "http://www.admbs.com/","C/ Vel&aacute;zquez, 64-66, Madrid"]
        ,["cer_icon.gif","cer_big_icon.gif",'ADM',40.4283681, -3.6836942, "http://www.admbs.com/","CEF c/General Martinez Campos, 5 - 28010 Madrid"]
        ,["eoi_icon.gif","eoi_big_icon.gif",'EOI',20.6078849, -100.3972208, "http://www.eoi.es","Avda. Gregorio del Alamo, 6 - Madrid"]
        ,["esc_eap_icon.gif","esc_eap_big_icon.gif",'ESC EAP',40.4709349, -3.7498138, "http://www.escpeurope.eu","C/ Arroyofresno,1 28035 – Madrid"]
        ,["esden_icon.gif","esden_big_icon.gif",'ESDEN',40.457688, -3.6858031, "http://www.esden.es/","C/ Calle Padre Dami&aacute;n 23 28036 Madrid"]
        ,["eserp_icon.gif","eserp_big_icon.gif",'ESERP',40.4586005, -3.6753052, "http://www.eserp.com/","C/ Costa Rica 9  28016 Madrid"]
        ,["esic_icon.gif","esic_big_icon.gif",'ESIC',40.4560893, -3.6569124, "http://www.esic.es","C/ Arturo Soria, 161 28043 Madrid"]
        ,["esic_icon.gif","esic_big_icon.gif",'ESIC',40.4364194, -3.8096522, "http://www.esic.es","Avda. Valdenigrales s/n Pozuelo de Alarc&oacute;n, 28223 Madrid"]
        ,["ide_cesem_icon.gif","ide_cesem_big_icon.gif",'IDE CESEM',40.4351786, -3.6907356, "http://www.institutodirectivosempresa.com","Paseo General Martinez Campos 46 - 28010 MADRID"]
        ,["ied_icon.gif","ied_big_icon.gif",'IED',40.4216534, -3.7070966, "http://www.ied.edu","C/ Flor Alta 8, 28004 Madrid"]
        ,["iede_icon.gif","iede_big_icon.gif",'IEDE',40.3751194, -3.924703, "http://www.iede.edu/Madrid","C/ Tajo s/n, Villaviciosa de Odón, 28670 Madrid"]
        ,["iese_icon.gif","iese_big_icon.gif",'IESE',40.4518541, -3.760267, "http://www.iese.edu","Camino del Cerro del Águila, 3 28023 Madrid"]
        ,["isem_icon.gif","isem_big_icon.gif",'ISEM',40.4366557, -3.693422, "http://www.isem.es/","C/ García de Paredes, 55 28010 Madrid"]
        ,["slu_icon.gif","slu_big_icon.gif",'Saint Louis University',40.4435303, -3.7174858, "http://spain.slu.edu/","Avenida del Valle, 34 - 28003 Madrid"]
        ]]
	
]

var interestingPlaces_dflatmadrid=[
    
];

function getGoogleMap(canvasName, lat, lng, zoom, infoHTML) {
	var latlng = new GLatLng(lat,lng);
	var map = new GMap2(document.getElementById(canvasName));
	map.setCenter(latlng, zoom);
	if (infoHTML!=undefined && infoHTML!=null)
	{
		map.openInfoWindow(map.getCenter(),
                   document.createTextNode(infoHTML));
	}

	var control=map.getDefaultUI();	
        control.controls.maptypecontrol=false;
	control.controls.scalecontrol = true;
        control.controls.smallzoomcontrol3d=false;
        control.controls.largezoomcontrol3d=false;
	map.setUI(control);
	return map;
}

function createFlatMarker(map, image, lat, lng, infoHTML) {
	//var myLatlng = new GLatLng(lat, lng);
        var myLatlng = new GLatLng(lat+Math.random()*0.0003-Math.random()*0.0003, lng+Math.random()*0.0003-Math.random()*0.0003);
	var tinyIcon = new GIcon();
	tinyIcon.image = image;

	tinyIcon.iconAnchor = new GPoint(6, 20);
	tinyIcon.infoWindowAnchor = new GPoint(115, 1);	
	var marker = new GMarker(myLatlng, {icon: tinyIcon});
        if (infoHTML && infoHTML!=null) {
          GEvent.addListener(marker, "click", function() {
            map.openInfoWindowHtml(marker.getLatLng(), infoHTML);
          });
        }
	return marker;
}

/* Crea un marcador de un lugar de interes
 */
function createPlaceMarker(map, image, imageBig, name, lat, lng, urll, info) {
    var infoHTML="<center><spant style='font-family: Verdana,Arial,Helvetica,sans-serif;'><a href='"+urll+"'><image src='"+imageBig+"' border='0'><br/><strong>"+name+"</strong></a><br/>"+info+"</span></center>";
    return createPlaceMarker2(map, image, lat, lng, infoHTML);
}

/* Crea un marcador de un lugar de interes
 */
function createPlaceMarker2(map, image, lat, lng, infoHTML) {
    var myLatlng = new GLatLng(lat, lng);
    var tinyIcon = new GIcon();        
    tinyIcon.image = image;
    //tinyIcon.iconSize = new GSize(30, 32);
    tinyIcon.iconAnchor = new GPoint(6, 20);
    tinyIcon.infoWindowAnchor = new GPoint(115, 1);
    var marker = new GMarker(myLatlng, {icon: tinyIcon});
    if (infoHTML && infoHTML!=null) {
      GEvent.addListener(marker, "click", function() {
        map.openInfoWindowHtml(marker.getLatLng(), infoHTML);
      });
    }
    return marker;
}

/* Añade un marcador al mapa a partir del identificador de piso, imagenes y posición
 * Añade infoHTML como texto (en html) que mostrará
 */
function addFlatMarker(map, image, lat, lng, infoHTML) {
    var marker=createFlatMarker(map, image, lat, lng, infoHTML);
    map.addOverlay(marker, {zIndexProcess:orderOfCreation});
    return marker;
}

/* Añade la lista de lugares de interes 
 * Espera un array de lugares del formato 
 * ["ie_googlemap.png",'IE - Instituto de empresa',40.448645,-3.68351, "http://www.ie.edu/"]
 * [imagen, texto, lat, lng, url]
 * */
function addInterestingPlaces(map, places, imageContext) {
    var mgr = new MarkerManager(map);
    var markers=[];
    for (var layer=0; layer<places.length; layer++) {
        markers=[];
        for (i=0; i<places[layer][1].length; i++) {
            var marker=createPlaceMarker(map, imageContext+"/../interesting/"+places[layer][1][i][0],imageContext+"/../interesting/"+places[layer][1][i][1],places[layer][1][i][2],places[layer][1][i][3],places[layer][1][i][4],places[layer][1][i][5],places[layer][1][i][6]);
            markers.push(marker);
        }
        mgr.addMarkers(markers,places[layer][0]);
    }
    mgr.refresh();
}

/* Mueve el centro del mapa ligeramente hacia la esquina inferior izquierda */
function moveMarkerCorner(map, lat, lng, zoom) {
    var myLatlng = new GLatLng(lat+0.003, lng+0.003);
    map.setCenter(myLatlng, zoom);
}

function orderOfCreation(marker,b) {
        return 1;
}


