	/*
		*	Utility Manager Class
		* 	Author: Ark Rozycki
	*/

	var utility = new function(){
	
		// utility function to help extracts values of checkbox groups
		this.getCheckboxGroupVals = function(objChkBox){
			var arrVals = [];
			// loop through the group and add 
			for (i = 0; i < objChkBox.length; i++){
				if(objChkBox[i].checked)
					arrVals.push(objChkBox[i].value);
			}
			return arrVals;
		};
		
		// function to split out the params into an array
		this.queryStringtoArray = function() {
			var qsParm = [];
			var query = window.location.href.replace('http://', '');
			var parms = query.split('/');
			
			// check if anything is there at all, otherwise skip it
			if(parms.length >= 4){
				
				// set the iid
				qsParm['iid'] = parms[3];
				
				// get the pid
				if(parms.length > 4)
					qsParm['pid'] = parms[4];
					
				// get the user id
				if(parms.length > 5)
					qsParm['uid'] = parms[5];
			}
			
			return qsParm;
		};
		
		// format currency
		this.CurrencyFormatted = function(strValue)
		{
			strValue = strValue.toString().replace(/\$|\,/g,'');
			dblValue = parseFloat(strValue);

			blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
			dblValue = Math.floor(dblValue*100+0.50000000001);
			intCents = dblValue%100;
			strCents = intCents.toString();
			dblValue = Math.floor(dblValue/100).toString();
			if(intCents<10)
				strCents = "0" + strCents;
			for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
				dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
				dblValue.substring(dblValue.length-(4*i+3));
			return (((blnSign)?'':'-') + '$' + dblValue);
		};
		
		this.digits = function(str){ 
		    return str.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
		};
	};


