chrome.extension.onRequest.addListener(function(request, sender, sendResponse) {
    if (request.command === "get-location") {
        try {
			navigator.geolocation.getCurrentPosition(
				function(position) {
					sendResponse({ lat : position.coords.latitude, lng : position.coords.longitude}, function(tab) {});
				}, 
				function(){
					sendResponse({ err : 1}, function(tab) {});
				}
			);
		}
		catch(ex){}
	}
});

/* init setting fvd */

function setWidgetInfo() {
    fvdSpeedDialLink.setWidgetInfo({
        path: "/widget.html",
        widthCells: localStorage["widget_width"] || 1,
        heightCells: localStorage["widget_height"] || 1,
        width: 240,
        height: 190
    });
}

setWidgetInfo();

chrome.runtime.onMessage.addListener(function (msg) {
    if (msg.a == "set_widget_info") {
        setWidgetInfo();
    }
});

