function showImageGal(path,w,h,alt){
    var ie=document.all;
    if(navigator.userAgent.search('Opera')!='-1') ie=false;
    var size=0.9;
    var res=1;
    var sw=screen.width;
    var sh=screen.height;
    if(w>=sw) var res=sw/w*size;
    if(h>=sh&&sh/h*size<res) var res=sh/h*size;
    var nw=w*res;
    var nh=h*res;
    var l= (sw/2) - nw/2;
    var t= (sh/2) - nh/2;
    var controls='<span style="cursor:default;height:10;background:blue;filter:FILTER: progid:DXImageTransform.Microsoft.Alpha( style=1,opacity=100,finishOpacity=25,startX=0,finishX=100,startY=100,finishY=0);" align="right">'+alt+'</span><span style="FONT: 28px Marlett;">r</span>';
    var img='<img src="'+path+'" width="'+nw+'" height="'+nh+'" alt=""/>';
    var body='<body style="margin:0"><img src="'+path+'" width="'+w+'" height="'+h+'" alt=""/></body>';
    //openPopUpGal(l, t, nw, nh+10,controls,img);
    if(ie) openModalGal(w+6,h+32,path,alt);
    else openWindowGal(l,t,nw,nh,alt,body);
}

function openPopUpGal(l,t,w,h,c,i){
    var p=window.createPopup();
    var b=p.document.body;
    p.show(l, t, w, h);
	b.style.border = "1px blue solid";
    b.innerHTML=c+i;
}

function openWindowGal(l,t,w,h,title,body){
    var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,copyhistory=no,width='+w+',height='+h+',l='+l+',t='+t+',screenX='+l+',screenY='+t;
    var msgWindow = window.open("","msgWindow", styleStr);
    var head = '<head><title>'+title+'</title></head>';
    msgWindow.document.write(head + body);
}

function openw(link, width, height){
 window.open(link,'katalog','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width='+width+',height='+height )
}

function PopUp(w, h, id){
var ie=document.all;
    if(navigator.userAgent.search('Opera')!='-1') ie=false;
    var size=0.9;
    var res=1;
    var sw=screen.width;
    var sh=screen.height;
    if(w>=sw) var res=sw/w*size;
    if(h>=sh&&sh/h*size<res) var res=sh/h*size;
    var nw=w*res;
    var nh=h*res;
    var l= (sw/2) - nw/2;
    var t= (sh/2) - nh/2;

    var p=window.createPopup();
    var b=p.document.body;
    p.show(l, t, w, h);
    b.innerHTML='<meta http-equiv=\"refresh\" content=\"0;url=katalog.php?id='+id+'\">';
}


function openModalGal(w,h,img,alt){
    var d= window.showModelessDialog(img,alt,"dialogHeight: "+h+"px; dialogWidth: "+w+"px; dialogTop: px; dialogLeft: px; edge: Lowered; center: Yes; help: No; resizable: No; status: No;");
}
