$(document).ready(function(){
    /* Enviar Mensaje Privado */
	$('a#request_trip_pm').click(function(){
		$('#boxhelp_content').html('<center>Cargando</center>');
		$.ajax({
			type: "GET",
			url: $(this).attr('name'),
			success: function(msg){
					$('#boxhelp_content').html(msg)
			}
		});
		var offset = $(this).offset();
		var left = Math.round(offset.left)-150;
		var top = Math.round(offset.top)-100;
		$('#ajax_boxhelp').css('left',left+'px').css('top',top+'px').css('margin','0').fadeIn();
		$('#ajax_boxgray').animate({opacity: 0.7}, 100 ).css('display','block').height($('body').height()+40);
		//alert( "left: " +  + ", top: " + Math.round(offset.top) )
	});
    /*
    $('a#request_trip_pm_send').click(function(){
		$('#info-trip').html('<center>Enviando...</center>');
		$.ajax({
			type: "POST",
			url: $(this).attr('name'),
            data: $("#request_trip_pm").serialize(),
			success: function(msg){
					$('#info-trip').html(msg)
			}
		});
	});
    */
});

/* Optional parameter: successObject
 **/
function silently_post(url_string,formObject,infoObject,processingData,successObject){
    if(successObject === undefined)
        successObject = infoObject;
    $(infoObject).html(processingData);
    $.ajax({
			type: "POST",
			url: url_string,
            data: $(formObject).serialize(),
			success: function(msg){
					$(successObject).html(msg)
            }
    });
}

function changeButton(a1Object, a2Object){
    $(a1Object).attr('style', 'display: none');
    $(a2Object).attr('style', 'display: block');
}