function init() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
}

onload=init;

function OpenWindow(filename){
	newWindow=window.open(filename,"new","width=450,top="+(Math.round(window.screen.availheight/2)-225)+",left="+(Math.round(window.screen.availWidth/2)-225)+",height=450,status=no,menubar=no,resizable=yes,toolbar=no,scrollbars=no,location=no'");
	newWindow.focus();
}

function OpenWindowSize(filename,w,h){
	newWindow=window.open(filename,"new","width="+w+",top="+(Math.round(window.screen.availHeight/2-h/2))+",left="+(Math.round(window.screen.availWidth/2-w/2))+",height="+h+",status=no,menubar=no,resizable=yes,toolbar=no,scrollbars=no,location=no'");
	newWindow.focus();
}

function OpenImage(imagename,w,h){
	var img=new Image();
	img.hspace=0;
	img.vspace=0;
	img.src=imagename;
	newWindow=window.open("","new","width="+(w+10)+",top="+(Math.round(window.screen.availheight/2)-h/2)+",left="+(Math.round(window.screen.availWidth/2)-w/2)+",height="+(h+10)+",status=no,menubar=no,resizable=yes,toolbar=no,scrollbars=no,location=no'");
	newWindow.document.write('<html>');
	newWindow.document.write('<head>');
	newWindow.document.write('<title> </title>');
	newWindow.document.write('</head>');
	newWindow.document.write('<body bottommargin="0" topmargin="0" rightmargin="0" leftmargin="0" bgcolor="#808080">');
	newWindow.document.write('<table width=100% height="'+(h+10)+'" align="center" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle"><a href onClick="self.close()" ><img src="'+img.src+'" alt="Нажмите, чтобы закрыть окно" name="im" id="im" hspace="0" vspace="0" border="1"></a></td></tr></table>');
	newWindow.document.write('</body>');
	newWindow.document.write('</html>');
	newWindow.focus();
};


