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=yes,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=yes,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=no,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();
};

function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}