function openpage(pagenumber) {
  //отправляет постом номер выводимой страницы
  document.getElementById("startelement").value = pagenumber;
  a=document.getElementById("ProdPage");
  a.submit();
}

function getDims(winWidth, winHeight) {
	var dims = new Object();
	if (winWidth) {
		dims.width = winWidth;
		dims.scrollbars = false;
		if (screen.width < dims.width + 70) {
			dims.width = screen.width - 70;
			dims.scrollbars = true;
		}
	}

	if (winHeight) {
		dims.height = winHeight;
		if (screen.height < dims.height + 100) {
			dims.height = screen.height - 100;
			dims.scrollbars = true;
		}
	}
	dims.heightStr = (winHeight)? ',height=' + dims.height : '';
	dims.scrollbarsStr = (dims.scrollbars)? ',scrollbars=yes' : ',scrollbars=no';
	dims.width=(dims.scrollbars)? dims.width+17 : dims.width;
	dims.widthStr = (winWidth)? ',width=' + dims.width : '';
	dims.posX = Math.round((screen.width - dims.width) / 2);
	dims.posY = Math.round((screen.height - winHeight) / 2);
	dims.posCode = (document.all)? ',left=' + dims.posX + ',top=' + dims.posY : ',screenX=' + dims.posX + ',screenY=' + dims.posY;
	return dims;
}
function popupImg(imgSrc, winName, imgWidth, imgHeight, winTitle) {

	winWidth = (imgWidth)? imgWidth +0 : null;
	winHeight = (imgHeight)? imgHeight + 0 : null;
	var dims = getDims(winWidth, winHeight);
	var popupWin = window.open('', winName, 'menubar=no,toolbar=no,resizable=yes,status=yes' + dims.scrollbarsStr + dims.widthStr + dims.heightStr + dims.posCode);
	if (popupWin) {
		popupWin.document.open();
		popupWin.document.write('<html><head><title>' + winTitle + '</title></head><body bgcolor="white" style="margin: 0px 0px; padding: 0px;">')
		popupWin.document.write('<img src="' + imgSrc + '" width="' + imgWidth + '" height="' + imgHeight + '" />')
		popupWin.document.write('</body></html>')
		popupWin.document.close();
	}
	return false;
}