var menuitem=0;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function DocPrint(){

var bRes = window.confirm("Вы хотите распечатать страницу?");

if(!bRes) return;

window.print();

}


var currentLayer = null;
var currentLayerNum = 0;
var noClose = 0;
var closeTimer = null;

var bTranState = 0;

function mopen(n)
{
  var vl = document.getElementById("menu_"+n);
 
  if(bTranState)
  {
 	vl.style.visibility='hidden';
	currentLayerNum = 0;
	currentLayer = null;
	currentLayerNum = 0;
	bTranState = 0;
  }
  else 
  {
	bTranState = 0; 
	mcancelclosetime();
	if(currentLayer && (currentLayerNum != n))currentLayer.style.visibility='hidden';
	currentLayer = vl;
	currentLayerNum = n;	
	vl.style.visibility='visible';
  }			
}

function mclosetime()
{
  closeTimer = window.setTimeout(mclose, 700);
}
	
function mcancelclosetime()
{
	if(closeTimer)
	{
	window.clearTimeout(closeTimer);
	closeTimer = null;
	}				
}
	
function mclose()
{
	if(currentLayer && noClose!=1)
	{
  		currentLayer.style.visibility='hidden';
  		currentLayerNum = 0;
  		currentLayer = null;
	}
	else
	{
		noClose = 0;
	}

  currentLayer = null;
}
	
document.onclick = mclose;


 

function image(type, image, width, height)
{	
	var time = new Date ();
	var hour = time.getHours ();
 	var minute = time.getMinutes ();
 	var second = time.getSeconds (); 
 	var day = time.getDay(); 
	
	code=hour+""+minute+second+day;
	
	if (isOpera==true)
	{
		window.open("/image.php?type="+type+"&image="+image+"&code="+code, '', 'left='+(parseInt(window.screen.width/2)-275)+'px, top=0px, width='+width+'px, height='+height+'px, location=no, resizable=yes, menubar=no, scrollbars=no');
	} 
	else
	{
		var param="dialogWidth:"+width+"px;dialogHeight:"+height+"px;center:1;dialogHide:0;edge:raised;help:0;resizable:0;scroll:0;status:0"
		var mydate = window.showModalDialog("/image.php?type="+type+"&image="+image+"&code="+code,"",param);
	}
	
	return false;
}