function t(x, y) {
	var tt = 4.37; //3.187047;
	var cc = Math.cos(tt / 180 * Math.PI);
	var ss = Math.sin(tt / 180 * Math.PI);
	var er = 20903520; // feet per spherical radian
	var x0 = 4095 + 15; // empirical adjustment 5 feet east
	var y0 = 3102;
	var x1 = (x - x0) * cc - (y - y0)  * ss;
	var y1 = (x - x0) * ss + (y - y0) * cc;
	this.lat = 37.762429 + y1 / er / Math.PI * 180;
	var ec = Math.cos(this.lat / 180 * Math.PI);
	this.lng = -122.434982 + x1 / er / Math.PI * 180 / ec;
}

function FT(x, y, title, address1, specialties) {
	this.point = new t(x, y);
	this.title = title;
	this.addressLine1 = address1;
	this.specialties = specialties;
	this.getInfoHTML = function() {return "<div class='poi'>" + this.title + "</div><div>" + this.addressLine1 + "</div><div class='specs'>" + this.specialties + "</div>"};
}

function iw(f) {
    return "<div class='poi'>" + f.title + "</div><div>" + f.addressLine1 + "</div><div class='specs'>" + f.specialties + "</div>";
    //html += "<a href='javascript:void(0)' onclick='map.infoWindowNavigate(function() {}, _from)'>from here</a>";
}

document.write("<script src='http://maps.google.com/maps?file=api&v=1&key=ABQIAAAAz9DvElXb_WK9hoO_Sa9R2RQyLES87K-pNds4epizaTcalswq8xTfzCKS_etVFpbaM_veO6nkXFvCaA' type='text/javascript'></script>");

var _from = "from";
function directionsto() {
	//map.infoWindowNavigate(function() {var e = document.getElementById('infoEnd');var ia = document.getElementById('infoStart').value;if (ia != getDirectionsEnd().value) {e.value = getDirectionsEnd().value;getDirectionsStart().value = ia;}e.select();_makePasteBox(e);}, 'from');
	map.infoWindowNavigate(function() {}, 'from');
}
var map;
function loadit() {    
    map = new GMap(document.getElementById("map"));
	map.addControl(new GSmallMapControl());
	map.addControl(new GMapTypeControl());
    map.centerAndZoom(new GPoint(-122.434982, 37.762429), 2);	   
    
    //var p4 = new t(_feature.x, _feature.y); // Safeway P554
    
    //var marker = new GMarker(new GPoint(p4.lng, p4.lat));
    //var marker = new GMarker(new GPoint(_fs[0].point.lng, _fs[0].point.lat));
    var markers = new Array();
    for (i=0; i<_fs.length; i++) {
    	var marker = new GMarker(new GPoint(_fs[i].point.lng, _fs[i].point.lat));
    	map.addOverlay(marker);
    	markers.push(marker);
    }
    
    //var point = new GPoint(-122.43425, 37.76309); // Ageo geocoder 2362 Market
   	//var point = new GPoint(-122.434982, 37.762429); // Tigerline intersection of 17th & Castro
    //var marker = new GMarker(point);
    
    //marker.openInfoWindowHtml(iw(_feature));
    markers[0].openInfoWindowHtml(_fs[0].getInfoHTML());
    //marker.openInfoWindowHtml(iw(_fs[0]));
    return false;
}

window.onload = loadit;

_fs = new Array();

