dom = (document.getElementById) ? 1 : 0;
ie = (navigator.appName != "Netscape" && document.all) ? 1 : 0;
opera = (navigator.appName == "Opera") ? 1 : 0;
netscape = (navigator.appName == "Netscape") ? 1 : 0;

var sPop1 = false;


function iPopMenu (src, width, height, url) {
	//scrltp = getScrollY(window);

	document.getElementById("popLayer").innerHTML = "";	
	
	width_ = width + 20;

	if (url) {
		height_ = height + 50;
		resize_popup(width_, height_);
		
		document.getElementById("popLayer").innerHTML = "<img width='" + width + "' height='" + height + "' style='cursor: pointer' onClick='hide_popup()' src='" + src + "'><p><a href='" + url + "' target='_blank'>Перейти на сайт</a></p>";
	} else {
		height_ = height + 20;
		resize_popup(width_, height_);
		
		document.getElementById("popLayer").innerHTML = "<br><br><br><br><br><br><br><br><br><img width='" + width + "' height='" + height + "' style='cursor: pointer' onClick='hide_popup()' src='" + src + "'>";
	}
	
	document.getElementById("popLayer").style.display = "inline";
	document.getElementById("popLayer").style.visibility = "visible";
}


function hide_popup () {
	document.getElementById("popLayer").style.display = "none";
	document.getElementById("popLayer").style.visibility = "hidden";
}


function resize_popup (width, height) {
	lr = layer("popLayer");

	lft = (getWindowWidth(false) / 2) - width / 2;
	tp = (getWindowHeight(false) / 2) - height / 2;

	if (lft < 0) lft = 0;
	if (tp < 0) tp = 0;
	lr.moveTo(lft, tp);
	lar = document.getElementById('popLayer');

	if (opera || netscape) {
		width = width - 20;
		height = height - 20;
	}
	if (width < 1) width = 1;
	if (height < 1) height = 1;
	lar.style.width = width;
	lar.style.height = height;
}

function check_scroll (ob) {
	if (document.getElementById("popLayer").style.display == "inline" && (document.getElementById("popLayer").style.overflow == "auto" || sPop1)) movePopup();
}