js.module('debug');

debug.alert = function(obj, regex)
{
	var s='';
 	var count=0;
 		
	for(i in obj)
   	{
		if(!regex || (i.indexOf && i.indexOf(regex)!=-1))
		{
			s+= "\r\n" + i + " => " + obj[i];
			count++;
		}
   		
   		if(count > 10)
   		{
   			if(!confirm(s)) return;
   			
   			count=0;
   			s='';
   		}
   	}
    
    if(count>0)
    	alert(s);
};