/* 
 * Created by David Galvis
 */


function WantToGo() {
    
}
WantToGo.prototype =
{
    /**
     * Adds the restaurant to users list
     */
    there: function(idRestaurant){
	if(typeof _gaq !="undefined")
	{
		_gaq.push(['_trackEvent', 'RESTAURANT', 'WANT_TO_GO', '']);
	}
        jQuery.post("/application/ajax/wantToGo.php", {idRestaurant: idRestaurant, add:true});
    },

    /**
     * Adds the restaurant to users list
     */
    notThere: function(idRestaurant){
        jQuery.post("/application/ajax/wantToGo.php", {idRestaurant: idRestaurant, add:false});
    },

    init : function(){
        var _this = this;
        jQuery( "input[ name = 'wantToGo' ]" ).click( function( event ){
            if( jQuery( this ).attr( "checked" ) ){
                _this.there(jQuery( this ).val());
                jQuery(this).prev('img').show();
                jQuery(this).next('span').html(trad_i_want_go);
            }
            else {
                _this.notThere(jQuery( this ).val());
                jQuery(this).prev('img').hide();
                jQuery(this).next('span').html(trad_would_like_go_there);
            }
        });
    }
};

var wantToGo = new WantToGo();



