function getEl(el)
{
	if ( document.getElementById )
	{
		return( document.getElementById(el) );
	} else if (document.all) {
		return( document.all[el] );
	}
}

function hideIt(elID)
{
	if ( getEl(elID) )
		(getEl(elID)).style.display = "none";
}

function showIt(elID)
{
	if ( getEl(elID) )
		(getEl(elID)).style.display = "block";
}

function isVisible(elID)
{
	var el = getEl(elID);
	if ( el && el.style.display != "none" )
		return( true );
		else
		return( false );
}

function Query (question, text)
{
	return prompt (question, text);
}

function bg_Light(elID, this_id, bg_color_on, bg_color_off)
{
	if (isVisible(elID))
	{
		getEl(this_id).style.background = bg_color_on;
	} else {
		getEl(this_id).style.background = bg_color_off;
	}
}

function ShowOn(elID)
{
	if ( isVisible(elID) )
	{
		hideIt(elID);
	} else {
		showIt(elID);
		showIt(elID);
	}
}

function ShowCat (elID)
{
	if ( isVisible(elID) )
	{
		getEl(elID + '_pm').className = "plus";
		getEl(elID + '_fl').className = "folder";

		hideIt(elID);
	} else {
		getEl(elID + '_pm').className = "minus";
		getEl(elID + '_fl').className = "folderopen";

		showIt(elID);
		showIt(elID);
	}
}
function send_comment ()
{
	xajax_AddComments(xajax.getFormValues('commentform'));
}

function ready_alter ()
{
	Set_Alt_Text ('login', 'Ваш Логин:');
}

function Set_Alt_Text (elm, text)
{
	var el = getEl(elm);
	el.value = text;
	el.onblur = function() { if(this.value=='') { this.value=text; }}
	el.onfocus= function() { if(this.value==text) { this.value=''; }}
}

function search_on ()
{
	location.replace( '/search/' + getEl('search_text').value );
}

function isValidEmail (email)
{
	return (/^([a-z0-9_\-]+\.)*[a-z0-9_\-]+@([a-z0-9][a-z0-9\-]*[a-z0-9]\.)+[a-z]{2,4}$/i).test(email);
}

function ShowQuestion(question,href) {
	if (confirm(question)) {
		location.href=href;
	}
}

function HelpBottom()
{
	var div_id = 'help_cont';
	var btn_id = 'help_btn';
	if (isVisible(div_id))
	{
		hideIt(div_id);
		getEl(btn_id).src = '/images/admin/showme.jpg';
	} else {
		showIt(div_id);
		getEl(btn_id).src = '/images/admin/hideme.jpg';
	}
}

function addBookmark(url, title)
{
	if (!url) url = location.href;
	if (!title) title = document.title;
		//Gecko
	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) 
	{
		window.sidebar.addPanel (title, url, "");
	}
		//IE4+
	else 
	{
		if (typeof window.external == "object") 
		{
			window.external.AddFavorite(url, title);
		}
		//Opera7+
		else
		{
			if (window.opera && document.createElement)
			{
				var a = document.createElement('A');
				if (!a) return false; //IF Opera 6
				a.setAttribute('rel','sidebar');
				a.setAttribute('href',url);
				a.setAttribute('title',title);
				a.click();
			} else return false;
		}
	}
	return true;
}

function Start ()
{
	// Инициализируем таблицу перевода
/*	var trans = [];
	for (var i = 0x410; i <= 0x44F; i++) trans[i] = i - 0x350; // А-Яа-я
	trans[0x401] = 0xA8; // Ё
	trans[0x451] = 0xB8; // ё
	// Сохраняем стандартную функцию escape()
	var escapeOrig = window.escape;
	// Переопределяем функцию escape()
	window.escape = function(str)
	{
		var ret = [];
		// Составляем массив кодов символов, попутно переводим кириллицу
		for (var i = 0; i < str.length; i++)
		{
			var n = str.charCodeAt(i);
			if (typeof trans[n] != 'undefined')
			n = trans[n];
			if (n <= 0xFF) ret.push(n);
		}
		return escapeOrig(String.fromCharCode.apply(null, ret));
	}
*/
}
