
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ trim
//++
//++ extends the default string functions to include
//++ a trim function
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ""); };

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ formatDollars()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function formatDollars(inNum){
	
	//need to remove any prev formating
	tmpStr=inNum+'';	//force to be a string
	tmpStr=tmpStr.replace(/,/g, '');
	tmpStr=tmpStr.replace(/$/g, '');
	
	var num = new Number(tmpStr);
	//window.alert(num.toFixed(2));
	if (num.toFixed){	//make sure function is avail
		return addCommas(num.toFixed(2));
	}else{
		return addCommas(inNum);
	}
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ addCommas()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function addCommas(nStr){
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ formatZipCode()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function formatZipCode(inObj){
	
	newVal=inObj.value;
	
	newVal=newVal.replace(/[^0-9, -]/g, ''); 
	
	inObj.value=newVal;
	
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ trim()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function trim(stringToTrim){
	return stringToTrim.replace(/^\s+|\s+$/g,'');
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ ltrim()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function ltrim(stringToTrim){
	return stringToTrim.replace(/^\s+/,'');
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ rtrim()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function rtrim(stringToTrim){
	return stringToTrim.replace(/\s+$/,'');
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++ setCookie()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function setCookie(inName, inValue, inExpires){
	var expDate=new Date();
	expDate.setDate(expDate.getDate()+inExpires);
	document.cookie=inName+ "=" +escape(inValue)+((inExpires==null) ? "" : ";expires="+expDate.toGMTString());
	
}

