
String.prototype.titleCase = function () {
   var parts = this.split(' ');
   if ( parts.length == 0 ) return '';

   var fixed = new Array();
   for ( var i in parts ) {
      var fix = '';
      fix = parts[i].substr(0,1).toUpperCase() + parts[i].substr(1,parts[i].length).toLowerCase();
      fixed.push(fix);
   }
   fixed[0] = fixed[0].substr(0,1).toUpperCase() + fixed[0].substr(1,fixed[0].length).toLowerCase();
   var temp = fixed.join(' ');
   return temp;
}

function paypal(total_fees, desc) {
   var link="https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=umcahq@aol.com&amount="+total_fees+"&item_name="+desc;
   window.open(link,'','scrollbars=yes,menubar=no,height=600,width=800,resizable=yes,toolbar=yes,location=yes,status=yes');
}


function mailMe(adr,srvr) {
	pfx = "mailto:";
	at = "@";
	msg = pfx + adr + at + srvr  +"?subject=Membership-database";
	newWindow = open(msg);
	return true;
}

function getElementsByStyleClass (className) {
  var all = document.all ? document.all :
    document.getElementsByTagName('*');
  var elements = new Array();
  for (var e = 0; e < all.length; e++)
    if (all[e].className == className)
      elements[elements.length] = all[e];
  return elements;
}

function isNum(arg){
    return parseFloat(arg)!=NaN;
}

function StringBuffer() { this.buffer = []; }

StringBuffer.prototype.append = function(string) {
  this.buffer.push(string);
  return this;
}

StringBuffer.prototype.toString = function(){
   return this.buffer.join("");
}

/**
var Url = {

    // public method for url encoding
    encode : function (string) {
        //return escape(this._utf8_encode(string));
		return encodeURIComponent(string);
    },

    // public method for url decoding
    decode : function (string) {
        //return this._utf8_decode(unescape(string));
		return  decodeURIComponent(string);
    },

    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";
        for (var n = 0; n < string.length; n++) {
            var c = string.charCodeAt(n);
            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode ((c & 63) | 128);
            }
        }
        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while ( i < utftext.length ) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode (c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
        }
        return string;
    }
}
**/

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

