function nDUnit (inc, incImages) {
	if (inc == null) return null;
	this.id = (inc.getAttribute("unit_id") == null)?"":inc.getAttribute("unit_id");
	this.cost = (inc.getAttribute("unit_cost") == null)?"":inc.getAttribute("unit_cost");
	this.features = (inc.getAttribute("unit_features") == null)?"":inc.getAttribute("unit_features");
	this.label = (inc.getAttribute("unit_label") == null)?"":inc.getAttribute("unit_label");
	this.beds = (inc.getAttribute("unit_bedroom_count") == null)?"0":inc.getAttribute("unit_bedroom_count");
	this.baths = (inc.getAttribute("unit_bathroom_full_count") == null)?"0":inc.getAttribute("unit_bathroom_full_count");
	this.halfbaths = (inc.getAttribute("unit_bathroom_half_count") == null)?"0":inc.getAttribute("unit_bathroom_half_count");
	this.deposit = (inc.getAttribute("unit_deposit") == null)?"":inc.getAttribute("unit_deposit");
	this.size = (inc.getAttribute("unit_size") == null)?"":inc.getAttribute("unit_size");
	this.text = (inc.getElementsByTagName("text").length > 0)?getDOMText(inc.getElementsByTagName("text")[0]):"";
	this.fp = (inc.getAttribute("unit_fp"))?inc.getAttribute("unit_fp"):0;
	
	var address = inc.getElementsByTagName("address")[0];
	
	this.address_street_1 = address.getAttribute("address_street_1");
	this.address_city = address.getAttribute("address_city");
	this.address_state = address.getAttribute("address_state");
	this.address_postal = address.getAttribute("address_postal");
	this.address_lat = address.getAttribute("address_lat");
	this.address_lng = address.getAttribute("address_lng");
	
	var temp = getObjectSpecs(inc, "feature");
	this.feature_specs = temp[0];
	this.feature_text = temp [1];
	temp = getObjectSpecs(inc, "utility");
	this.utility_specs = temp[0];
	this.utility_text = temp [1];
	temp = getObjectSpecs(inc, "accessibility");
	this.accessibility_specs = temp[0];
	this.accessibility_text = temp [1];
	temp = getObjectSpecs(inc, "parking");
	this.parking_specs = temp[0];
	this.parking_text = temp [1];
	temp = getObjectSpecs(inc, "petpolicy");
	this.petpolicy_specs = temp[0];
	this.petpolicy_text = temp [1];
	temp = getObjectSpecs(inc, "kitchen");
	this.kitchen_specs = temp[0];
	this.kitchen_text = temp [1];
	temp = getObjectSpecs(inc, "laundry");
	this.laundry_specs = temp[0];
	this.laundry_text = temp [1];
	
	temp = inc.getElementsByTagName("listing");
	if (temp.length > 0) {
		this.listing_date_start = temp[0].getAttribute("listing_date_start");
		this.listing_date_end = temp[0].getAttribute("listing_date_end");
		this.listing_date_available = temp[0].getAttribute("listing_date_available");
		this.listing_head_line = temp[0].getAttribute("listing_head_line");
		this.listing_text = (temp[0].getElementsByTagName("text").length > 0)?getDOMText(temp[0].getElementsByTagName("text")[0]):"";
	} else {
		this.listing_date_start = "";
		this.listing_date_end = "";
		this.listing_date_available = "";
		this.listing_head_line = "";
		this.listing_text = "";
	}

	this.images = [];
	if (incImages != null) for (var x = 0; x < incImages.length; x++) {
		if (incImages[x].getAttribute("id") == this.id && incImages[x].getAttribute("type") == "4") this.images.push(incImages[x]);
	}
	
	return this;
}

function nDFloor (inc, incImages) {
	if (inc == null) return null;
	this.id = (inc.getAttribute("floor_id") == null)?"":inc.getAttribute("floor_id");
	this.parent_id = (inc.getAttribute("building_id") == null)?"":inc.getAttribute("building_id"); 
	this.images = [];
	if (incImages != null) for (var x = 0; x < incImages.length; x++) { this.images.push(incImages[x]); }
	
	return this;
}

function nDBuilding (inc, incImages) {
	if (inc == null) return null;
	this.id = (inc.getAttribute("building_id") == null)?"":inc.getAttribute("building_id");
	this.parent_id = (inc.getAttribute("property_id") == null)?"":inc.getAttribute("property_id"); 
	this.images = [];
	if (incImages != null) for (var x = 0; x < incImages.length; x++) { this.images.push(incImages[x]); }
	return this;
}

function nDProperty (inc, incImages) {
	if (inc == null) return null;
	this.id = (inc.getAttribute("property_id") == null)?"":inc.getAttribute("property_id");
	this.parent_id = (inc.getAttribute("portfolio_id") == null)?"":inc.getAttribute("portfolio_id"); 
	this.images = [];
	this.label = (inc.getAttribute("property_label") == null)?"":inc.getAttribute("property_label");
	this.head_line = (inc.getAttribute("property_head_line") == null)?"":inc.getAttribute("property_head_line");
	this.type = (inc.getAttribute("property_type") == null)?"":inc.getAttribute("property_type");
	this.incentive = (inc.getAttribute("property_incentive") == null)?"":inc.getAttribute("property_incentive");
	this.min_age = (inc.getAttribute("property_min_age") == null)?"":inc.getAttribute("property_min_age");
	this.listing_type = (inc.getAttribute("property_listing_type") == null)?"0":inc.getAttribute("property_listing_type");
	
	this.text = (inc.getElementsByTagName("text").length > 0)?getDOMText(inc.getElementsByTagName("text")[0]):"";
	
	var address = inc.getElementsByTagName("address")[0];
	
	this.address_street_1 = address.getAttribute("address_street_1");
	this.address_city = address.getAttribute("address_city");
	this.address_state = address.getAttribute("address_state");
	this.address_postal = address.getAttribute("address_postal");
	this.address_lat = address.getAttribute("address_lat");
	this.address_lng = address.getAttribute("address_lng");
	
	var temp = getObjectSpecs(inc, "feature");
	this.feature_specs = temp[0];
	this.feature_text = temp [1];

	if (incImages != null) for (var x = 0; x < incImages.length; x++) { this.images.push(incImages[x]); }
	
	return this;
}

function getObjectSpecs(xml, feature) {
	var spec = xml.getElementsByTagName(feature);
	if (spec.length > 0) return [spec[0].getAttribute(feature + "_specs"), ((spec[0].getElementsByTagName("text").length > 0)?getDOMText(spec[0].getElementsByTagName("text")[0]):"")];
	else return [0, ""];
}