//Trim for string;
String.prototype.trim = function () {
  var nameArray   = this.split(" ");
  var returnArray = new Array();
  for(i = 0; i < nameArray.length; i++){
    if( (nameArray[i].length) > 0 ){
      returnArray.push(nameArray[i]);
    }
  }
  return returnArray.join(" ");
}

//In Array function;
Array.prototype.inArray = arrayInArray;
function arrayInArray( value ){
  for(i = 0; i < this.length; i++){
    if(this[i] == value){
  	  return true;
    }
  }
  return false;
}


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) : "");
};

