function number_format(number,decimals,dec_point,thousands_sep)
{var exponent="";var numberstr=number.toString();var eindex=numberstr.indexOf("e");if(eindex>-1)
{exponent=numberstr.substring(eindex);number=parseFloat(numberstr.substring(0,eindex));}
if(decimals!=null)
{var temp=Math.pow(10,decimals);number=Math.round(number*temp)/temp;}
var sign=number<0?"-":"";var integer=(number>0?Math.floor(number):Math.abs(Math.ceil(number))).toString();var fractional=number.toString().substring(integer.length+sign.length);dec_point=dec_point!=null?dec_point:".";fractional=decimals!=null&&decimals>0||fractional.length>1?(dec_point+fractional.substring(1)):"";if(decimals!=null&&decimals>0)
{for(i=fractional.length-1,z=decimals;i<z;++i)
fractional+="0";}
thousands_sep=(thousands_sep!=dec_point||fractional.length==0)?thousands_sep:null;if(thousands_sep!=null&&thousands_sep!="")
{for(i=integer.length-3;i>0;i-=3)
integer=integer.substring(0,i)+thousands_sep+integer.substring(i);}
return sign+integer+fractional+exponent;}
function currencyFormatted(amount)
{var i=parseFloat(amount);var s=i.toFixed(2);return s.replace('.',',');}
function html_entity_decode(str){var ta=document.createElement("textarea");ta.innerHTML=str.replace(/</g,"&lt;").replace(/>/g,"&gt;");return ta.innerHTML;}
function in_array(item,arr){for(p=0;p<arr.length;p++)if(item==arr[p])return true;return false;}
function LoadScript(url)
{var script=document.createElement("script");script.src=url;script.type="text/javascript";document.getElementsByTagName("head")[0].appendChild(script);}
function addLoadEvent(func)
{var oldonload=window.onload;if(typeof window.onload!='function')
{window.onload=func;}
else
{window.onload=function()
{if(oldonload)
{oldonload();}
func();}}}
function getSize(){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){myWidth=window.innerWidth;myHeight=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=document.documentElement.clientWidth;myHeight=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=document.body.clientWidth;myHeight=document.body.clientHeight;}
return[myWidth,myHeight];}
