v=(navigator.appName+':'+navigator.appVersion);
b='IE';
if (v.indexOf('Explorer:')>=0 && v.substring(v.indexOf('Explorer:')+9)>='4')
  b='IE';
if (v.indexOf('Netscape:')>=0 && v.substring(v.indexOf('Netscape:')+9)>='4')
  b='NS';

//if (!b) document.location='brws_err.htm';

lh=location.hostname;
if (lh.substring(0,1)=='1') {
  bs='http://'+lh+'/apex/'
} else {
  bs='http://'+lh+'/'
}
cgi='http://'+location.hostname+'/cgi-bin/apx.cgi?';
var s=window.location.search;
var s1=document.URL;
//alert(s);
s=s.substring(1);
cnt=0;
cnt1=0;

// цвета
bclr0='#000066'; // задний фон кнопок неактивных #dacea9
bclr1='#FF9900'; // задний фон кнопок подсветка при наведении
bclrsel='orange'; // задний фон кнопок активных
buttmarg='#e0e0e0'; // границы кнопок и таблиц
butttext='#ffffff'; // текст в кнопке


function pm(name,a,sprev,spost,fsize) {
  bclr=bclr0;
  document.write(
 (sprev>0 ? '<img src=images/blank.gif width='+(10*sprev)+' height=1 border="0">':'')+
 "<input style='width:150; height:20pt; border: 1 solid "+buttmarg+";"+
 " background-color:"+bclr0+"; font-family:arial; font-weight:bold;"+
 " font-size:"+(typeof fsize == undefined ? '12':fsize)+"px; color:"+butttext+"; text-align:center;"+
 " cursor:hand;'"+
 ' onMouseOver="tdTopOver(this,\''+bclr1+'\')" '+
 ' onMouseOut="tdTopOut(this,\''+bclr+'\')" '+
 ' onClick="document.location=\''+(a=='ln'||a=='sn'||a=='doska' ? cgi+'tema='+a:a+'.html')+'\'" '+
 " type='button' name='"+a+"' value='"+name+"'>"+
 (spost>0 ? '<img src=images/blank.gif width='+(10*spost)+' height=1 border="0">':'')+
 "<br><br><img src=images/blank.gif width=1 height=30 border=0>"
 );
}
function pm1(name,a,sprev,spost,fsize) {
  bclr=(s1.indexOf('='+a)>0 || s1.indexOf(a+'.')>0 ? bclrsel:bclr0);
  document.write(
 "<input style='width:125; height:14pt; border: 1 solid "+buttmarg+";"+
 " background-color:"+bclr+"; font-family:arial; font-weight:bold;"+
 " font-size:11px;"+(typeof fsize == undefined ? '11':fsize)+"px; color:"+butttext+"; text-align:center;"+
 " cursor:hand;'"+
 ' onMouseOver="tdTopOver(this,\''+bclr1+'\')" '+
 ' onMouseOut="tdTopOut(this,\''+bclr+'\')" '+
 ' onClick="document.location=\''+(a=='ln'||a=='sn'||a=='doska' ? cgi+'tema='+a:bs+a+'.html')+'\'" '+
 " type='button' name='"+a+"' value='"+name+"'>"+
 '<img src=images/blank.gif width=1 height=16 border=0>'
 );
}
function pm_01(name,a,sprev,spost,fsize) {
  bclr=(s1.indexOf('='+a)>0 || s1.indexOf(a+'.')>0 ? bclrsel:bclr0);
  this.document.write(
 "<input id='blr' style='width:90; height:30pt; border: 1 solid "+buttmarg+";"+
 " background-color:"+bclr+"; font-family:arial; font-weight:bold;"+
 " font-size:11px;"+(typeof fsize == undefined ? '11':fsize)+"px; color:"+butttext+"; text-align:center;"+
 " cursor:hand;'"+
 ' onMouseOver="tdTopOver(this,\''+bclr1+'\')" '+
 ' onMouseOut="tdTopOut(this,\''+bclr+'\')" '+
 ' onClick="document.location=\''+(a=='ln'||a=='sn'||a=='doska' ? cgi+'tema='+a:bs+a+'.html')+'\'" '+
 " type='button' name='"+a+"' value='"+name+"'>"+
 '<img src=images/blank.gif width=1 height=16 border=0>'
 );
 flash();
}

function flash(){ // изменение цвета рамки,

if (blr.style.backgroundColor == 'orange')
{
blr.style.backgroundColor=bclr0;
}else{
blr.style.backgroundColor=bclrsel;
}
setTimeout("flash() " , 500);
}

function tdTopOver(obj,clr) {
  obj.style.backgroundColor=clr;
}
function tdTopOut(obj,bclr) {
  obj.style.backgroundColor=bclr;
}

function news_line(name,txt) {
  document.write('<tr><td class="newshead" colspan=2><img src=images/down.gif align=middle> '+name+'</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class="newstxt">'+txt+'<BR><BR></td></tr>');
}
function vacs_line(name,txt) {
  document.write('<tr><td class="newshead" colspan=2><img src=images/down.gif align=middle> '+name+'</td></tr><tr><td>&nbsp;&nbsp;&nbsp;</td><td class="newstxt">'+txt+'<BR><BR></td></tr>');
}
function doska_line0(dt,name,tel,email,txt) {
  document.write('<tr><td colspan=2>'+name+'  '+tel+' e-mail:'+email+'</td><td align=right>'+dt+'</td></tr>'+
  '<tr><td>&nbsp;&nbsp;&nbsp;</td><td width=90% colspan=2>'+txt+'</td></tr>');
}
function doska_line(dt,name,tel,email,txt) {
  document.write(
'<tr><td>'+
'<img src=images/down.gif align=middle> <b>'+dt+'</b>'+
(name!='' ? ' <img src=images/down.gif align=middle> '+name:'')+
(tel!='' ? ' <img src=images/down.gif align=middle> '+tel:'')+
(email.indexOf('@')>1 ? ' <img src=images/down.gif align=middle> e-mail:<a href="mailto:'+email+'">'+email+'</a>':'')+
'<hr color=silver noshade size=1>'+
txt+'<br><br><br></td></tr>'
);
}

function button(name,type) {
  bclr=bclr0;
  document.write(
 "<input style='width:140; height:22px; border: 1 solid "+buttmarg+";"+
 " background-color:"+bclr0+"; font-family:arial; font-weight:bold;"+
 " font-size: 12px; color:"+butttext+"; text-align:center;"+
 " cursor:hand;'"+
 " type='"+type+"' name='send_value' value='"+name+"'>"
 );
}
function butt(name,a,w,h,sel) {
  bclr=(sel==1 ? bclrsel:bclr0);
  document.write(
 '<input style="width:'+w+'pt; height:'+h+'pt; border: 1 solid '+buttmarg+'; background-color:'+bclr+'; font-family:arial; font-size: 11px; color:'+butttext+'; text-align:center; cursor:hand;"'+
 ' onMouseOver="tdTopOver(this,\''+bclr1+'\')" '+
 ' onMouseOut="tdTopOut(this,\''+bclr+'\')" '+
 ' onClick="document.'+a+'.value='+name+'; document.seek.submit();" '+
 ' type="submit" name="'+a+'" value="'+name+'">'+
 '<img src="images/blank.gif" width="1" height="'+(h+2)+'" border="0">'
 );
}

function buttReset(name,w,h,sel) {
  bclr=(sel==1 ? bclrsel:bclr0);
  document.write(
 '<input style="width:'+w+'pt; height:'+h+'pt; border: 1 solid '+buttmarg+'; background-color:'+bclr+'; font-family:arial; font-size: 11px; color:'+butttext+'; text-align:center; cursor:hand;"'+
 ' onMouseOver="tdTopOver(this,\''+bclr1+'\')" '+
 ' onClick="resetForm()"'+
 ' onMouseOut="tdTopOut(this,\''+bclr+'\')" '+
 ' type="reset" name="reset" value="'+name+'">'+
 '<img src="images/blank.gif" width="1" height="'+(h+2)+'" border="0">'
 );
}

function butt1(name,type,w) {
  bclr=bclr0;
  document.write(
 "<input style='width:"+(typeof w == undefined ? 140:w)+"pt; height:22px; border: 1 solid "+buttmarg+";"+
 " background-color:"+bclr0+"; font-family:arial; font-weight:bold; font-size: 12px; color:"+butttext+"; text-align:center;"+
 " cursor:hand;'"+
 " type='"+type+"' name='send_value' value='"+name+"'>"
 );
}

function vars_line(raion, metro, pl, cena, target, foto, kod, c) {
  ++cnt;

  fotos='';
  if (foto.length>0) {
    fotos='<a href="view.php?id='+(kod-1)+'" target="_blank"><img src="images/foto.gif" border=0></a><br>';
//    fotos='<img src=images/foto.gif border=0><br>';
//    a=foto.split(',');
//    for(i=0;i<a.length;i++) {
//      fotos+='<a href="imgs/'+a[i]+'" target=_blank>'+(i+1)+'</a><br>';
//    }
  }
  document.write(
  '<tr bgcolor=#'+(cnt%2==1 ? 'e0e0e0':'f0f0f0')+'>'+
  '<td align=center><INPUT type="checkbox" name="'+kod+'"></td>'+
  '<td>'+raion+' '+metro+'</td>'+
  '<td align=center>'+pl+'</td>'+
  '<td align=center>'+(cena.substring(0,1)=='0' ? '':cena)+'</td>'+
  '<td align=center>'+target+'</td>'+
  '<td><!a href='+cgi+'tema=show1&kod='+kod+'><small>'+c+'</small></a></td>'+
  '<td align=center valign=top>'+fotos+'</td>'+
  '</tr>'
  );
//  '<td align=center>'+(foto.length>0 ? '<a href="imgs/'+foto+'.jpg" target=_blank><img src=images/foto.gif border=0></a>':'')+'</td>'+
}

function vars_line1(raion, metro, pl, cena, cena_, target, c, agent) {
  ++cnt;
  document.write(
  '<tr bgcolor=#'+(cnt%2==1 ? 'e0e0e0':'f0f0f0')+'>'+
  '<td><nobr>'+raion+'</nobr> '+metro+'</td>'+
  '<td align=center>'+pl+'</td>'+
  '<td align=center>'+(cena==0 ? '':cena+' '+cena_)+'</td>'+
  '<td align=center>'+target+'</td>'+
  '<td>'+c+'</td>'+
  '<td>'+agent+'</td>'+
  '</tr>'
  );
}

function dscr_line(name,value) {
  if (value==0 |value.substring(0,1)=='0'| value.length==0) return;
  ++cnt;
  document.write(
  '<tr bgcolor=#'+(cnt%2==1 ? 'e0e0e0':'f0f0f0')+'>'+
  '<td align=right><b>'+name+'</b></td>'+
  '<td align=center>&nbsp;</td>'+
  '<td align=left>'+value+'</td>'+
  '</tr>'
  );
}
function foto_line(name) {
  ++cnt1;
  document.write(
  '<tr><td colspan=3 align=center>'+
  '<b>'+cnt1+'</b> <img align=top id="foto'+cnt1+'" src=images/foto.gif border=0 '+
  'onClick="foto'+cnt1+'.src=(foto'+cnt1+'.src.indexOf(\'images/foto.gif\')>0 ? \'imgs/'+name+'\':\'images/foto.gif\')">'+
  '</td></tr>');
}

function cb_line(chd,kod,name) {
  document.write(
'<td class=chb><input type=checkbox name='+kod+' onClick="seek_reset(\''+kod+'\')"></td><td class=chb>'+name+'</td>'
  );
}


function resetForm()
{
	for(var i=0,j=seek.elements.length; i<j; i++)
	{
		if(seek.elements[i].type == "checkbox")
		{
			seek.elements[i].checked=0;
		}
	}
}

function seek_reset(cur) {
return;
eval('chkd=(seek.'+cur+'.checked==1);');
//alert(chkd);
seek.office.checked=0;
seek.bank.checked=0;
seek.magaz.checked=0;
seek.rest.checked=0;
seek.med.checked=0;
seek.sk.checked=0;
seek.sklad.checked=0;
seek.of_skl.checked=0;
seek.indus.checked=0;
seek.av.checked=0;
seek.ppa.checked=0;
seek.pb.checked=0;
seek.zemlja.checked=0;
seek.kott.checked=0;
seek.free.checked=0;

eval('seek.'+cur+'.checked=(chkd ? 1:0);');
}