var ver = 4;

function oImg(sDir, sFileOff, sFileOn, nW, nH, nIniState){
	if (ver){
		this.nState = nIniState;
		this.oOff = new Image(nW, nH);
		this.oOff.src = sDir + sFileOff;
		this.oOn = new Image(nW, nH);
		this.oOn.src = sDir + sFileOn;
		}
	}

function SwapImg(sName){
	if (ver){
		var oImg = eval(sName);
		if( oImg.nState ){
			document.images[sName].src = oImg.oOff.src;
			oImg.nState = 0;
			}
		else{
			document.images[sName].src = oImg.oOn.src;
			oImg.nState = 1;
			}
		}
	}

var swin;

function showwin(nW, nH, sSource, sMode, nSkip, nShiftW, nShiftH, sTitle, sAlt, sWinName){
	var nL = 0;
	var nT = 0;
	var sPos = "";

	if( !sMode ) sMode = "pic";
	if( !nSkip ) nSkip = 0;
	if( !nShiftW ) nShiftW = 0;
	if( !nShiftH ) nShiftH = 0;
	if( !sWinName ) sWinName = "swin";
	nW = parseInt(nW);
	if( isNaN(nW) ) nW = 620;
	nH = parseInt(nH);
	if( isNaN(nH) ) nH = 460;
	nSW = nW + nSkip;
	nSH = nH + nSkip;
	if( ((nL = (screen.width - nSW) / 2 - nShiftW)) < 0 ) nL = 0;
	if( ((nT = (screen.height - nSH) / 2 + nShiftH)) < 0 ) nT = 0;
	if( ver >= 4 ) sPos = ",left=" + nL + ",top=" + nT + ",screenX=" + nL + ",screenY=" + nT;
	switch( sMode ){
		case "url":
			sParams = "width=" + nSW + ",height=" + nSH + ",menubar=no,location=no,toolbar=no,status=no,resizable=no,scrollbars=yes";
			break;
		case "urlh":
			sParams = "width=" + nSW + ",height=" + nSH + ",menubar=no,location=no,toolbar=no,status=no,resizable=yes,scrollbars=yes";
			break;
		case "pich":
			sParams = "width=" + nSW + ",height=" + nSH + ",menubar=no,location=no,toolbar=no,status=no,resizable=yes,scrollbars=yes";
			break;
		case "pic":
		default:
			sParams = "width=" + nSW + ",height=" + nSH + ",menubar=no,location=no,toolbar=no,status=no,resizable=no,scrollbars=no";
			break;
		}
	if( swin ) {
		swin.close();
	}
	if( !sWinName ) sWinName = "swin";
	swin = window.open("", sWinName, sParams + sPos);
	if( swin.document.body ) {
		if( swin.document.body.innerHTML.length > 0 ) {
			swin.close();
			swin = window.open("", sWinName, sParams + sPos);
		}
	}
	switch( sMode ){
		case "url":
		case "urlh":
			swin.location.href = sSource;
			break;
		case "pic":
		case "pich":
		default:
			swin.document.write("<html>\n");
			swin.document.write("<head>\n");
			swin.document.write("<title>" + sTitle + "</title>\n");
			swin.document.write("<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>\n");
			swin.document.write("<link rel='stylesheet' href='../libs/main.css' type='text/css'>\n");
			swin.document.write("</head>\n");
			swin.document.write("<body bgcolor=#ffffff text=#000000 link=#ff6633 vlink=#ff6633 alink=#ff6633 marginwidth=0 marginheight=0 topmargin=0 leftmargin=0>\n");
			swin.document.write("<table width=100% height=100% border=0 cellpadding=0 cellspacing=0>\n");
			swin.document.write("<tr align=center><td>");
			swin.document.write("<a href='javascript:if( self.opener ) self.opener.focus(); self.close();'><img src='" + sSource + "' border=1 width='" + nW + "' height='" + nH + "' alt='" + sAlt + "' title='" + sAlt + "'></a><br>");
			swin.document.write("</td></tr></table>\n");
			swin.document.write("</body>\n");
			swin.document.write("</html>\n");
			break;
		}
	swin.document.close();
	swin.focus();
	}
