/**
 * jeGroupBuy package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2010 - 2011 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

function discount(){

	var path 	 = document.getElementById('jegroupbuy-sitepath').value;
	var p		 = document.getElementById('product_price').value;
	var dis		 = document.getElementById('product_discount').value;

	var reduction= p*(dis/100);
	var savevalue= roundNumber(reduction,2);
	var amount	 = p-reduction;
	var deal 	 = roundNumber(amount,2);

	document.getElementById('you_save').value = savevalue;
	document.getElementById('deal_price').value = deal;
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}