//<script language="JavaScript"><!--
  function mclose_w(a)
  {
    document.getElementById(a).style.display='none';
    if (a=="perest")
    {
      for (var i=1; i<(nsol_ob+1); i++)
      {
        //var el1=document.getElementById('sol_'+i);
        //document.getElementById(document.getElementById('sol_'+i).parentNode.id).replaceChild(sol_ob[i],el1);
        document.getElementById('sol_'+i).style.border="0 solid red";
      }
      num_rez=num_rez1;
      document.getElementById('num_rez').firstChild.nodeValue=num_rez;
      document.getElementById('obmen_sum').firstChild.nodeValue='Сумма 0';
      obm_value='change#';
      change=0;
    }
  }
  function mopen_w(a)
  {
    if (vopen_w>"")
    {
      close_w(vopen_w);
      vopen_w="";
    }
    document.getElementById(a).style.display='block';
    vopen_w=a;
  }

 function ShowPopup(hoveritemid,from)
    {
			if (loaded==0 && MSIEWIN)
			{
				makepopup();
				loaded=1;
			}
		  hp = document.getElementById("hoverp");
 		  hoveritem=document.getElementById("topframe");
  		headobj=document.getElementById("ptext");
      if (from=='1')
      {
  	  	headobj.innerHTML="<font class='popuptext' style='align:center'>Арена</font>";
        hp.style.top=hoveritem.offsetTop+140+70;
        hp.style.left=hoveritem.offsetLeft+430+120;
      }
      if (from=='4')
      {
  			headobj.innerHTML="<font class='popuptext' style='align:center'>Башня мага</font>";
        hp.style.top=hoveritem.offsetTop+130;
        hp.style.left=hoveritem.offsetLeft+430+390;
      }
      if (from=='3')
      {
  			headobj.innerHTML="<font class='popuptext' style='align:center'>Оружейная</font>";
        hp.style.top=hoveritem.offsetTop+140;
        hp.style.left=hoveritem.offsetLeft+430+330;
      }
      if (from=='2')
      {
   			headobj.innerHTML="<font class='popuptext' style='align:center'>Мастерская</font>";
        hp.style.top=hoveritem.offsetTop+140;
        hp.style.left=hoveritem.offsetLeft+430+280;
      }
      if (from=='5')
      {
 		 		headobj.innerHTML="<font class='popuptext' style='align:center'>Зал совета</font>";
        hp.style.top=hoveritem.offsetTop+140+25;
        hp.style.left=hoveritem.offsetLeft+430+430;
      }
      if (from=='6')
      {
   			headobj.innerHTML="<font class='popuptext' style='align:center'>Таверна</font>";
        hp.style.top=hoveritem.offsetTop+140+110;
        hp.style.left=hoveritem.offsetLeft+430+170;
      }
      if (from=='7')
      {
  			headobj.innerHTML="<font class='popuptext' style='align:center'>Базар</font>";
        hp.style.top=hoveritem.offsetTop+140+220;
        hp.style.left=hoveritem.offsetLeft+430+370;
      }
      if (from=='8')
      {
   			headobj.innerHTML="<font class='popuptext' style='align:center'>Выход из города</font>";
        hp.style.top=hoveritem.offsetTop+140;
        hp.style.left=hoveritem.offsetLeft+430+170;
      }
      if (from=='9')
      {
  	 		headobj.innerHTML="<font class='popuptext' style='align:center'>Алтарь</font>";
        hp.style.top=hoveritem.offsetTop+140+260;
        hp.style.left=hoveritem.offsetLeft+430+140;
      }
   		hp.style.visibility = "Visible";
   }
    function HidePopup()
    {
  		hp = document.getElementById("hoverp");
 			hp.style.visibility = "Hidden";
    }

//из t_main_n_2.php

function display_ss(pic,h,w) {
var image_array = new Image();
 image_array.src=pic;

var window_dimensions = "width=" + w + ",height=" + h;
new_window=window.open("","",window_dimensions);
new_window.document.writeln('<html>');
new_window.document.writeln('<head>');
new_window.document.writeln('<title>Скриншот');
new_window.document.writeln('<\/title>');
new_window.document.writeln('<\/head>');
new_window.document.writeln('<body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0">');
new_window.document.writeln('<img src=" ' +image_array.src+'">');
new_window.document.writeln('<\/body>');
new_window.document.writeln('<\/html>');
new_window.document.close();
}

function perehod(p) {
	document.getElementById('perehodtop').action=p;
	document.getElementById('perehodtop').submit();
}

function perehodn(p) {
	document.getElementById('perehodtopn').action=p;
	document.getElementById('perehodtopn').submit();
}

function n_showmenu(o,s) {
    if (o.id.indexOf('_body')>0){
	  o.style.display="block";
    }
    else{
	  h=document.getElementById(o.id+'_head');
      h.className=s;
      //h.setAttribute("class",s);
	  b=document.getElementById(o.id+'_body');
      b.left=h.left;
      b.top=h.top+h.height;
      b.style.display="block";
    }
}
function n_hidemenu(o,s) {
    id=o.id.substr(0,o.id.indexOf('_body'))+'_head';
    h=document.getElementById(id);
	if (h)
        h.className=s;
        //h.setAttribute("class",s);
    else{
    id=o.id+'_head';
    h=document.getElementById(id);
	if (h){
      h.setAttribute("class",s);
	  document.getElementById(o.id+'_body').style.display="none";
	}
    else alert(id+' not found!');
    }
    if (o.id.indexOf('_body')>0)	o.style.display="none";
	//document.getElementById(o.id+'_head').setAttribute("class",s);
	//document.getElementById(o.id+'_body').style.display="none";
}

function n_set(o,s){
    o.className=s;
    //o.setAttribute("class",s);
}

function on(o) {
	o.style.backgroundImage="url(../images/start/"+o.id+".jpg)";
}

function of(o) {
	o.style.backgroundImage="";
}

function showmenu(o,a) {
	o.style.backgroundImage="url(../images/top/button/"+o.id+".jpg)";
	showmenu2(a);
	on(o);
}
function hidemenu(o,a) {
	hidemenu2(a);
	of(o);
}
function showmenu2(a) {
	document.getElementById('meninv'+a).style.visibility="visible";
}
function hidemenu2(a) {
	document.getElementById('meninv'+a).style.visibility="hidden";
}
function on2(o) {
	o.style.backgroundImage="url(../images/top/button/info_centr_sel.jpg)";
	o.style.color="#fbeeb9";
}
function of2(o) {
	o.style.backgroundImage="url(../images/top/button/info_centr.jpg)";
	o.style.color="#fbeeb9";
}

function hidediv(id,id2) {
	//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';
		}
	}
    //if (id2) document.getElementById(id2).href='javascript:showdiv(\''+id+'\',\''+id2+'\');';
    if (id2){
      h=document.getElementById(id2);
      if (h) {
        h.href='javascript:showdiv(\''+id+'\',\''+id2+'\');';
        h.innerText='подробнее >>';
      }
    }
}

function showdiv(id,id2) {
	//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';
		}
	}
    if (id2){
      h=document.getElementById(id2);
      if (h) {
        h.href='javascript:hidediv(\''+id+'\',\''+id2+'\');';
        h.innerText='скрыть <<';
      }
    }
}
function ScrollToElement(theElement){

  var selectedPosX = 0;
  var selectedPosY = 0;

  while(theElement != null){
    selectedPosX += theElement.offsetLeft;
    selectedPosY += theElement.offsetTop;
    theElement = theElement.offsetParent;
  }
  window.scrollTo(selectedPosX,selectedPosY);
}

function body_frame_OnLoad(o){
  var d;
  var h='800px';
  if (o)
  {
    if ( o.contentDocument ) { // DOM
      d = o.contentDocument;
    }
    else if ( o.contentWindow ) { // IE win
      d = o.contentWindow.document;
    }
    if (!d) {alert('Document NOT found!');return;}
    if (b=d.getElementById('body'))
      if (b.scrollHeight){
        o.style.height=h=(b.scrollHeight+16)+'px';
        return;
      }
    o.style.height=h;
  }
}

function show_page(id,s){
  if (document.getElementById)
    if (f=document.getElementById('maintop')){
      ScrollToElement(f);
    }
  if (document.getElementById)
    if (f=document.getElementById(id)){
      f.style.height='900px';
      f.src=s;
    }
}


//--></script>


