
function priceWithDiscount(price, discount, type) {
	var p = 0;
	if (type == "money") {
		p = (price - discount);
	}
	if (type == "percent") { 
		p = (price - ((price * discount) / 100));
	}
	if(!(Boolean(p).valueOf()))
		p = 0;
	p = Math.round(p*100)/100;
	return p;
}//priceWithDiscount

function priceWithDatedDiscount(price, discount, type, now, start, stop) {
	if (now == null || start == null || stop == null)
		return price;
	if (now >= start && now < stop)
		return priceWithDiscount(price, discount, type);
	return price;
}//priceWithDatedDiscount

function priceOriginalAndDiscount(price, discount, type) {
	if (discount && discount != 0)
		return "<s>"+price+"</s>&nbsp;/&nbsp;"+priceWithDiscount(price, discount, type)+"";
	return price;
}//priceOriginalAndDiscount

function priceOriginalAndDatedDiscount(price, discount, type, now, start, stop) {
	if (now == null || start == null || stop == null)
		return price;
	if (now >= start && now < stop)
		return priceOriginalAndDiscount(price, discount, type);
	return price;
}//priceOriginalAndDatedDiscount


