var MEDIAMAP_DEBUG={debug:false ,callerDetails:false,version:1};

/**
 * prints str if debug mode is on. this method tries to use the consoles provided with various browsers 
 * @param str
 */
function mm_debug(str)
{
	
	if (MEDIAMAP_DEBUG.debug)
	{
		var postfix=(MEDIAMAP_DEBUG.callerDetails&&arguments&&arguments.callee&&arguments.callee.caller)?arguments.callee.caller:false;
		try{
			if($defined(console)&&$defined(console.debug))
				{
				console.debug(str);	
				if(postfix)console.debug(postfix);
				}
			else if($defined(console)&&$defined(console.log))
				{
				console.log(str);
				if(postfix)console.log(postfix);
				}
			else if($defined(opera)&&$defined(opera.postError))
				{
				opera.postError(str);
				if(postfix)opera.postError(postfix);
				}
		}catch(e){
			//no need to print any exception
		}
		if(str==null){
			mm_trace();
		}
	}
}
/**
 * executes callback if debug mode is enabled. otherwise executes neDebugCallback if provided
 * @param callback
 * @param noDebugCallback
 */
function mm_execute(callback,noDebugCallback)
{
	if(MEDIAMAP_DEBUG.debug)
		callback();	
	else if(noDebugCallback)
		noDebugCallback();
}
/**
 * prints str if current browser is 'browser'
 * @param browser
 * @param str
 */
function mm_debugBrowser(browser, str)
{
	if(BrowserDetect.browser==browser)
		mm_debug(str);

}
/**
 * executes fn if debug mode and current browser is 'browser'
 * @param browser
 * @param fn
 */
function mm_executeBrowser(browser, fn)
{
	if(BrowserDetect.browser==browser)
		mm_execute(fn);

}
/**
 * firefox only prints the current stack trace if debug mode is enabled
 * @return
 */
function mm_trace(){
	if(MEDIAMAP_DEBUG.debug)
	{
		try{
			if($defined(console)&&$defined(console.trace))
				console.trace();
		}catch(e)
		{
			//no need to print any exception
		}
	}
	
	
}



