﻿function calcPrice() {
	var table = pxDOM.byId("room");
	var dayCount = pxDOM.byId("dayCount").value;
	for (var i = 3; i < table.rows.length; i++) {
		var value = getCellValue(table.rows[i].cells[1]);
		var price = getPrice(value);
		if (table.rows[i].cells[1]) {
			table.rows[i].cells[1].innerHTML = pxNum.formatCurr((parseFloat(price) * dayCount).toString()).toString();
		}
		if (table.rows[i].cells[2]) {
			value = getCellValue(table.rows[i].cells[2].childNodes[1]);
			price = getPrice(value);
			table.rows[i].cells[2].childNodes[1].innerHTML = pxNum.formatCurr((parseFloat(price) * dayCount).toString()).toString();
		}
		
	}
	//alert(pxDOM.byId("room"));
}

function getCellValue(cell) {
	if (!cell) return;
	if (cell.price) return cell.price;
	cell.price = cell.innerHTML;
	return cell.price;
}

function getPrice(value) {
	if (!value) return;
	var temp = value.split(" ");
	return temp.join("");
}

function changeFoto(path) {
	pxDOM.byId("bigFoto").src = "../data/hotel/" + path;
}

function changeFotoRoom(path) {
	pxDOM.byId("bigFoto").src = "../data/room/" + path;
}
