// Place Item
function PlaceItem(itemarray) {
    this.id = itemarray[0];
    this.name = itemarray[1];
    this.urlized_name = itemarray[2];
    this.area_id = itemarray[3];
    this.lat = itemarray[4];
    this.lng = itemarray[5];
    this.address = itemarray[6];
    this.url = itemarray[7];
    this.pistemap = itemarray[8];
    this.ticket_adult_day_peak = itemarray[9];
    this.ticket_adult_day_off_peak = itemarray[10];
    this.lifts_chair_num = itemarray[11];
    this.lifts_drag_num = itemarray[12];
    this.acres = itemarray[13];
    this.vertical_feet = itemarray[14];
    this.diff_beg_percent = itemarray[15];
    this.diff_int_percent = itemarray[16];
    this.diff_exp_percent = itemarray[17];
    this.snow_avg = itemarray[18];
    this.runs_num = itemarray[19];
    this.base_height = itemarray[20];
    this.summit_height = itemarray[21];
    this.phone = itemarray[22];
    this.webcam = itemarray[23];
    this.allowed_snowboarding = itemarray[24];
    this.runs_total_miles = itemarray[25];
    this.runs_longest_miles = itemarray[26];
    this.currency = itemarray[27];
    this.one_usd = itemarray[28];
    this.relative_size = itemarray[29];
    this.link_names = itemarray[30];
    this.link_urls = itemarray[31];
}

PlaceItem.prototype._loaded = false; //Have the place details been loaded from the server
PlaceItem.prototype.id = null; //Id for the place
PlaceItem.prototype.name = null; //Name of the place
PlaceItem.prototype.urlized_name = null; 
PlaceItem.prototype.area_id = null; 
PlaceItem.prototype.lat = null; //Latitude for the place
PlaceItem.prototype.lng = null; //Longditude for the place
PlaceItem.prototype.address = null;
PlaceItem.prototype.url = null;
PlaceItem.prototype.pistemap = null;
PlaceItem.prototype.ticket_adult_day_peak = null;
PlaceItem.prototype.ticket_adult_day_off_peak = null;
PlaceItem.prototype.lifts_chair_num = null;
PlaceItem.prototype.lifts_drag_num = null;
PlaceItem.prototype.acres = null;
PlaceItem.prototype.vertical_feet = null;
PlaceItem.prototype.diff_beg_percent = null;
PlaceItem.prototype.diff_int_percent = null;
PlaceItem.prototype.diff_exp_percent = null;
PlaceItem.prototype.snow_avg = null;
PlaceItem.prototype.runs_num = null;
PlaceItem.prototype.base_height = null;
PlaceItem.prototype.summit_height = null;
PlaceItem.prototype.phone = null;
PlaceItem.prototype.webcam = null;
PlaceItem.prototype.allowed_snowboarding = null;
PlaceItem.prototype.runs_total_miles = null;
PlaceItem.prototype.runs_longest_miles = null;
PlaceItem.prototype.currency = null;
PlaceItem.prototype.relative_size = null;
PlaceItem.prototype.link_names = null;
PlaceItem.prototype.link_urls = null;

/* Distance calculated in searches */
PlaceItem.prototype.search_distance = '';

//Load the place from the server when needed
PlaceItem.prototype.load = function() {
  var caller = this;
  if(!this._loaded) {
    $.getScript("/jsgen/place/" + this.getId(), function(){
      //TODO - remove hard coded variable name
      caller._address = place1001[place_address];
      caller._phone = place1001[place_phone];
      caller._loaded = true;
    });
  }
}
