var curlat=40.44118578596932, curlng=-80.00020980834961;var curZoom=15;var mapl=null;var mapr=null;function chckChange(isChecked){document.cpform.lat.value=null;document.cpform.lng.value=null;if(isChecked==true){var bounds = mapl.getBounds();var northEast = bounds.getNorthEast();var southWest = bounds.getSouthWest();lngDiff = northEast.lng() - southWest.lng();curlat=latlng.lat();curlng=latlng.lng()-lngDiff;mapl.setCenter(new GLatLng(curlat, curlng),curZoom, G_NORMAL_MAP);}else{curlat=latlng.lat();curlng=latlng.lng();mapl.setCenter(new GLatLng(curlat, curlng),curZoom, G_NORMAL_MAP);}}function modedouble(){document.cpform.czoom.value=curZoom;if (GBrowserIsCompatible()){mapl = new GMap2(document.getElementById("mapl"),{draggableCursor:"default"});mapl.setCenter(new GLatLng(curlat, curlng),curZoom, G_NORMAL_MAP);mapr = new GMap2(document.getElementById("mapr"),{draggableCursor:"default"});mapr.setCenter(new GLatLng(curlat, curlng),curZoom, G_SATELLITE_MAP);GEvent.addListener(mapr, "drag", rmousedrag);GEvent.addListener(mapl, "drag", lmousedrag);GEvent.addListener(mapr, "dblclick", rmousedc);GEvent.addListener(mapl, "dblclick", lmousedc);GEvent.addListener(mapr, "click", rmouseclck);GEvent.addListener(mapl, "click", lmouseclck);}}function rmousedrag(){curZoom=mapr.getZoom();latlng=mapr.getCenter();var lngDiff=0;if (latlng!=null){if (document.getElementById("checkboxId").checked){var bounds = mapl.getBounds();var northEast = bounds.getNorthEast();var southWest = bounds.getSouthWest();lngDiff = northEast.lng() - southWest.lng();}curlat=latlng.lat();curlng=latlng.lng()-lngDiff;mapl.setCenter(new GLatLng(curlat, curlng),curZoom, G_NORMAL_MAP);document.cpform.lat.value=null;document.cpform.lng.value=null;}}function lmousedrag(){curZoom=mapl.getZoom();latlng=mapl.getCenter();var lngDiff=0;if (latlng!=null){if (document.getElementById("checkboxId").checked){var bounds = mapr.getBounds();var northEast = bounds.getNorthEast();var southWest = bounds.getSouthWest();lngDiff = northEast.lng() - southWest.lng();}curlat=latlng.lat();curlng=latlng.lng()+lngDiff;mapr.setCenter(new GLatLng(curlat, curlng),curZoom, G_SATELLITE_MAP);document.cpform.lat.value=null;document.cpform.lng.value=null;}}function rmousedc(){curZoom=mapr.getZoom();latlng=mapr.getCenter();if (latlng!=null){curlat=latlng.lat();curlng=latlng.lng();mapl.setCenter(new GLatLng(curlat, curlng),curZoom, G_NORMAL_MAP);document.cpform.lat.value=curlat;document.cpform.lng.value=curlng;document.cpform.czoom.value=curZoom;}}function lmousedc(){curZoom=mapl.getZoom();latlng=mapl.getCenter();if (latlng!=null){curlat=latlng.lat();curlng=latlng.lng();mapr.setCenter(new GLatLng(curlat, curlng),curZoom, G_SATELLITE_MAP);document.cpform.lat.value=curlat;document.cpform.lng.value=curlng;document.cpform.czoom.value=curZoom;}}function rmouseclck(overlay,latlng){if (latlng!=null){curlat=latlng.lat();curlng=latlng.lng();curZoom=mapl.getZoom();document.cpform.lat.value=curlat;document.cpform.lng.value=curlng;document.cpform.czoom.value=curZoom;}}function lmouseclck(overlay,latlng){if (latlng!=null){curlat=latlng.lat();curlng=latlng.lng();curZoom=mapl.getZoom();document.cpform.lat.value=curlat;document.cpform.lng.value=curlng;document.cpform.czoom.value=curZoom;}}function showAddress(address){curZoom=11;geocoder = new GClientGeocoder();if (geocoder){geocoder.getLatLng(address,function(point){if (!point){alert("To increase a scale or map is yet loaded (wait a few seconds)");}else{mapl.setCenter(point, curZoom);mapr.setCenter(point, curZoom);curZoom=mapl.getZoom();document.cpform.lat.value=null;document.cpform.lng.value=null;document.cpform.czoom.value=curZoom;}});}}
