// -------------------------------------------------------
// brck.js
// -------------------------------------------------------
function brck(){
d=document
this.ver=navigator.appVersion
this.agt=navigator.userAgent.toLowerCase()
this.major=parseInt(this.ver)
this.minor=parseFloat(this.ver)
this.dom=typeof(d.getElementById)!='undefined'
this.win=this.agt.indexOf('windows')!=-1 || this.agt.indexOf('win')!=-1
this.mac=this.agt.indexOf('mac')!=-1
this.op=this.agt.indexOf('opera')!=-1
this.op5=(this.agt.indexOf('opera 5')!=-1 || this.agt.indexOf('opera/5')!=-1)
this.ie=(this.agt.indexOf('msie')!=-1 && !this.op)
this.ie3=(this.ie && this.major<4)
this.ie4=(this.ie && this.major==4 && this.agt.indexOf('msie 4')!=-1)
this.ie4up=(this.ie && this.major>=4)
this.ie5=(this.ie && this.major==4 && this.agt.indexOf('msie 5')!=-1)
this.ie5up=(this.ie && !this.ie3 && !this.ie4)
this.ie6=(this.ie && this.major==4 && this.agt.indexOf('msie 6')!=-1)
this.ie7=(this.ie && this.major==4 && this.agt.indexOf('msie 7')!=-1)
this.ns=this.agt.indexOf('mozilla')!=-1 && this.agt.indexOf('msie')==-1
this.ns4=(this.ns && this.major==4)
this.ns4up=(this.ns && this.major>=4)
this.ns6=(this.ns && this.major==5)
this.ns6up=(this.ns && this.major>=5)
this.gecko=this.agt.indexOf('gecko')!=-1
this.v4up=this.ns4up||this.ie4up
this.v5up=this.ns6up||this.ie5up
this.bw=this.v4up||this.op5
return this
}
var mybw=new brck()

// -------------------------------------------------------
// popwin.js
// -------------------------------------------------------

// --------------------------------------------------
// sendmessage()
// --------------------------------------------------
function sendmessage() {
   popwindow("/sendmessage.php",520,400);
} // sendmessage()

// --------------------------------------------------
// popmap() - shows map with hidden div in pop-up win
// combines features of popwindow() and showpop()
// 0.3  23.10.2006 12:24:09 - version of `popimg`
// 0.2  07.12.2004 11:03:27 - some fixes
// 0.1  17.10.2003 10:55:03
// --------------------------------------------------
function popmap(img,w,h,atitle,address,address2,colon) {
w1 = w + 30;
h1 = h + 90;

st="dependent,status=0,scrollbars=no,width="+w1+",height="+h1

if (atitle=="") atitle="карта проезда"

var wx=(screen.width/2)-(w1/2)-20
var wy=(screen.height/2)-(h1/2)-20

newin=window.open("","",st)
if (mybw.ie5up && !mybw.ie5) {
  newin.blur()
  window.focus()
}

newin.moveTo(wx,wy)
newin.resizeTo(w1,h1)
newin.focus()

inp="<div style='position:absolute;right:10px;bottom:1px;text-decoration:none' class='noprint'>\n";
inp+="<input type=button onclick='print()' class=button name='1' value='печать'>";
//inp+="&nbsp;<input onclick='self.close()' type=button class=button name='2' value='закрыть'>";
inp+="</div>\n";


//div = "<div class='printit'><img class='printit' src='/pic/colon"+colon+".gif' width='650' height='108' border=0 alt='1-й Архитектор бизнеса' title='1-й Архитектор бизнеса'><br clear=all>";
div = "<div class='printit'><img class='printit' src='/pic/colon"+colon+".gif' width='650' height='108' border=0 alt='1-й Архитектор бизнеса' title='1-й Архитектор бизнеса'><br clear=all>";
div+="<h3>"+atitle+"</h3>";
div+= address;
div+= "<br>\n</div>";


b ="<html><head><title>"+atitle+"</title>"+
"<link rel=stylesheet type=text/css href=/css/st.css></link>\n"+
"<link rel=stylesheet type=text/css href=/css/print.css></link>\n";
if (mybw.gecko) b+='<link rel="stylesheet" href="/css/gecko.css" type="text/css"></link>';
else b+='<link rel="stylesheet" href="/css/ie.css" type="text/css"></link>';
b+="</head>\n";

b+="<body bgcolor=#ffffff topmargin=5 letfmargin=5 bottommargin=5 marginwidth=5 marginheight=5 leftmargin=5 rightmargin=5>\n"+
 div+
"<table width=100% border=0 cellspacing=0 cellpadding=1 class='curs'>\n<tr width=100%><td>\n"+
"<img border=0 class='both' onclick='javascript:self.close()'width="+w+" height="+h+" src='"+img+"' alt='"+atitle+"' title='"+atitle+"'>\n"+
"</td></tr></table>\n"+
"<div class='printit' style='width:600px'>"+ address2 +
"</div>"+ 
 inp+
"</body></html>\n";

wref=newin.document
wref.write(b)
wref.close()
} // popmap()

// --------------------------------------------------
// justpop()
// --------------------------------------------------
function justpop(link) {
  var stat = "dependent,resizable,status=0,scrollbars"
  jwin = window.open(link,"",stat)
} // justpop()

// --------------------------------------------------
// poppic() - like showpop(), but only for images
// --------------------------------------------------
function poppic(w,h,img,alt) {
  var w1 = w - 40;
  var h1 = h - 110;
  info = "<img src="+img+" width="+w1+" height="+h1+" title='"+alt+"' alt='"+alt+"' border=1>";
  showpop(w,h,alt,info);
} // poppic()

// --------------------------------------------------
// popimg() - like showpop(), but only for images
// --------------------------------------------------
function popimg(w,h,img,alt) {
  info = '<img src="'+img+'" width="'+w+'" height="'+h+'" alt="'+alt+'" title="'+alt+'" border="1">';
  w += 40;
  h += 90; //if (mybw.gecko) h += 20;
  h += 15;
  showpop(w,h,alt,info);
} // popimg()

// --------------------------------------------------
// popwindow() - shows LINK in a pop-up window
// --------------------------------------------------
function popwindow_0(link,ww,wh) {
  var stat = 'dependent,status=0,resizable=0,titlebar=0,scrollbars=no,width='+ww+',height='+wh
  var wx=(screen.width-ww)/2
  if (mybw.ie) wx-=20
  var wy=(screen.height-wh)/2
  if (mybw.ie) wy-=20

  wwin = window.open(link, "newwin", stat)
  if (mybw.ie5up && !mybw.ie5) {
    wwin.blur()
    window.focus()
  }
  wwin.resizeTo(ww,wh)
  wwin.moveTo(wx,wy)
  wwin.focus()
} // popwindow_0()

// --------------------------------------------------
// popwindow() - shows LINK in a pop-up window
// $ver: 0.17, $last: 24.10.2003 14:02:40
// --------------------------------------------------
// 0.17 24.10.2003 14:02:37
//      now you can pass '%'s as width and height
// 0.16 03.07.2003 11:07:54
//      since 0.16 it's not necessary to specify
//      width and height of window (will be default)
// --------------------------------------------------
function popwindow(link,ww,wh) {
  // -- width
  wws = ww.toString()
  len = wws.length

  if (!ww || ww.length==0 || ww==0) ww = 800;
  if (ww=='100%' || ww.toString.toUpperCase=='FULL') {
    ww=screen.width
    var wx=0
  }
  else {
    if (wws.substr(len-1,1)=="%") {
      wws = wws.substr(0,len-1)
      w = parseInt(wws)
      ww = (w*screen.width)/100
    }
    var wx=(screen.width/2)-(ww/2)-20
  }

  // -- height
  whs = wh.toString()
  len = whs.length

  if (!wh || wh.length==0 || wh==0) wh = 600;
  if (wh=='100%' || wh.toString.toUpperCase=='FULL') {
    wh=screen.height
    if (mybw.ie) wh-=23
    var wy = 0
  }
  else {
    if (whs.substr(len-1,1)=="%") {
      whs = whs.substr(0,len-1)
      h = parseInt(whs)
      wh = (h*screen.height)/100
    }
    var wy=(screen.height/2)-(wh/2)-20
  }

  // -- stat
  var stat = "dependent,resizable=0,status=0,scrollbars=0,width="+ww+",height="+wh

  // -- winopen
  wwin = window.open(link,"",stat)
  if (mybw.ie5up && !mybw.ie5) {
    wwin.blur()
    window.focus()
  }

  // -- resize/move
  wwin.resizeTo(ww,wh)
  wwin.moveTo(wx,wy)
  wwin.focus()
} // popwindow()

// --------------------------------------------------
// scrollwindow()
// same as popwindow() above, but with scrollbars
// --------------------------------------------------
function scrollwindow(link,ww,wh) {
  // -- width
  wws = ww.toString()
  len = wws.length

  if (!ww || ww.length==0 || ww==0) ww = 800;
  if (ww=='100%' || ww.toString.toUpperCase=='FULL') {
    ww=screen.width
    var wx=0
  }
  else {
    if (wws.substr(len-1,1)=="%") {
      wws = wws.substr(0,len-1)
      w = parseInt(wws)
      ww = (w*screen.width)/100
    }
    var wx=(screen.width/2)-(ww/2)-20
  }

  // -- height
  whs = wh.toString()
  len = whs.length

  if (!wh || wh.length==0 || wh==0) wh = 600;
  if (wh=='100%' || wh.toString.toUpperCase=='FULL') {
    wh=screen.height
    if (mybw.ie) wh-=23
    var wy = 0
  }
  else {
    if (whs.substr(len-1,1)=="%") {
      whs = whs.substr(0,len-1)
      h = parseInt(whs)
      wh = (h*screen.height)/100
    }
    var wy=(screen.height/2)-(wh/2)-20
  }

  // -- stat
  var stat = "dependent,resizable=1,status=0,scrollbars=1,width="+ww+",height="+wh

  // -- winopen
  wwin = window.open(link,"",stat)
  if (mybw.ie5up && !mybw.ie5) {
    wwin.blur()
    window.focus()
  }

  // -- resize/move
  wwin.resizeTo(ww,wh)
  wwin.moveTo(wx,wy)
  wwin.focus()
} // scrollwindow()

// --------------------------------------------------
// showpop() - shows INFO in a pop-up window
// --------------------------------------------------
function showpop(w,h,title,info) {
st="dependent,status=0,resizable=0,titlebar=0,scrollbars=0,width="+w+",height="+h

var wx=(screen.width/2)-(w/2);
if (mybw.ie) wx-=20;
var wy=(screen.height/2)-(h/2);
if (mybw.ie) wy-=20;

newin=window.open("","popWindow",st)

if (mybw.ie5up && !mybw.ie5) {
  newin.blur()
  window.focus()
}
newin.resizeTo(w,h)
newin.moveTo(wx,wy)
newin.focus()

inp=mybw.v5up?
("<div id='divinp'><input class=button type=button value='закрыть' onclick='self.close()'></div>"):
("<form name=f1><input class=button type=button value='закрыть' onclick='self.close()'></form>")

b="<html><head><title>"+title+"</title>"+
"<link rel='stylesheet' type='text/css' href='/css/st.css'></link>"+
"<link rel='stylesheet' type='text/css' href='/css/add.css'></link>"+
"</head><body bgcolor=#eeeeee marginwidth=5 marginheight=5 leftmargin=5 topmargin=5 rightmargin=5 bottommargin=5>"+
"<div style='height:100%;border:0px green dotted'><table height=95% width=100% border=0 cellspacing=0 cellpadding=1><tr width=100% valign=middle><td height=100% align=center>"+
 info+
"</td></tr></table>"+
 inp+
"</div></body></html>";
wref=newin.document
wref.write(b)
wref.close()
} // showpop()

// --------------------------------------------------
// popreg()
// --------------------------------------------------
function popreg(w,h) {
  popwindow('reg_form.php',w,h-5);
} // popreg()

// --------------------------------------------------
// popwindowscroll() - shows LINK in a pop-up window
// --------------------------------------------------
function popwindowscroll(link,ww,wh) {
  var stat = 'dependent,resizable=1,status=0,scrollbars=yes,width='+ww+',height='+wh
  var wX=(screen.width/2)-(ww/2)-20
  var wY=(screen.height/2)-(wh/2)-20

  wwin = window.open(link, "newwin", stat)
  if (mybw.ie5up && !mybw.ie5) {
    wwin.blur()
    window.focus()
  }
  wwin.resizeTo(ww,wh)
  wwin.moveTo(wX,wY)
  wwin.focus()
} // popwindowscroll()
// --------------------------------------------------
// popwindow_sb() - shows LINK in a pop-up window with scroll-bar
// --------------------------------------------------
function popwindow_sb(link,ww,wh) {
  wh1=0;ww1=0;
  var _mon_h=screen.height-100;
  var _mon_w=screen.width-20;
  if (wh>_mon_h){
    wh1=_mon_h-150; _sb="yes";ww1=ww+25; wX=2;
  }
  else {wh1=wh;ww1=ww;_sb="no"}
  var wX=(screen.width/2)-(ww1/2)-20
  var wY=(screen.height/2)-(wh1/2)-20

  stat = 'width='+ww1+',height='+wh1+'menubar=no,scrollbars='+_sb+',status=no,toolbar=no';
  var rn = Math.floor(Math.random()*0x7FFFF);
  wwin = window.open("",link.target, stat)

  if (mybw.ie5up && !mybw.ie5) {
    wwin.blur()
    window.focus()
  }
  wwin.moveTo(wX,wY)
  wwin.focus()

  wref=wwin.document
  b="<body leftmargin=0 topmargin=0 rightmargin=0 bottommargin=0 marginwidth=0 marginheight=0 style='cursor:pointer;cursor:hand' onclick='javascript:self.close()'>";
  b+="<img src="+link+" width="+ww+" hight="+wh+" border=0></body>"
  wref.write(b)
  wref.close()
  wwin.focus()
} // popwindow_sb()

