var menugid;
function menu( url, id, mp3, video)
{
	if( menugid != id )
	{
	var newdiv=document.createElement('div');
	newdiv.setAttribute("id", "mid"+id);
	var div = '';
	if( mp3 )
	div=div+'<a href="'+url+'mp3/">&#8594; Скачать mp3</a> <br />';
	div=div+'<a href="'+url+'texts/">&#8594; Тексты песен</a> <br />';
	div=div+'<a href="'+url+'">&#8594; Дискография</a> <br />';
	div=div+'<a href="'+url+'akkords/">&#8594; Аккорды</a> <br />';
	if( video )
	div=div+'<a href="'+url+'video/">&#8594; Видео</a> <br />';
	div=div+'<a href="'+url+'gallery/">&#8594; Фото</a> <br />';
	div=div+'<a href="'+url+'about/">&#8594; О группе</a> <br />';
	newdiv.innerHTML=div;
	document.getElementById('menuid'+id).appendChild(newdiv);
	}
	if( menugid )
	{
		document.getElementById('menuid'+menugid).removeChild(document.getElementById('mid'+menugid));
	}
	if( menugid != id ) 
			menugid = id;
	else
		menugid = false;

}
/*
function menu( id )
{
	var v = document.getElementById("menu"+id);
	v.style.display = v.style.display == 'none' ? 'block' : 'none';

}
*/
function auth()
{
	var err = '';
	if( document.login.vb_login_username.value == '' )
	{
		err = "Введите Логин\r\n";
	}
	if( document.login.vb_login_password.value == '' )
	{
		err = err + "Введите Пароль\r\n";
	}
	if( err )
	{
		alert(err);
	}
	else
	{
		document.login.submit();
	}
}
function button( src, on )
{
	src.src= on ? src.src.replace('1.gif','2.gif') : src.src.replace('2.gif','1.gif');
}
function row( theRow , on )
{
  var newColor = on ? '#232D35' : '#171f25';
  /*
  tr = tr.firstChild;
  var counter = 0;
  while(tr){
    tr.style.backgroundColor = newcolor;
    tr = tr.nextSibling;
  }
  */

    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }
	var rowCellsCnt  = theCells.length;

   if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    }

    var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
/*        if ( domDetect ) {
            for (c = 0; c < rowCellsCnt; c++) {
               theCells[c].setAttribute('bgcolor', newColor);
            } // end for
        }
        // 5.2 ... with other browsers
        else {*/
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
//        }
//theCells[c-1].style.fontWeight = on ? "bold" : "normal";
}
/*
function page( num , on )
{
  var newColor = on ? '#33404b' : '#232D35';
  num.style.backgroundColor = newColor;
}*/

function size( name, n, min )
{
	var form = eval('document.textarea.'+name);
	var height = form.style.height.replace('px','')*1;
	form.style.height = height == min && n < 0 ? min : height + 100*n;
	scroll(0,99999999);
}
function reurl( url, name )
{
	var img = eval('document.'+name+'');
	img.src = url;
}

function copy(x) 
{ 
	var agent = navigator.userAgent.toLowerCase();
	var is_ie = (agent.indexOf("msie") != -1);
	if (is_ie)
	{ 
		window.clipboardData.setData("Text", x); 
		alert('Ссылка скопирована в буфер обмена');
	} 
    else 
    { 
		prompt('Cсылка:', x); 
	} 
}

function disp( id )
{
	var v = document.getElementById(id);
	v.style.display = 'block';
}
