function navigate(str){ top.document.location.replace(str); }
var imgDIV=null;
var imgViewPort=null;
function showImage(url){
  if(!imgDIV) renderImgDIV();
  imgViewPort.innerHTML="<IMG src='"+url+"'>";
  resizeDIV();
  imgDIV.style.visibility="visible";
}
function hideImgDIV(){
  if(!imgDIV) return;
  imgDIV.style.visibility="hidden";
}
function renderImgDIV(){
  var d=document;
  imgDIV=d.createElement("DIV");
  imgDIV.style.visibility="hidden";
  imgDIV.style.border="2px solid ActiveBorder";
  imgDIV.style.padding="1px";
  imgDIV.style.backgroundColor="Background";
  imgDIV.style.position="absolute";
  imgDIV.style.cursor="pointer";
  var b=new StringBuilder();
  b.append("<TABLE cellspacing=0 cellpadding=1 width='100%' onclick='hideImgDIV()'>");
  b.append("<TR>");
  b.append("<TD align=right style='background-color:ThreedDarkShadow;color:white;'>");
  b.append("Просмотр полного изображения. Чтобы закрыть, щелкните здесь <BLINK>&raquo;&raquo;</BLINK>");
  b.append("</TD>");
  b.append("<TD width='1%' style='background-color:ThreedDarkShadow;' onclick='hideImgDIV()'>");
  b.append("<IMG src='../images/close.gif'>");
  b.append("</TD>");
  b.append("</TR>");
  b.append("</TABLE>");
  b.append("<DIV title='Щелкните, чтобы закрыть изображение и вернуться к тексту' id=imgViewPort style='border:1px solid ActiveBorder;padding:1px;background-color:ThreedDarkShadow;overflow:auto;text-align:center;vertical-align:middle;height:100%;' onclick='hideImgDIV()'>");
  b.append("&nbsp;");
  b.append("</DIV>");
  imgDIV.innerHTML=b.toString();
  d.body.appendChild(imgDIV);
  imgViewPort=d.getElementById("imgViewPort");
  try{
    top.moveTo(0,0);
    top.resizeTo(screen.availWidth,screen.availHeight);
  }catch(e){}
}
function resizeDIV(){
  if(!imgDIV) return;
  var r=window.size();
  //alert("width="+r.width+" height="+r.height); 
  if(!window.innerWidth){ // IE
    imgDIV.style.width=(r.width-6)+"px";
    imgDIV.style.height=(r.height-6)+"px";
    imgViewPort.style.height=(r.height-26)+"px";
  }else{ // W3C
    imgDIV.style.width=(r.width-22)+"px";
    imgDIV.style.height=(r.height-4)+"px";
    imgViewPort.style.height=(r.height-24)+"px";
  }
  var point=window.center(r);
  imgDIV.style.top=point.y+"px";
  imgDIV.style.left=point.x+"px";
}
window.size=function(){
  var w=0;
  var h=0;
  if(!window.innerWidth){
    if(!(document.documentElement.clientWidth==0)){
      w=document.documentElement.clientWidth;
      h=document.documentElement.clientHeight;
    }else{
      w=document.body.clientWidth;
      h=document.body.clientHeight;
    }
  }else{
    w=window.innerWidth;
    h=window.innerHeight;
  }
  return {width:w,height:h};
}
window.center=function(){
  var hWnd=(arguments[0]!= null) ? arguments[0] : {width:0,height:0};
  var _x=0;
  var _y=0;
  var offsetX=0;
  var offsetY=0;
  if(!window.pageYOffset){
    if(!(document.documentElement.scrollTop==0)){
      offsetY=document.documentElement.scrollTop;
      offsetX=document.documentElement.scrollLeft;
    }else{
      offsetY=document.body.scrollTop;
      offsetX=document.body.scrollLeft;
    }
  }else{
    offsetX=window.pageXOffset;
    offsetY=window.pageYOffset;
  }
  _x=((this.size().width-hWnd.width)/2)+offsetX;
  _y=((this.size().height-hWnd.height)/2)+offsetY;
  return{x:_x,y:_y};
}
window.onresize=resizeDIV;
window.onscroll=hideImgDIV;
/* StringBuilder (C) Lasse Reichstein Nielsen */
function StringBuilder(str){ this._buffer=[]; if(str) this._buffer.push(str); }
StringBuilder.prototype.append=function(str){ this._buffer.push(str); return this; };
StringBuilder.prototype.getLength=function(){ return this._buffer.length; };
StringBuilder.prototype.toString=function(){ return this._buffer.join(""); };