var start = 0; //
var activmenu = 0; // показано ли падающее меню
var tek = 0; // имя показываемого падающего меню
var tim;
var stored;
var overcolor = '#B1B1B1';
var outcolor = '#E6E6E6';
ie = (document.getElementById)? true : false;
nn4 = (document.layers)? true : false;
ie4 = (!ie && document.all)? true : false;

var indik;
var browser_name = navigator.appName; 
var browser_version = parseFloat(navigator.appVersion); 
if (browser_name == "Netscape" && browser_version >=3.0) { indik = 'true'; } 
else if (browser_name == "Microsoft Internet Explorer" && 
browser_version >= 3.0) { indik = 'true'; } 
else { indik = 'false'; }


function message(){
	var d=document.form1.mes.value;
var l=d.length;  var p=0;
if (l>0) {  for(var i=0; i<l;  i++)
{  if((d.charAt (i)!=" ")&&(d.charAt (i)!=unescape("%0D"))&&(d.charAt (i)!=unescape("%0A"))) { p=1;  break;  }  } }
if(p==1) { document.form1.submit(); }
  else {alert('Вы забыли ввести реплику!');}
}

function Gr(theURL,r)
{       myWin = window.open("","",r+',scrollbars=no');
        myWin.document.open();
        myWin.document.write('<html><body leftmargin=0 topmargin=0 MARGINWIDTH=0 MARGINHEIGHT=0 onload="window.focus();">');
        myWin.document.write('<center><img src=' + theURL + ' '+ r+' border=0></center></body></html>');
        myWin.document.close();
}

function show(n,m)
{
	if (indik == 'true'){
 var	w='im'+n; 
	if(m=='over') 	{ var t='images/m'+n+'v.jpg'; }
	if(m=='out')	{  var t='images/m'+n+'.jpg';  }
	document.images[w].src=t; 
} 
} 

function timeactiv() 
{
	if (activmenu == 1) tim=setTimeout('hidemenu(tek)','500'); 
}

function activ(n) //если показано не падающее меню не то, что нужно, то спрятать его
                  // и показать падающее меню с именем tek, иначе показать tek
{ 
	if (activmenu == 1)   {if (n != tek) {hidemenu(tek); showmenu(n); tek = n; }}
 else {showmenu(n); tek = n; }
}

function time_sbros()  { if (start != 0) {clearTimeout(tim);} else start = 1; }


function Svet(n,x) // --- функция подсветки ---
{
       if (x == 'over') {
        if(ie) document.getElementById(n).style.backgroundColor = overcolor;
        if(ie4) document.all[n].style.backgroundColor = overcolor;
        if(nn4) document.layers[n].bgColor = overcolor;
       }
        else {
        if(ie) document.getElementById(n).style.backgroundColor = outcolor;
        if(ie4) document.all[n].style.backgroundColor = outcolor;
        if(nn4) document.layers[n].bgColor = outcolor;
        }
}


function showmenu(n) //показать меню с Id=n
{if (ie) document.getElementById(n).style.visibility = "visible";
 else if (ie4) document.all[n].style.visibility = "visible";
 else if (nn4) document.layers[n].visibility = "show";
 activmenu = 1;}

function hidemenu(){
if (ie) document.getElementById('menupr').style.visibility = "hidden";
 else if (ie4) document.all['menupr'].style.visibility = "hidden";
 else if (nn4) document.layers['menupr'].visibility = "hide";
 activmenu = 0;
}

//function hide_pop(n) //спрятать падающее меню при выборе одного из его пунктов
//{if (ie) document.getElementById(n).style.visibility = "hidden";
// else if (ie4) document.all[n].style.visibility = "hidden";
// else if (nn4) document.layers[n].visibility = "hide";
// activmenu = 0;
//}

