// center popup images on-screen ?
var centerpop=1;

// --------------------------------------------------
// justpop()
// --------------------------------------------------
function justpop(link) {
	var stat = "dependent,resizable,status=0,scrollbars"
	jwin = window.open(link,"",stat)
} // justpop()

// --------------------------------------------------
// 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=no,width="+ww+",height="+wh

	// -- winopen
	wwin = window.open(link,"",stat)

	if (centerpop) {
		if (mybw.ie5up && !mybw.ie5) {
			wwin.blur()
			window.focus()
		}
	}

	// -- resize/move
	wwin.resizeTo(ww,wh)

	if (centerpop) {
		wwin.moveTo(wx,wy)
	}
	wwin.focus()
} // popwindow()

// --------------------------------------------------
// showpop() - shows INFO in a pop-up window
// --------------------------------------------------
function showpop(w,h,title,info) {
st="dependent,status=0,scrollbars=no,width="+w+",height="+h

minwidth = 180
maxwidth = 1100
maxheight= 800

if (w<minwidth) w=minwidth // cumulative width of 2 buttons: close & print

if (w>maxwidth)  w=maxwidth
if (h>maxheight) h=maxheight

// ----------------------------
var wx=(screen.width/2)-(w/2)-20
var wy=(screen.height/2)-(h/2)-20

newin=window.open("","popWindow",st)
if (centerpop) {
	if (mybw.ie5up && !mybw.ie5) {
		newin.blur()
		window.focus()
	}
}

newin.resizeTo(w,h)

if (centerpop) {
	newin.moveTo(wx,wy)
}

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='/db/admin.css'>"+
"</head><body bgcolor=#eeeeee topmargin=15 letfmargin=15>"+
"<table width=100% border=0 cellspacing=0 cellpadding=1><tr width=100%><td align=center>"+
 info+
"</td></tr></table>&nbsp;"+
 inp+
"</body></html>";

wref=newin.document
wref.write(b)
wref.close()

newin.focus()
} // showpop()

// --------------------------------------------------
// popimg() - shows IMG in a pop-up win
// NEW as of 17.10.2003
// combines features of popwindow() and showpop()
// 0.1	17.10.2003 10:55:03
// --------------------------------------------------
function popimg(img,w,h,atitle) {
w0 = w + 30;
h0 = h + 70;
w1 = w0 - 10;
h1 = h0 - 30;
st="dependent,status=0,scrollbars=no,width="+w1+",height="+h1

if (atitle=="" || atitle=="undefined") atitle="изображение"

var wx=(screen.width/2)-(w0/2)-20
var wy=(screen.height/2)-(h0/2)-20

newin=window.open("","",st)

if (centerpop) {
	if (mybw.ie5up && !mybw.ie5) {
		newin.blur()
		window.focus()
	}
}

newin.resizeTo(w0,h0)

if (centerpop) {
	newin.moveTo(wx,wy)
}
newin.focus()

inp=("<div onclick='self.close()' style='position:absolute;right:7px;down:0px;text-decoration:none' class=menuItem><span style='cursor:pointer;cursor:hand;'>закрыть</span></div>")

b="<html><head><title>"+atitle+"</title>"+
"<link rel=stylesheet type=text/css href=/css/style.css>\n"+
"<link rel=stylesheet type=text/css href=/css/add.css>\n"+
"</head>\n<body bgcolor=#ffffff topmargin=10 letfmargin=10 bottommargin=0>\n"+
"<table width=100% border=0 cellspacing=0 cellpadding=1>\n<tr width=100%><td align=center>\n"+
"<img border=0 width="+w+" height="+h+" src='"+img+"' alt='"+atitle+"'>\n"+
"</td></tr></table>"+
 inp+
"\n</body></html>\n";

wref=newin.document
wref.write(b)
wref.close()
} // popimg()

