
function $_()
{
	var elements = new Array();

	for (var i = 0; i < arguments.length; i++)
	{
		var element = arguments[i];
		if (typeof element == 'string')
		element = document.getElementById(element);
		if (arguments.length == 1)
		return element;
		elements.push(element);
	}
	return elements;
}

/* Modal login screen
 *--------------------------------------------------------------------------*/
function login_show() {
	$_('auth').style.display = "block";
	$_('authdialog').style.left = '50%';
	$_('focused').focus();
}


function login_hide() {
	$_('authdialog').style.position = 'absolute';
	$_('authdialog').style.left = '-2000px';
	$_('auth').style.display = "none";
}

document.onkeypress = function(ev){
	ev = ev || event;
	if(ev.keyCode==27)
		login_hide();
}


/* Modal login screen END
 *--------------------------------------------------------------------------*/


function confirmSubmit()
{
var agree=confirm("Уверены, что хотите удалить?");
if (agree)
	return true ;
else
	return false ;
}


function ShowHide(elem, icon_elem){
  var s = elem.style;
  s.display = (s.display != 'none') ? 'none': '';
  if(icon_elem) { icon_elem.innerHTML = (s.display != 'none') ? '[+]': '[&ndash;]'; }
}


function confirmDelete(question, where)
{
        temp = window.confirm(question);
        if (temp) //delete
        {
        window.location=where;
        }   window.opener.location.reload()
}




/* Switch elements
 *--------------------------------------------------------------------------*/

//here you place the ids of every element you want.
var ids=new Array('a1','a2', 'a3');

function switchid(id){
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id

	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}



function go_url( url )
{
  window.location = url;
}


/* Поиск
 *--------------------------------------------------------------------------*/
blSearch = {

        queryDefault: 'Поиск по сайту',
        queryClick: function() {
                if ($_('sub_search').value == blSearch.queryDefault) { $_('sub_search').value = ''; }
        },
        queryBlur: function() {
                if ($_('sub_search').value == '') { $_('sub_search').value = blSearch.queryDefault; }
        },
        querySubmit: function() {
                if ($_('sub_search').value == blSearch.queryDefault || $_('sub_search').value == '') {
                        alert ('Пожалуйста, введите слово для поиска.'); return false;
                }
                return true;
        }


}



function openWin(url) {
  myWin=window.open(url,'','width=478,height=600,status=no,toolbar=no,menubar=no, scrollbars=yes');
}

/* Подменю
 *--------------------------------------------------------------------------*/

function showMenu(id_menu){
var my_menu = document.getElementById(id_menu);
if(my_menu.style.display=="none" || my_menu.style.display==""){
	my_menu.style.display="block";
	} else {
	my_menu.style.display="none";
	}
}

function swapImage(idStatus){
	if(idStatus==0){
		document.arrow_profile.src ="/images/arrow_hover.png";
	} else if(idStatus==1){
		document.arrow_profile.src ="/images/arrow_select.png";
	} else if(idStatus==2){
		document.arrow_profile.src ="/images/arrow.png";
	}

}

nsName = {

        queryDefault: 'E-mail',
        queryClick: function() {
                if ($_('sub_name').value == nsName.queryDefault) { $_('sub_name').value = ''; }
        },
        queryBlur: function() {
                if ($_('sub_name').value == '') { $_('sub_name').value = nsName.queryDefault; }
        }


}

nsPass = {

        queryDefault: 'Пароль',
        queryClick: function() {
                if ($_('sub_passw').value == nsPass.queryDefault) { $_('sub_passw').value = ''; }
        },
        queryBlur: function() {
                if ($_('sub_passw').value == '') { $_('sub_passw').value = nsPass.queryDefault; }
        },
        querySubmit: function() {
                if ($_('sub_passw').value == nsPass.queryDefault || $_('sub_passw').value == '' || $_('sub_name').value == nsName.queryDefault || $_('sub_name').value == '') {
                        alert ('Пожалуйста, заполните оба поля.'); return false;
                }
                return true;
        }


}



<!--
	 var win
function showimage (w, h, path, title) {
		if (win) {
     win.close()//закрываем предыдущее окно, если такое открыто( посылаем в функцию закрытия окна-строка27)
   }
	win=window.open('','','toolbar=no,scrollbar=no, width='+w+',height='+h+', top=100, left=100');
	win.document.open();
	win.document.write('<html><meta http-equiv="Content-Type" content="text/html; 	charset=windows-1251">\n<title>'+title+'</title>\n<body bgcolor="#ffffff" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bottommargin="0" rightmargin="0">\n<img src="'+path+'" border="0" alt="'+title+'">\n</html>');

}


function confirmSubmit(string) {
    var agree=confirm(string);
    if(agree)
        return true;
    else
        return false;
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}



function activate (name, image) {
  document[name].src = image;
}

function mainmenu_activate (id) {
	document.getElementById(id).className = "menu_active";
}

function mainmenu_deactivate (id) {
	document.getElementById(id).className = "menu";
}

function SetActivePage (id) {
	document.getElementById(id).className = "leftmenu_active";
}

function SetActiveNone (id) {
	document.getElementById(id).className = "leftmenu";
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function show(name)  {
document.getElementById(name).style.visibility = "visible";

}
function hide(name){
document.getElementById(name).style.visibility="hidden";
}

function ch_disp (menu) {
	if (document.getElementById(menu).style.display == "block")
		{document.getElementById(menu).style.display="none";}
	else {document.getElementById(menu).style.display="block";}
}

function d_show(name)  { document.getElementById(name).style.display="block"; }
function d_hide(name){ document.getElementById(name).style.display="none"; }
function menu_over(name){document.getElementById(name).style.background="#006AFF";}
function menu_out(name){document.getElementById(name).style.background="#49BBFF";}
// -->


