/* GZIP by Raccoon Framework */ /** * @author Alejandro Galindo, twitter.com/elalecs * @version 1.1, January 2011 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL */ var rcn_ = { regexp : { email : /[a-z0-9!#$%&'*+\/=?^RCN.{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^RCN.{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/ }, /** * @author http://efficienttips.com/convert-string-title-case-javascript/ */ toTitleCase : function(str) { return str.replace(/\w\S{3,}/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}); }, toCurrency : function(amount) { amount = amount.toString().replace(/[^.0-9]/g, ""); amount = parseFloat(amount).toFixed(2); amount = amount.toString(); var size = amount.length; if (size >= 7 && size <= 9) { amount = amount.replace(/(\d{1,3})(\d{3})\.(\d{2})/, '$1,$2.$3'); } else if (size >= 10 && size <= 12) { amount = amount.replace(/(\d{1,3})(\d{3})(\d{3})\.(\d{2})/, '$1,$2,$3.$4'); } else if (size >= 13 && size <= 15) { amount = amount.replace(/(\d{1,3})(\d{3})(\d{3})(\d{3})\.(\d{2})/, '$1,$2,$3,$4.$5'); } return "$ " + amount; }, getHashBy : function(selector_or_reference, remove_text_from_name) { var hash = {}; $(selector_or_reference).each(function() { var self = $(this); var property = self.attr("id") !== "" ? self.attr("id") : self.attr("name"); if (property === "") { property = self.attr("name") !== "" ? self.attr("name") : self.attr("id"); } if (remove_text_from_name != undefined) { property = property.replace(remove_text_from_name, ""); } if (property !== "") { hash[property] = self.val(); } }); return hash; }, postByForm : function(url, params, debug) { var form = $("