var map = null;
var point = null;
var myPano = null;
function initialize() {
if (GBrowserIsCompatible()) {
var mapOptions = {
googleBarOptions : {
style : "new"
}
}
var panoOpts = {
features: {
streetView: true,
userPhotos: false
}
};
map = new GMap2(document.getElementById("map_canvas"),mapOptions);
map.setUIToDefault();
map.enableGoogleBar();
/*
myPano = new GStreetviewPanorama(document.getElementById("pano"), panoOpts);
GEvent.addListener(myPano, "error", handleNoFlash);
*/
geocoder = new GClientGeocoder();
showAddress();
}
}
function showAddress() {
if (multi == true){
address = map_address[curr]=='' ? address1[curr]+(address1_l2[curr] != '' ? ' '+address1_l2[curr] : '')+', '+address2[curr]+', '+address3[curr] : map_address[curr];
}else{
address = map_address == '' ? address1+(address1_l2 != '' ? ' '+address1_l2 : '')+', '+address2+', '+address3 : map_address;
}
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address);
parent.docoalert('Address: ' + address + " not found");
} else {
map.setCenter(point, 15);
var marker = new GMarker(point);
if (multi == true){
sp_lat = p_lat[curr]
sp_lng = p_lng[curr]
}else{
sp_lat = p_lat
sp_lng = p_lng
}
if (sp_lat != '' && sp_lng != ''){
marker = new GMarker( new google.maps.LatLng(parseFloat(sp_lat), parseFloat(sp_lng)));
}
map.addOverlay(marker);
/*
var homeControl = new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10,10));
var mapTypeControl = new GMapTypeControl();
map.addControl(mapTypeControl, homeControl);
GEvent.addListener(homeControl, "click", function() {
map.setCenter(point)
});
*/
if (multi == true){
marker.openInfoWindowHtml(
''+practice_name[curr]+'
'
+ address1[curr] +'
'
+ (address1_l2[curr]!='' ? address1_l2[curr] +'
' : '')
+ address2[curr]
);
}else{
marker.openInfoWindowHtml(
''+practice_name+'
'
+ address1 +'
'
+ (address1_l2!='' ? address1_l2 +'
' : '')
+ address2
);
}
//myPano.setLocationAndPOV(point);
}
}
);
}
}
function handleNoFlash(errorCode) {
if (errorCode == 603) {
alert("Error: Flash doesn't appear to be supported by your browser");
return;
}
}
$(document).ready(function(){
$('.location').click(function(){
curr= parseInt($(this).attr('rel'));
showAddress();
});
});