
var ie4=(navigator.appVersion.indexOf("MSIE")!=-1 && parseFloat(navigator.appVersion)>=4)?true:false;
var nn4=(navigator.appName=="Netscape" && parseFloat(navigator.appVersion)<5)?true:false;
var nn6=(navigator.appName=="Netscape" && parseFloat(navigator.appVersion)>=5)?true:false;



function newImage(arg) {
        if (document.images) {
                rslt = new Image();
                rslt.src = arg;
                return rslt;
        }
}



function changeImages() {
        if (document.images && (preloadFlag == true)) {
                for (var i=0; i<changeImages.arguments.length; i+=2) {
                        document.getElementById(changeImages.arguments[i]).src = changeImages.arguments[i+1];

                }

        }
}


function ShowDivAtPosition(what,parent,xplus,yplus,getWidth){

  var divname=what;

  var submenu = new Array();

  var x=0;

  var y=0;

  if (document.getElementById(getWidth)!=null) var setWidth=document.getElementById(getWidth).clientWidth;

  if(nn6){
   var obj=document.getElementById(parent);
   while (obj!=null) {
    x+=obj.offsetLeft;
    y+=obj.offsetTop;
    obj=obj.offsetParent;
   }
  x=x+xplus;
  y=y+yplus;


  if (setWidth>0) document.getElementById(what).style.width=setWidth;

  document.getElementById(what).style.left=x+"px";
  document.getElementById(what).style.top=y+"px";
  document.getElementById(what).style.visibility = "visible";
  }
  else if(ie4){
  if( document.all[what].style.position.toLowerCase() != "absolute" ) {
   document.all[what].style.position = "static";
  }
  obj=document.all[parent];
  while (obj!=null) {
   x+=obj.offsetLeft;
   y+=obj.offsetTop;
   obj=obj.offsetParent;
  }
  x=x+xplus;
  y=y+yplus;

  if (setWidth>0) document.getElementById(what).style.width=setWidth;

  document.all[what].style.left=x+"px";
  document.all[what].style.top=(y+document.all[parent].clientHeight)+"px";
  document.all[what].style.visibility = "visible";
  }
  else if(nn4){
  document.layers[what].visibility = "show";
  }
}



function TD(what){
 var r="hide";
 if(nn6){
   if (document.getElementById(what).style.display == ""){
     document.getElementById(what).style.display = "none";
   } else {
       r="visible";
       document.getElementById(what).style.display = "";
     }
 }
 else if(ie4){
   if (document.all[what].style.display == ""){
     document.all[what].style.display = "none";
   } else {
       r="visible";
       document.all[what].style.display = "";
     }
 }
 return r;

}




function Div(what){
 var r="hide";
 if(nn6){
   if (document.getElementById(what).style.display == "block"){
     document.getElementById(what).style.display = "none";
   } else {
       r="visible";
       document.getElementById(what).style.display = "block";
     }
 }
 else if(ie4){
   if (document.all[what].style.display == "block"){
     document.all[what].style.display = "none";
   } else {
       r="visible";
       document.all[what].style.display = "block";
     }
 }
 return r;

}


function OpenWindow(id,name,width,height,style) {

        if (style==undefined) style=',scrolling=yes,resizable=yes,scrollbars=yes,status=yes,statusbar=yes'

        var Left = (screen.width  - width) / 2 ;
        var Top  = (screen.height - height) / 2 ;

        window[id]=window.open('',name,'width='+width+',height='+height+',left='+ Left +',top='+ Top +style);
        window[id].focus();
        return false;
}


function deffocus(a){
  if (a.defaultValue==a.value){
    a.value="";
  }
}
function defblur(a) {
  if (a.value=="") {
    a.value=a.defaultValue;
  }
}

function ow(isrc,ititle) {
        win=window.open('','win','width=600,height=500,status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=no,scrolling=no');
        win.document.open();
        win.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n'
        +'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">\n'
        +'<head>\n'
        +'<title>'+((ititle=="") ? 'Увеличенная фотография' : ititle+'')+'</title>\n'
        +'<script type=\"text/javascript\">\n'
        +'      var isDOM=document.getElementById?true:false;\n'
        +'      var isOpera=isOpera5=window.opera && isDOM;\n'
        +'      var isMSIE=isIE=document.all && document.all.item && !isOpera;\n'
        +'      function matchSize(obj) {\n'
        +'              if (!isMSIE) {\n'
        +'                      var dw = self.outerWidth - self.innerWidth;\n'
        +'                      var dh = self.outerHeight - self.innerHeight;\n'
        +'              } else {\n'
        +'                      var dw = 12;\n'
        +'                      var dh = 50;\n'
        +'              }\n'
        +'              self.resizeTo(obj.width+dw,obj.height+dh);\n'
        +'              return;\n'
        +'      }'
        +'</script>'
        +'</head>\n'
        +'<body style="overflow: hidden; margin: 0px; padding: 0px;">\n'
        +'<a href="javascript:void(0);" onclick="window.close(); return false;" title="Кликните, чтобы закрыть окно">'
        +'<img src="'+isrc+'" border="0" onload="matchSize(this);" alt="Кликните, чтобы закрыть окно" /></a>\n'
        +'</body>\n'
        +'</html>');
}