function formatCurrency(num) {num = num.toString().replace(/\$|\,/g,'');if(isNaN(num))num = "0";sign = (num == (num = Math.abs(num)));num = Math.floor(num*100+0.50000000001);cents = num%100;num = Math.floor(num/100).toString();if(cents<10)cents = "0" + cents;for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));return (((sign)?'':'-') + '$' + num + '.' + cents);}

Number.prototype.formatMoney = function(c, d, t){
	var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
	return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
};

function changePrice()
{


var tempOut;
var tempOut2;
var tempOut3;
var tempOut4;
var numberOption;
var newTotal=0;
var tempValue;
var accValue=0;
var f=parseFloat(price);

for (m=0; m<document.forms.length; m++)
{
	for (i=0; i<document.forms[m].elements.length; i++)
 	 {
	    if(document.forms[m].elements[i].type=="select-one")
  		  {
   		   tempValue=document.forms[m].elements[i].value;

                   accValue=accValue + tempValue;
                   tempOut=tempValue.split("$");
				   
				   
				   if(tempOut.length > 1)
				   {
					   tempOut2=tempOut[1];
					   tempOut3=tempOut2.split(")");
					   tempOut4=tempOut3[0];
					   numberOption=parseFloat(tempOut4);
					   f=f+numberOption;
					   newTotal=Math.round(parseFloat(f) * 100) / 100;
					}
					
    
       		  }
 	 }

}

 $("#NewPrice").text("");
if(newTotal !=0)
{
 $("#NewPrice").append("<div class=priceWithOptionsText>Price w/ options: </div><div class=priceWithOptionsPrice>("+formatCurrency(newTotal)+")</div>");
}
}
