function currencyFormat(n,t,c){
	var i,j,b,rr,rt,d=2,f=t?(c?currencyFormatDiscount:currencyFormatDiscountColor):(c?currencyFormatNormal:currencyFormatNormalColor);
	n=Math.round(Math.pow(10,d)*n);
	n=n.toString();
	while(n.length<d) n+='0';
	rt=f.split('{DEC}').join(n.substr(n.length-d));
	n=n.substr(0,n.length-d);
	if(!n) n='0';
	n=n.split('').reverse();
	d=f.split('{BLOCK}');
	b=d.length-1;
	d=d[1];
	rr=new Array();
	j=0;
	for(i=0;i< n.length;i++){
		if(d && i && !(i%3))rr[j++]=d;
		rr[j++]=n[i];
	}
	j='';
	for(i=0;i<b;i++){
		if(i)j+=d;
		j+='{BLOCK}';
	}
	rt=rt.split(j).join(rr.reverse().join(''));
	return rt;
}

