function MM_findObj(n, d) { 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

var ie=(document.all && document.all.item && !window.opera)?1:0;

function SetHiddenVar(objname, val){
	MM_findObj(objname).value = val;
	MM_findObj('archive').submit();
	return false;
}

function Show(div, evnt, elem1, elem2) {
	if ((obj=MM_findObj(div))!=null){
		if(ie){
				obj.style.left = event.clientX - event.offsetX-2;
				obj.style.top = event.clientY - event.offsetY + document.body.scrollTop+40;
			
		} else {
			if (event.srcElement.tagName=='TD')
			{
				obj.style.top = event.clientY - event.offsetY + document.body.scrollTop+40;
				obj.style.left = event.clientX - event.offsetX;
			}
		}
		ShowHide('show', obj, elem1, elem2);
	}
}

function show_div(id)
{
	for (key in divs)
	{
		imgs = MM_findObj('img_sheet'+divs[key]);
		if (imgs) imgs.src = 'images/s.gif';
		obj = MM_findObj('sheet'+divs[key]);
		if (obj) obj.className='invisible';
		obj = MM_findObj('a_sheet'+divs[key]);
		if (obj) obj.style.textDecoration = 'none';
	}
	obj = MM_findObj(id);
	obj1 = MM_findObj('img_'+id);
	obj2 = MM_findObj('a_'+id);

	if (obj) {
		obj.className='visible'; 
		obj1.src = 'images/sheet.gif'; 
		obj2.style.textDecoration = 'underline';
		return false;
	}
	else return true;
}

function roomClick(){
		
}

function setPointer(theRow, thePointerColor, theNormalBgColor)
{
    var theCells = null;
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    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;
    var currentColor = null;
    var newColor     = null;
    // Opera does not return valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].setAttribute('bgcolor', newColor, 0);
        } // end for
    }
    else {
        currentColor = theCells[0].style.backgroundColor;
        newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())
                     ? theNormalBgColor
                     : thePointerColor;
        for (var c = 0; c < rowCellsCnt; c++) {
            theCells[c].style.backgroundColor = newColor;
        }
    }

    return true;
} // end of the 'setPointer()' function


function Hide (div, elem1, elem2) {
	if ((obj=MM_findObj(div))!=null)
		ShowHide('hide', obj, elem1, elem2);
}
function changemapover(map)
{
	var obj=MM_findObj(map); 
	obj.src = "images/pix_.gif";
}

function changemapout(map)
{
	var obj=MM_findObj(map); 
	obj.src = "images/pix.gif";
}

function ShowHide(v, obj, elem1, elem2) {
//		if (event.fromElement.tagName!='DIV') return;
		obj1 = MM_findObj(elem1);
		obj2 = MM_findObj(elem2);
		if (obj1&&obj2)
		{
			if (v=='hide')
			{
				obj1.className='normal';
			}
			else
			{
				 obj1.className='hovertd';
				 obj2.className='hoverlink';
			}
		}
		if (obj.style) {
			obj=obj.style;
			v=(v=='show')?'block':(v=='hide')?'none':v;
		}
		obj.display=v;
}

function over(id, nextconcert, obj1) //$name.'_'.$m, $nextconc, this
{
	var obj = MM_findObj(id);	
	var d = MM_findObj('cal1');
	d.className='invisible';
	obj.className='visible';
	obj1.style.backgroundColor='#D8A98E';	
}

function out(id, nextconcert, obj1) //$name.'_'.$m, $nextconc, this
{
	var obj = MM_findObj(id);	
	var d = MM_findObj('cal1');	
	obj.className='invisible';
	d.className='visible';
	obj1.style.backgroundColor='#E5E5E1';	
}

function visover(obj) //this
{
	obj.style.backgroundColor='#DA622E';	
}

function visout(obj) //this
{
	obj.style.backgroundColor='#B4572F';		
}

//onMouseOut="document.all.{menuid}.background='../images/menu/{out}.gif'" onMouseOver="document.all.{menuid}.background='../images/menu/{hover}.gif'"
function menuout(menuid, out, s)
{
	obj = MM_findObj(menuid);
	obj.background = '../images/'+s+'menu/'+out+'.gif';
}


function menuover(menuid, over, s)
{
	obj = MM_findObj(menuid);
	obj.background = '../images/'+s+'menu/'+over+'.gif';
}

function do_refresh(time)
{
	document.location = '?min='+time;
}

function openImage(image) {
	window.open("/popup.php?img="+image, "popupimage", "scrollbars=0, resizable=1, width=286, height=72").focus();
}
function ShowMail(user, domain1, domain2) {
	var email = user+'&#64;'+domain1+'&#46;'+domain2;
	if (ShowMail.arguments[3]) name = ShowMail.arguments[3];
	else name = email;
	document.writeln('<a href="mailto:'+email+'">'+name+'</a>');
}

function rusoft() {
  window.open('http://www.rusoft.ru');
}
