	// ######################################################################### COMMON (v1.1)
	// NOTES
	// TODO
	// DONE
	// 2007-02-24 (v1.1)
	// ========================================================================= common GET
	function getDocument(e) {
		var doc;
		
		if (e) {
			doc = e.document;
			
			if (!doc) { doc = e.ownerDocument }
			
			if (!doc) {
				if (e.location) { doc = e }
			}
		}
		
		return doc;
	}
	// ========================================================================= common IS
	function is(e) {
		return (e || (e == 0) || (e == ''));
	}
	// ------------------------------------------------------------------------- common is
	function isDocument(e) {
		if (e) { return (e == getDocument(e)) }
	}
	// ------------------------------------------------------------------------- common is
	function isForm(e) {
		var doc, key, form;
		
		doc = getDocument(e)
		
		if (doc) {
			for (key in doc.forms) {
				form = doc.forms[key];
				
				if (form == e) { return true }
			}
		}
	}
	// ========================================================================= common CONVERT
	function ci(e) {
		return Math.round(parseFloat(e));
	}
	// ------------------------------------------------------------------------- common convert
	function cb(e) {
		var bool;
		
		switch (typeof(e)) {
		case 'boolean':
			bool = e;
		case 'number':
			if (e != 0) { bool = true}
		case 'string':
			switch(e.toLowerCase()) {
			case 'true':
			case '1':
				bool = true;
			}
		}
		
		return bool;
	}
	// ========================================================================= common POPUP
	function popup(u, w, h, hm, vm) {
		var defaultHorizontalMargin = 40;
		var defaultVerticalMargin = 40;
		var minScreenWidth = 800;
		var minScreenHeight = 600;
		var minPopupWidth = 100;
		var minPopupHeight = 100;
		var extraPopupHeight = 40; // 31 bij ie in 98-mode
		var horizontalMargin, verticalMargin, screenWidth, screenHeight, popupWidth, popupHeight, popupLeft, popupTop;
		
		if (u) {
			w = ci(w);
			h = ci(h);
			hm = ci(hm);
			vm = ci(vm);
			
			if (screen.width) { screenWidth = screen.width }
			if (!(screenWidth >= minScreenWidth)) { screenWidth = minScreenWidth }
			
			if (screen.height) { screenHeight = screen.height }
			if (!(screenHeight >= minScreenHeight)) { screenHeight = minScreenHeight }
			
			if (w >= 0) {
				popupWidth = w;
			} else {
				if (hm >= 0) {
					horizontalMargin = hm;
				} else {
					horizontalMargin = defaultHorizontalMargin;
				}
				
				popupWidth = screenWidth - 2 * horizontalMargin;
			}
			
			if (popupWidth < minPopupWidth) { popupWidth = minPopupWidth }
			if (popupWidth > screenWidth) { popupWidth = screenWidth }
			
			if (h >= 0) {
				popupHeight = h;
			} else {
				if (vm >= 0) {
					verticalMargin = vm;
				} else {
					verticalMargin = defaultVerticalMargin
				}
				
				popupHeight = screenHeight - extraPopupHeight - 2 * verticalMargin;
			}
			
			if (popupHeight < minPopupHeight) { popupHeight = minPopupHeight }
			if (popupHeight > screenHeight) { popupHeight = screenHeight }
			
			popupLeft = Math.floor((screenWidth - popupWidth) / 2);
			if (popupLeft < 0) { popupLeft = 0 }
			
			popupTop = Math.floor((screenHeight - (popupHeight + extraPopupHeight)) / 2);
			if (popupTop < 0) { popupTop = 0 }
			
			window.open(u, '', 'channelmode=no,directories=no,fullscreen=no,left=' + popupLeft + ',top=' + popupTop + ',location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,titlebar=yes,toolbar=no,width=' + popupWidth + ',height=' + popupHeight);
		}
	}
	// ========================================================================= common FULLSCREEN
	// u: url
	function fullscreen(u) {
		window.open(u, '', 'fullscreen=yes');
	}
	// ========================================================================= common FULLSCREEN
	// fn: functionName, e: expression
	function extendFunction(fn, e) {
		var temp;
		
		temp = eval(fn);
		
		if (temp) {
			temp = String(temp);
			temp = temp.replace('return;', e + ';return;');
			temp = temp.replace('function ' + fn + '(', 'function (');
			temp = fn + ' = ' + temp;
			
			eval(temp);
		}
	}

