function SetActivePricingRow(tableRow){
	var priceListTable = document.getElementById('pricingLeftScrollTable');
	var unitID = parseInt(tableRow.id.split('unit')[1]);
	
	var pricingListFloorplanLabel = document.getElementById('pricingListFloorplanLabel');
	var trArray = priceListTable.getElementsByTagName('tr');
	for(i = 0; i < trArray.length; i++){
		jsCSS('remove',trArray[i],'activePricingRow');
	}

	jsCSS('add',tableRow,'activePricingRow');

	pricingListFloorplanLabel.innerHTML = "THE " + unitsArray[unitID].floorplan.toUpperCase();
}



function PopulatePricingTable(){
	var pricingTable = document.getElementById('pricingLeftScrollTableBody');
	
	for(i=1; i < 29; i++){
		if(i == 4 || i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 12 || i == 16 || i == 22|| i == 24|| i == 26 || i == 27 || i == 28){
		var currentUnit = unitsArray[i];
		
		var newRow = document.createElement('tr');
		newRow.id = "unit" + currentUnit.unitId;
		
		var newAddressTD = document.createElement('td');
		var newUnitTD = document.createElement('td');
		var newFloorplanTD = document.createElement('td');
		var newStoriesTD = document.createElement('td');
		var newBedroomsTD = document.createElement('td');
		var newBathsTD = document.createElement('td');
		var newStudyTD = document.createElement('td');
		var newSizeTD = document.createElement('td');
		var newPriceTD = document.createElement('td');
		
		newAddressTD.innerHTML = currentUnit.address;
		newUnitTD.innerHTML = currentUnit.unitId;
		newFloorplanTD.innerHTML = currentUnit.floorplan;
		newStoriesTD.innerHTML = currentUnit.stories;
		newBedroomsTD.innerHTML = currentUnit.bedrooms;
		newBathsTD.innerHTML = currentUnit.baths;
		newStudyTD.innerHTML = currentUnit.study;
		newSizeTD.innerHTML = currentUnit.sqft;
		newPriceTD.innerHTML = currentUnit.price;
		
		//newRow.appendChild(newAddressTD);
		newRow.appendChild(newUnitTD);
		newRow.appendChild(newFloorplanTD);
		newRow.appendChild(newStoriesTD);
		newRow.appendChild(newBedroomsTD);
		newRow.appendChild(newBathsTD);
		newRow.appendChild(newStudyTD);
		newRow.appendChild(newSizeTD);
		newRow.appendChild(newPriceTD);
	
		pricingTable.appendChild(newRow);
		
		newRow.onclick = function(){
			SetActivePricingRow(this);
		}}
	}
	
	initScrollLayer();
}

function DoSomething(e){
	trace(e);
}
