function emit(Text)
{
	document.write(Text);
}

function emitln(Text)
{
	document.writeln(Text);
}

function element(i)
{
	if (document.getElementById)
		return document.getElementById(i);
	if (document.all)
		return document.all(i);
	if (document.layers)
		return document.layers(i);
}

function my_escape(value)
{
	return value.replace(/\\/g, "\\\\").replace(/\"/g, "\\\"").replace(/\'/g, "\\\'");
}

function my_unescape(value)
{
	return value.replace(/\\\\/g, "\\").replace(/\\\"/g, "\"").replace(/\\\'/g, "\'");
}

function Refresh()
{
	document.location.href = document.location.href;
}

function Redirect(Url)
{
	document.location.href = Url;
}

function RedirectRoot()
{
	document.location.href = '/';
}

function WriteBorder()
{
	emit('<table cellpadding="1" cellspacing="1"><tr><td bgcolor="black">');
}

function WriteBorderEnd()
{
	emit('</td></tr></table>');
}

function WriteVSpacer(Height)
{
	emit('<table width="100%" height="' + Height + '" cellspacing="0" cellpadding="0" border="0">');
	emit('<tr><td nowrap></td></tr>');
	emit('</table>');
}

function WriteHSpacer(Width)
{
	emit('<table cellspacing="0" cellpadding="0" border="0">');
	emit('<tr><td nowrap width="' + Width + '" height="0"></td></tr>');
	emit('</table>');
}

// Предзагрузка
preload_image_array = new Array();

function preload_image(image_file)
{
	preload_image_array[preload_image_array.length] = new Image();
	preload_image_array[preload_image_array.length - 1].src = image_file;
}

function news_delete_pic(id)
{
	if (confirm('Удалить картинку?'))
		location = '?act=deletepic&id=' + id;
}

function send(values, url)
{
	var form = document.createElement("form");
	form.setAttribute("method", "post");
	if (url != null)
		form.setAttribute("action", url);
	
	var f;
	for (var i = 0; i<values.length; i++)
	{
		f = document.createElement("input");
		f.setAttribute("type", "hidden");
		f.setAttribute("name", values[i][0]);
		f.setAttribute("value", values[i][1]);
		form.appendChild(f);
	}
	document.body.appendChild(form);
	form.submit();
}

function ui_header_flash(file)
{
	emit
	(
		'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version\=7,0,0,0" width="1000" height="300" align="right">' +
		'<param name="menu" value="false" />' +
		'<param name="allowScriptAccess" value="sameDomain" />' +
		'<param name="movie" value="' + file + '" />' +
		'<param name="quality" value="high" />' +
		'<param name="scale" value="noscale" />' +
		'<param name="wmode" value="transparent" />' +
		'<param name="bgcolor" value="#ffffff" />' +
		'<embed menu="false" src="' + file + '" quality="high" scale="noscale" wmode="transparent" bgcolor="#ffffff" width="1000" height="300" align="right" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />' +
		'</object>'
	);
}

// Реализация наведения мышью в IE
jsHover = function()
{
	if (!element("menu_list"))
		return;
	var hEls = element("menu_list").getElementsByTagName("ul")[0].getElementsByTagName("li");
	for (var i=0, len=hEls.length; i<len; i++)
	{
		hEls[i].onmouseover =
		function()
		{
			this.className += " jshover";
		}
		hEls[i].onmouseout =
		function()
		{
			this.className = this.className.replace(" jshover", "");
		}
	}
}
if (window.attachEvent && navigator.userAgent.indexOf("Opera") == -1)
{
	window.attachEvent("onload", jsHover);
	emit
	(
		'<style>#menu_item1, #menu_item2, #menu_item3, #menu_item4, #menu_item5, #menu_item6, #menu_item7,' +
		'#menu_item1 a, #menu_item2 a, #menu_item3 a, #menu_item4 a, #menu_item5 a, #menu_item6 a, #menu_item7 a,' +
		'#menu_item1_s, #menu_item2_s, #menu_item3_s, #menu_item4_s, #menu_item5_s, #menu_item6_s, #menu_item7_s,' +
		'#menu_item1_s a, #menu_item2_s a, #menu_item3_s a, #menu_item4_s a, #menu_item5_s a, #menu_item6_s a, #menu_item7_s a,' +
		'#menu_item7_d' +
		'{float: left;}</style>'
	);
}

preload_image('/ui/header_bk.gif');
preload_image('/ui/1x1.gif');
preload_image('/intro/logo.gif');
preload_image('/ui/bullet.gif');
preload_image('/ui/details.gif');
preload_image('/ui/details_hover.gif');
preload_image('/ui/menu_disc_s.gif');

preload_image('/ui/menu_1.gif');
preload_image('/ui/menu_2.gif');
preload_image('/ui/menu_3.gif');
preload_image('/ui/menu_4.gif');
preload_image('/ui/menu_5.gif');
preload_image('/ui/menu_6.gif');
preload_image('/ui/menu_7.gif');
preload_image('/ui/menu_7_d.gif');

preload_image('/ui/pager_r.gif');
preload_image('/ui/pager_l.gif');

preload_image('/ui/header_nav.gif');