	GLOBALS = new Object;

	function getStageSize(str)
	{
		var x,y;

		if (self.innerHeight) {
			x = self.innerWidth;
			y = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			x = document.documentElement.clientWidth;
			y = document.documentElement.clientHeight;
		} else if (document.body) {
			x = document.body.clientWidth;
			y = document.body.clientHeight;
		}

		if (str == 'x') {
			return parseInt(x);
		} else if (str == 'y') {
			return parseInt(y);
		} else {
			return [parseInt(x), parseInt(y)];
		}
	}

	function $(element_name)
	{
		return document.getElementById(element_name);
	}

	function wysiwyg_tmp_func(rte)
	{
		var d = GLOBALS['wysiwyg_tmp_data' + rte];
		document.getElementById('hdn'+rte).value = d.html;
		enableDesignMode(rte, d.html, d.rte_css, d.readOnly);
	}

	function switchImage(s)
	{
		n = s.replace(/image_box_/, '');

		$('image_box_' + n).style.backgroundImage = 'url("/upload/image/120x90/' + GLOBALS.big_image + '.jpg")';
		$('image_box_' + n).alt = $('big_image_box').alt;
		$('image_box_' + n).id = 'image_box_' + GLOBALS.big_image;

		$('big_image_box').style.backgroundImage = 'url("/upload/image/313x234/' + n + '.jpg")';
		$('big_image_box').alt = GLOBALS.data[n].Title;

		if (GLOBALS.data[n].Body == '') {
			$('image_text_box').innerHTML = '';
			$('image_text_box').style.display = 'none';
		} else {
			$('image_text_box').innerHTML = GLOBALS.data[n].Body;
			$('image_text_box').style.display = 'block';
		}

		GLOBALS.big_image = n;

	}

	function fileName(str)
	{
		var tmp = str.split("/");
		return tmp[(tmp.length - 1)];
	}

	function setFontSize()
	{
		var size = '12';
		var period = {'0': '12', '1050': '13', '1100': '14', '1150': '15', '1200': '16'};
		var tmp = getStageSize('x');

		for (var i in period) {
			if (tmp > i) {
				size = period[i];
			}
		}


		jQuery('home_box_1').css('font-size', size + "px");
		jQuery('home_box_2').css('font-size', size + "px");

	}

	function showError(str)
	{
		alert(global_dictionary.get('error') + ':' + "\n\n" + str);
	}

	function var_dump(obj, level)
	{
		var out = '';
		var space = '';
		var under;
		if (typeof(level) == typeof(under)) {
			level = 1;
		}
		for (var i = 0; i < level; i++) {
			space += ' ';
		}

		for (var id in obj) {
			if (typeof obj[id] == 'object') {
				out += space + 'OBJECT "' + id + '"' + " \n " + var_dump(obj[id], ++level) + "";
			} else {
				out += space + id + ' = ' + obj[id] + "\n";
			}
		}

		return out + "\n";
	}

	function get_menu()
	{
		var html = '';

		for (var i in items) {
			if (i == current_page) {
				html += '<div class="menu_item" style="margin: 0px;"><img src="/pics/small_dot.gif" width="13" height="14" alt="" border="0" align="absmiddle" style="margin: 0px 5px 0px 0px;" />' + items[i] + '</div>';
			} else {
				html += '<div class="menu_item" onclick="document.location.href = \'' + i + '\';" onmouseover="this.style.textDecoration = \'underline\';" onmouseout="this.style.textDecoration = \'none\';" style="margin: 0px 0px 0px 18px;">' + items[i] + '</div>';
			}
		}

		return html;
	}

	function doLoad(force, cach, type, element)
	{
		var req = new Subsys_JsHttpRequest_Js();

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				if (req.responseJS) {
					switch (type) {
						default:
							alert('unknown type');
							break;
					}
				}
//				$('debug').innerHTML = req.responseText;
			}
		}

		req.caching = cach;
		req.open('POST', '/load.php', true);
		req.send({ data: element, act: type });
	}
