/*
 * Copyright 2000-2008 namics ag. All rights reserved.
 */

/**
 * TV utilities
 * 
 * @author Remo Brunschwiler, namics ag
 */
TV.util = {
	log: function(text, level){
		var level = level || TV.CONSTANTS.DEBUG.LEVEL.DEBUG;
		
		function getConsoleFunction(level) {	
			var str = 'log', item;
			
			for (item in TV.CONSTANTS.DEBUG.LEVEL) {
				if (level == TV.CONSTANTS.DEBUG.LEVEL[item]) {
					str = item.toLowerCase();
					break;
				}
			}
			return str;
		}
		
		if (level <= TV.CONFIG.DEBUG_LEVEL) {	
			if (typeof(window['console']) !== "undefined") {
				try {
					window.console[getConsoleFunction(level)]("%s", text);
				} 
				catch (e) {}
			}
		}
	}
};

