$(document).ready(function() {
    $('a[rel*=facebox]').facebox();
		$('#search').keyup(function(event) {
  		if(event.keyCode == 13 && $('#search').val().length > 0) {
				window.location = '/search-1.html?keywords=' + $(this).val();
			}
		});
		
		$.post("/main/xsrv_local_escorts", { html: $('#user-location').html() }, function(data) {
			var obj = $.parseJSON(data);
			if(obj.success == 1) {
				$('#local-escorts').html(obj.out);
				$('#local-city').text(obj.city + ' Escorts');
			} else {
				$('#local-escorts').hide();
				$('#local-city').hide();
			}
		});		
		
});

function delete_msg(message_id) {
	$.post("/member/xsrv_remove", { id: message_id }, function(data) {
		$('#msg' + message_id).animate({height: "0", opacity:0}, "slow", function(evt) { $(this).remove(); }); 
	});	
}

function rate_profile(mid, type, score)
{
	$.post("/member/xsrv_rate", { member_id: mid, rating_type: type, rating: score }, function(data) {
		$()
	});		
}

function get_location() {
  if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
      var lat = position.coords.latitude;
      var lng = position.coords.longitude;
      var postdata = 'latitude=' + lat + '&longitude=' + lng;

      $.post("/main/save_location", { latitude: lat, longitude: lng }, function(data) {

      });
    });
  }
}
