function Util(){

}

// Checks if valid e-mail address
Util.isEmail = function ( string ) { return /^[a-zA-Z0-9_\.\-]+\@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9]{2,4})+$/.test(string); };

Util.confirmAction = function ( text, url ){
	var b = confirm( text );
	if (b) document.location = url;
}

Util.popup = function ( url, w, h ){
	w = ( w == null ) ? 600 : w;
	h = ( h == null ) ? 500 : h;	
	window.open(url,"_blank","menubar=1,resizable=1,scrollbars=yes,width="+w+",height="+h+"");
}

Util.formatAsMoney = function(mnt) {
    mnt -= 0;
    mnt = (Math.round(mnt*100))/100;
    return (mnt == Math.floor(mnt)) ? mnt + '.00' 
              : ( (mnt*10 == Math.floor(mnt*10)) ? 
                       mnt + '0' : mnt);
}

/**
 * Dumps contents of an object
 *
 * @param	object		object you want to view
 *
 * @return	bool 		whether they clicked ok or cancel from confirm box
 *
 */
Util.dump = function ( obj ){
	var str = "<table style='border: 1px solid gray; font-family: MS Sans Serif; font-size: 10px' border=0>";
	var bg = "white";
	for ( var key in obj ){
		bg = ( bg == "white" ) ? "#eeeeee" : "white";
		str += "<tr><td align='right' bgcolor='" + bg + "'><b>" + key + ":</b></td><td bgcolor='" + bg + "'>" + obj[ key ] + "</td></tr>";
	}
	str += "</table>";
	var win = window.open(url,"_blank","menubar=1,resizable=1,scrollbars=yes,width=600,height=500");
	win.document.write( str );
}

