/**
 * Plik z różnymi przydatnymi funkcjami do JS (niezależne od Ext-ów)
 * @author Piotr Krokowski
 * @varsion 28.02.2008
 **/

// Klonowanie obiektów w JS
function clone(myObj) {
	if(typeof(myObj) != 'object') return myObj;
	if(myObj == null) return myObj;

	var myNewObj = new Object();

	for(var i in myObj)
		myNewObj[i] = clone(myObj[i]);

	return myNewObj;
}

/* Globalna funkcja do escape-owania znaków & pod IE */
function esc(str) {
	if (Ext.isIE)
		var str = str.replace("&", "&amp;", "gi");
	return str;
}

///Zapobieganie błedom JS przy braku obiektu console
if (typeof(console)=='undefined') {
	console = {
		info: function (t) {this.softDebug(t);},
		warn: function (t) {this.softDebug(t);},
		info: function (t) {this.softDebug(t);},
		log: function (t) {this.softDebug(t);},
		error: function (t) {this.softDebug(t);},
		debug: function (t) {this.softDebug(t);},
		softDebug: function (t) {
			try {
				if ($('debug')!=null) {
						//$('debug').innerHTML = $('debug').innerHTML + t + '<br>\n';
				}
			} catch (e) {}
		}
	}
}


