function openlink(url, w, h)
    {
      mreplywin = window.open('','mreplywin64'+Math.round(1000*Math.random()),'width=' + (w+15) + ',height=' + (h+25) + ',scrollbars=0,status=0,resizable=0,location=0,menubar=0');
      mreplywin.location.href = url;
      mreplywin.focus(); // bring our subwindow to the front
      if (mreplywin.opener == null) mreplywin.opener = window;
    };
function openlink0(url, w, h)
    {
      mreplywin2 = window.open('','mreplywin64'+Math.round(1000*Math.random()),'width=' + (w+0) + ',height=' + (h+0) + ',scrollbars=0,status=0,resizable=0,location=0,menubar=0');
      mreplywin2.location.href = url;
      mreplywin2.focus(); // bring our subwindow to the front
      if (mreplywin2.opener == null) mreplywin2.opener = window;
    };
function openlink_s(url, w, h)
    {
      mreplywin1 = window.open('','mreplywinz'+Math.round(1000*Math.random()),'width=' + (w+15) + ',height=' + (h+25) + ',scrollbars=1,resizable=1,status=0,location=0,menubar=0');
      mreplywin1.location.href = url;
      mreplywin1.focus(); // bring our subwindow to the front
      if (mreplywin1.opener == null) mreplywin1.opener = window;
    }; 

function tree_cli(elid, imid)
{
 var el = document.getElementById(elid);
 var im = document.getElementById(imid);
 if (im)
  if (im.src.search('zero.gif')>=0) return;
 if (el.style.display == 'none')
 {
  el.style.display = 'block';
  if (im) {
   im.src = '/images/downlink.gif';
   im.width= 9;
   im.height = 6;
  };
 } else {
  el.style.display = 'none';
  if (im) {
   im.src = '/images/commentlink.gif';
   im.width= 6;
   im.height = 9;
  };
 };
 if (window.innerWidth)
  setTimeout("forceReflow();", 10);
};
function tree_cli_11(elid, imid)
{
 var el = document.getElementById(elid);
 var im = document.getElementById(imid);
 if (im)
  if (im.src.search('zero.gif')>=0) return;
 if (el.style.display == 'none')
 {
  el.style.display = 'block';
  if (im) {
   im.src = '/images/downlink1.gif';
  };
 } else {
  el.style.display = 'none';
  if (im) {
   im.src = '/images/commentlink1.gif';
  };
 };
 if (window.innerWidth)
  setTimeout("forceReflow();", 10);
};
function sm_tree_cli(elid, im)
{
 var el = document.getElementById(elid);
 if (!im) return;
 if (im.src.search('zero.gif')>=0) return;
 if (el.style.display == 'none')
 {
  el.style.display = 'block';
  im.src = '/images/sm_arr_b.gif';
 } else {
  el.style.display = 'none';
  im.src = '/images/sm_arr_r.gif';
 };
 if (window.innerWidth)
  setTimeout("forceReflow();", 10);
};
function sm_dovse(theac)
{
 var ii = 1;
 while( ii<100 )
 {
  var im = document.getElementById('sm_im_'+ii);
  var td = document.getElementById('sm_td_'+ii);
  if (td && im && im.src)
  {
  if (theac==1)
  {
   td.style.display = 'block';
   im.src = '/images/sm_arr_b.gif';
  } else {
   td.style.display = 'none';
   im.src = '/images/sm_arr_r.gif';   
  };
  } else { 
   break;
  };
  ii++;
  if (ii==100) { alert('qq'); break; };
 };
 if (window.innerWidth)
  setTimeout("forceReflow();", 10);
};
function forceReflow()
{
 document.body.className = "forceReflow1";
 setTimeout("document.body.className = 'forceReflow';", 10);
};
function showMenu()
{
 document.getElementById('men1').style.visibility = 'visible';
 if ( this.EnableOpera || sAgent.indexOf( 'opera' ) != -1  )
  forceReflow();
};
function hideMenu()
{
 document.getElementById('men1').style.visibility = 'hidden';
 if ( this.EnableOpera || sAgent.indexOf( 'opera' ) != -1  )
  forceReflow();
};
function tree_cli3(elid, imid, divid, divrid) 
{
 var el = document.getElementById(elid);
 var im = document.getElementById(imid);
 var di = document.getElementById(divid);
 var dir = document.getElementById(divrid);
 if (im)
  if (im.src.search('zero.gif')>=0) return;
 if (el.style.display == 'none')
 {
  el.style.display = 'block';
  im.src = '/images/downlink.gif';
  im.width= 9;
  im.height = 6;
  di.style.borderLeft = '1px solid #cebf96';
  di.style.borderTop = '1px solid #cebf96';
  di.style.borderBottom = '1px solid #cebf96';
  di.style.paddingLeft = '5px';
  dir.style.borderTop = '1px solid #cebf96';
  dir.style.borderRight = '1px solid #cebf96';
  dir.style.borderBottom = '1px solid #cebf96';
  dir.style.display = 'block';
 } else {
  el.style.display = 'none';
  im.src = '/images/commentlink.gif';
  im.width= 6;
  im.height = 9;
  di.style.borderLeft = 'none';
  di.style.borderTop = 'none';
  di.style.borderBottom = 'none';
  di.style.paddingLeft = '0px';
  dir.style.borderRight = 'none';
  dir.style.borderTop = 'none';
  dir.style.borderBottom = 'none';
  dir.style.display = 'none';
 };
};
function delpost(postid, msg) {
 if (document.forms.meditfo && confirm(msg))
 {
  document.getElementById('meditfo_del').value = 1;
  document.forms.meditfo.submit(); 
 };
};
function chmod_map()
{
 var a = document.getElementById('is_geo_geocode');
 var b= document.getElementById('is_geo_enablecode');
 a.disabled = !(b.checked);
};
function openmap() 
{
      mreplywin = window.open('','mreplywin6a'+Math.round(1000*Math.random()),'width=700,height=600,resizable=1,scrollbars=0,status=0,location=0,menubar=0');
      mreplywin.location.href = '/mapselector/?coord=' + document.getElementById('lat_edit').value + ',' + document.getElementById('lng_edit').value;
      mreplywin.focus(); // bring our subwindow to the front
      if (mreplywin.opener == null) mreplywin.opener = window;
};
function mapselectend()
{
 window.opener.document.getElementById('lat_edit').value=document.getElementById('lat_edit').value;
 window.opener.document.getElementById('lng_edit').value=document.getElementById('lng_edit').value;
 if (window.opener.document.getElementById('is_geo_msg'))
   window.opener.document.getElementById('is_geo_msg').style.display = 'inline'; 
 if (window.opener.document.getElementById('is_geo_enablemap'))
   window.opener.document.getElementById('is_geo_enablemap').checked = true;
 if (window.opener.document.getElementById('is_geo_reallyusemap'))
   window.opener.document.getElementById('is_geo_reallyusemap').value = 1;
 if (window.opener.document.getElementById('is_geo_codeblock'))
   window.opener.document.getElementById('is_geo_codeblock').innerHTML = 'Карта прицеплена. &nbsp;&nbsp;'+ 
    '<'+'span class="clickable" onclick="openmap()" style="text-decoration: underline;"'+'>'+'Изменить'+'<'+'/span'+'>&nbsp;&nbsp;'+  
    '<'+'span class="clickable" onclick="clearmap()" style="text-decoration: underline;"'+'>'+'Очистить'+'<'+'/span'+'>';
 window.close();
};
function clearmap()
{
 document.getElementById('lat_edit').value=0;
 document.getElementById('lng_edit').value=0;
 document.getElementById('is_geo_reallyusemap').value = 0;
 document.getElementById('is_geo_codeblock').innerHTML = '<'+
  'span class="clickable" onclick="openmap()" style="text-decoration: underline;"'+'>'+
  'Указать мое местонахождение на карте!'+'<'+'/span'+'>';
};
 function printme()
 {
 	document.getElementById('hdprn').style.visibility = 'hidden';
 	print();
 	window.close();
 };
function abg_cl(el)
{
 el.style.backgroundImage='';
};
function pohvalit(el,tableid)
{
 el.src='/pohvalba/'+tableid+'/ok.gif';
};
function sh_clack(id,tabid)
{
 var notabid = (tabid==1?2:1);
 var sh_span = document.getElementById('sh_s_'+id+'_'+tabid);
 var no_sh_span = document.getElementById('sh_s_'+id+'_'+notabid);
 var sh_img = document.getElementById('sh_i_'+id+'_'+tabid);
 var no_sh_img = document.getElementById('sh_i_'+id+'_'+notabid);
 var sh_td = document.getElementById('sh_td_'+id+'_'+tabid);
 var no_sh_td = document.getElementById('sh_td_'+id+'_'+notabid);
 var the_sh_td0 = document.getElementById('sh_td_'+id+'_0');
 var the_sh_td3 = document.getElementById('sh_td_'+id+'_3');
 var the_sh_td4 = document.getElementById('sh_td_'+id+'_4');
 var the_data = document.getElementById('sh_data_'+id+'_'+tabid);
 var no_the_data = document.getElementById('sh_data_'+id+'_'+notabid);
 var sh_conta = document.getElementById('sh_conta_'+id);
 if (sh_span.style.textDecoration=='none')
 {
  // active - deactivate!
  sh_span.style.textDecoration = 'underline';
  sh_img.src = '/images/commentlink1.gif';
  sh_td.style.backgroundColor = '#f8f2e9';
  the_sh_td0.style.borderTop = 'none';
  the_sh_td4.style.borderTop = 'none';
  sh_td.style.borderRight = 'none';
  the_sh_td0.style.backgroundImage = 'url(/images/shop-u-l.gif)';
  the_sh_td4.style.borderBottom = 'none';
  the_sh_td3.style.borderBottom = 'none';
  no_sh_td.style.borderBottom = 'none';
  sh_td.style.borderBottom = 'none';
  the_sh_td0.style.borderBottom = 'none';
  the_data.style.display = 'none';
  sh_conta.style.borderBottom = 'none';
  sh_conta.style.backgroundColor = '#f7f3e9';
  sh_td.style.borderLeft = 'none';
 } else {
  sh_span.style.textDecoration = 'none';
  sh_img.src = '/images/downlink1.gif';
  sh_td.style.backgroundColor = '#ffffff';
  the_sh_td0.style.borderTop = '1px solid #cebf96';
  the_sh_td4.style.borderTop = '1px solid #cebf96';
  the_sh_td4.style.borderBottom = '1px solid #cebf96';
  the_sh_td3.style.borderBottom = '1px solid #cebf96';
  sh_td.style.borderRight = '1px solid #cebf96';
  no_sh_td.style.borderBottom = '1px solid #cebf96';
  sh_td.style.borderBottom = 'none';
  the_data.style.display = 'block';
  sh_conta.style.borderBottom = '1px solid #cebf96';
  sh_conta.style.backgroundColor = '#ffffff';
  if (tabid==1)
  {
   the_sh_td0.style.backgroundImage = 'url(/images/shop-u-l-w.gif)';
   the_sh_td0.style.borderBottom = 'none';
  } else {
   sh_td.style.borderLeft = '1px solid #cebf96';
   the_sh_td0.style.backgroundImage = 'url(/images/shop-u-l.gif)';
   the_sh_td0.style.borderBottom = '1px solid #cebf96';
  }
 };
 // deactivate
 no_sh_span.style.textDecoration = 'underline';
 no_sh_img.src = '/images/commentlink1.gif';
 no_sh_td.style.backgroundColor = '#f8f2e9';
 no_sh_td.style.borderRight = 'none';
 no_sh_td.style.borderLeft = 'none';
 no_the_data.style.display = 'none';
};