	  function doGeolocation() {
	 		//document.getElementById('info').innerHTML = "Detecting your location...";
			user_agent = navigator.userAgent;
			
			if (navigator.geolocation) {
	      navigator.geolocation.getCurrentPosition(positionSuccess, positionError);
	    } 
			else if (user_agent.indexOf("Android") != -1 || user_agent.indexOf("Chrome") != -1) {
					getGearsPosition();
			}
			else {
	      positionError(-1);
	    }
	  }
	  
  function getGearsPosition () {
  	var geo = google.gears.factory.create('beta.geolocation');
		geo.getCurrentPosition(positionSuccess, positionError);
  }

	  function positionError(err) {
	    var msg;

	    switch(err.code) {
	      case 0:
	        msg = "Unable to find your location";
	        break;
	      case 1:
	        msg = "Permissioned denied in finding your location";
	        break;
	      case 2:
	        msg = "Your location is currently unknown";
	        break;
	      case 3:
	        msg = "Attempt to find location took too long";
	        break;
	      default:
	        msg = "Location detection not supported in browser";
	    }
			//	    document.getElementById('info').innerHTML = msg;
			alert(msg);
	  }

	  function positionSuccess(position) {

			if (navigator.geolocation) {
	    	// Centre the map on the new location
	    	var coords = position.coords || position.coordinate || position;
	    	document.getElementById('s-where').value = coords.latitude+","+coords.longitude; 
			}
			else {

					//gears

					document.getElementById('s-where').value = position.latitude+","+position.longitude; 
			}
	    //zavolam ajax
			/*new Ajax.Request('/search/ajaxRevGeoCode/lat:'+coords.latitude+'/lon:'+coords.longitude+'/accuracy:'+coords.accuracy, {asynchronous:true,
		  	onComplete: function(transport){
				//	alert(transport.responseText);
				if(transport.responseText == 'Prague') { transport.responseText = transport.responseText.replace('Prague', 'Praha');}
		      $('kde').value = transport.responseText;
		    }
		  });*/
			//alert('Position detected');
			alert("Pozice nalezena");

	  }
