String.prototype.trim=function()
{return this.replace(/^\s\s*/,'').replace(/\s\s*$/,'');};String.prototype.isNumber=function()
{if(this==''||!this.match(/^(\d+)(\.(\d+))?$/))
{return false;}
else
{return true;}}
String.prototype.isDate=function()
{var dateRegEx=/^(?=\d)(?:(?:(?:(?:(?:0?[13578]|1[02])(\/|-|\.)31)\1|(?:(?:0?[1,3-9]|1[0-2])(\/|-|\.)(?:29|30)\2))(?:(?:1[6-9]|[2-9]\d)?\d{2})|(?:0?2(\/|-|\.)29\3(?:(?:(?:1[6-9]|[2-9]\d)?(?:0[48]|[2468][048]|[13579][26])|(?:(?:16|[2468][048]|[3579][26])00))))|(?:(?:0?[1-9])|(?:1[0-2]))(\/|-|\.)(?:0?[1-9]|1\d|2[0-8])\4(?:(?:1[6-9]|[2-9]\d)?\d{2}))($|\ (?=\d)))?(((0?[1-9]|1[012])(:[0-5]\d){0,2}((\ |)[AP]M))|([01]\d|2[0-3])(:[0-5]\d){1,2})?$/;if(this==''||!this.match(dateRegEx))
{return false;}
else
{return true;}}
String.prototype.formatMoney=function(currency_symbol_before,currency_symbol_after,thousands_separator,decimal_point,significant_after_decimal_pt,display_after_decimal_pt)
{amount=this;var significant_multiplier=Math.pow(10,significant_after_decimal_pt);var str_minus=(amount*significant_multiplier<=-0.5?"-":"");amount=parseFloat(amount);if(isNaN(amount)||Math.LOG10E*Math.log(Math.abs(amount))+Math.max(display_after_decimal_pt,significant_after_decimal_pt)>=21)
{return str_minus+currency_symbol_before+(isNaN(amount)?"#":"####################".substring(0,Math.LOG10E*Math.log(Math.abs(amount))))+(display_after_decimal_pt>=1?(decimal_point+"##################".substring(0,display_after_decimal_pt)):"")+currency_symbol_after;}
amount=Math.abs(amount)+(0.5/significant_multiplier);amount*=significant_multiplier;var str_display=parseInt(parseInt(amount)*Math.pow(10,display_after_decimal_pt-significant_after_decimal_pt)).toString();if(str_display.length<=display_after_decimal_pt)
str_display=(Math.pow(10,display_after_decimal_pt-str_display.length+1).toString()+str_display).substring(1);var comma_sep_pounds=str_display.substring(0,str_display.length-display_after_decimal_pt);var str_pence=str_display.substring(str_display.length-display_after_decimal_pt);if(thousands_separator.length>0&&comma_sep_pounds.length>3)
{comma_sep_pounds+=",";if(comma_sep_pounds.length>7)
comma_sep_pounds=comma_sep_pounds.replace(/(?=[0-9]([0-9]{3})+,)(.)(...)/g,"$2,$3");comma_sep_pounds=comma_sep_pounds.replace(/(?=[0-9]([0-9]{3})+,)(.)(...)/g,"$2,$3");comma_sep_pounds=comma_sep_pounds.substring(0,comma_sep_pounds.length-1).replace(/,/g,thousands_separator);}
return str_minus+currency_symbol_before+comma_sep_pounds+(display_after_decimal_pt>=1?(decimal_point+str_pence):"")+currency_symbol_after;}