<!DOCTYPE HTML>
<html>
<head>
<title>OpenLayers Demo</title>
<style type="text/css">
html, body, #basicMap {
width: 100%;
height: 100%;
margin: 0;
}
</style>
<link rel="stylesheet" href="http://openlayers.org/dev/theme/default/style.css" type="text/css">
<link type="text/css" href="jquery/fancybox/jquery.fancybox-1.3.4.css" rel="stylesheet" />
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript" src="markers.js"></script>
<script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
function init() {
var lon_lat = null;
map = new OpenLayers.Map("basicMap");
var mapnik = new OpenLayers.Layer.OSM();
var markers = new OpenLayers.Layer.Markers( "Markers" );
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
var position = new OpenLayers.LonLat(26.94,57.59).transform( fromProjection, toProjection);
var zoom = 13;
map.addLayer(mapnik);
map.addLayer(markers);
map.setCenter(position, zoom );
var size = new OpenLayers.Size(35,35);
var offset = new OpenLayers.Pixel(-(size.w/2)+7, -size.h + 2);
var icon = new OpenLayers.Icon('panoramic180.png',size,offset);
$(marker_defs).each(function(){
if(this != null && this.geo_x != "" && this.geo_x != undefined){
lon_lat = new OpenLayers.LonLat(this.geo_x, this.geo_y).transform(
new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
var marker;
marker = new OpenLayers.Marker(lon_lat, icon.clone());
console.log("TE IR ->"+marker.lonlat);
marker.def = this;
marker.events.register('mouseover', marker, function(evt) {
popup = new OpenLayers.Popup.FramedCloud("chicken",
marker.lonlat,
new OpenLayers.Size(200, 200),
this.def.info,
null, true);
if (this.popup == null) {
map.addPopup(this.popup);
this.popup.show();
} else {
this.popup.toggle();
OpenLayers.Event.stop(evt);
}
});
marker.events.register('mousedown', marker, function(evt) {
aprofile(this.def.link);
OpenLayers.Event.stop(evt);
});
markers.addMarker(marker);
}
})
if ($(marker_defs).length == 1){
map.setCenter(lon_lat, 9);
}
$("#OpenLayers_Control_Attribution_7").remove();
}
function aprofile(lnk) {
$.fancybox({
'width' : 700,
'height' : 700,
'href' : lnk,
'type' : 'iframe',
'autoScale' : true
});
}
</script>
</head>
<body onload="init();">
<div id="basicMap" style="width:50%; height:500px"></div>
</body>
</html>