var resId=0;
var imgWndw;

function open_pic_in_php(imgLink) {
  if (typeof(window.resizeBy)=='undefined') return true;
  imgWndw=window.open('',imgLink.target,'width=100,height=100,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=no,left='+(screen.width>>>2)+',top='+(screen.height>>>4));
  imgWndw.focus();
}


function open_pic_in_js(imgLink,Title,imgdesc,copyright,descsize) {
  if (typeof(window.resizeBy)=='undefined') return true;
  imgWndw=window.open('',imgLink.target,'width=100,height=100,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=no,left='+(screen.width>>>2)+',top='+(screen.height>>>4));
  self.focus();
  var imgTitle=(Title)?Title:imgLink.href;
  with (imgWndw.document){
    open();
    write('<html><head><title>'+imgTitle+'</title><link rel="stylesheet" type="text/css" href="/css/popup.css" /><link rel="shortcut icon" href="/favicon.ico" /></head><body margin="0" marginwidth="0" marginheight="0"><img src="'+imgLink.href+'" border="0" alt="'+imgTitle+'" title="'+imgTitle+'" onClick="window.close()">');
    sp=0;
    if (imgdesc) {write('<div id="imgdesc">'+imgdesc+'</div>'); sp=40;};
    if (copyright) {write('<div id="copyright">'+copyright+'</div>'); sp=60;};
	if (descsize) {sp=descsize;};
    write('</body></html>');
    close();
  }
  resId=setInterval('imgResize()',100);
  return false
}

function imgResize() {
  var w=imgWndw.document.images[0].width;
  if (w>screen.availWidth) w=screen.availWidth;
  var h=imgWndw.document.images[0].height;
  if (h>screen.availHeight) h=screen.availHeight;
  if (w>50 && h>50) {

    var ww=(imgWndw.innerWidth)?imgWndw.innerWidth:((document.body)?
      imgWndw.document.body.clientWidth:null);
    var wh=(imgWndw.innerHeight)?imgWndw.innerHeight:((document.body)?
      imgWndw.document.body.clientHeight:null);
    opera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false 
    mozilla=(navigator.userAgent.indexOf("Mozilla/5")!=-1)?true:false
    chrome=(navigator.userAgent.indexOf("Chrome")!=-1)?true:false 
    if(opera){sp=sp+0;}
    if(mozilla){sp=sp+0;}
    if(chrome){sp=sp+60;}
    if (ww && wh) {imgWndw.resizeBy(w-ww,h-wh+sp);}
    imgWndw.focus();
    clearInterval(resId)
  }
}


function ring_appearance (num_pic,pos_x,pos_y)
{
if (num_pic=='1') {document.all.show_ring1.innerHTML="<div style=\"margin-top\:"+pos_x+"px\; margin-left\:"+pos_y+"px\; background-image:URL('img\/redring.gif\')\; background-repeat\: no-repeat\"\><img src=img\/pixel.gif width=1 border=0 align=center height=60>";}
if (num_pic=='2') {document.all.show_ring2.innerHTML="<div style=\"margin-top\:"+pos_x+"px\; margin-left\:"+pos_y+"px\; background-image:URL('img\/redring.gif\')\; background-repeat\: no-repeat\"\><img src=img\/pixel.gif width=1 border=0 align=center height=60>";}
if (num_pic=='3') {document.all.show_ring3.innerHTML="<div style=\"margin-top\:"+pos_x+"px\; margin-left\:"+pos_y+"px\; background-image:URL('img\/redring.gif\')\; background-repeat\: no-repeat\"\><img src=img\/pixel.gif width=1 border=0 align=center height=60>";}
if (num_pic=='4') {document.all.show_ring4.innerHTML="<div style=\"margin-top\:"+pos_x+"px\; margin-left\:"+pos_y+"px\; background-image:URL('img\/redring.gif\')\; background-repeat\: no-repeat\"\><img src=img\/pixel.gif width=1 border=0 align=center height=60>";}
}

function ring_disappearance (num_pic)
{
if (num_pic=='1') {document.all.show_ring1.innerHTML="";}
if (num_pic=='2') {document.all.show_ring2.innerHTML="";}
if (num_pic=='3') {document.all.show_ring3.innerHTML="";}
if (num_pic=='4') {document.all.show_ring4.innerHTML="";}
}


function showByLink(object,link,x,y) {
    if (document.layers && document.layers[object]) {
        document.layers[object].left = link.x + x;
        document.layers[object].top = link.y + y;
        document.layers[object].visibility = 'visible';
    }
    else if (document.all) {
        document.all[object].style.visibility = 'visible';

        if (document.all[object].myFlag == null) {
            document.all[object].style.posLeft = document.all[object].offsetLeft + x;
            document.all[object].style.posTop = document.all[object].offsetTop + y;
        }

        document.all[object].myFlag = true;
    }
}

function hide(object) {
    if (document.layers && document.layers[object])
        document.layers[object].visibility = 'hidden';
    else if (document.all)
        document.all[object].style.visibility = 'hidden';
}


var resId=1;
var ratWndw;


function ratingOpen(picture,rate) {
  if (typeof(window.resizeBy)=='undefined') return true;
  ratWndw=window.open('','','width=130,height=100,toolbar=no,menubar=no,location=no,status=no,resizable=yes,scrollbars=no,left='+(screen.width>>>2)+',top='+(screen.height>>>4));
  self.focus();
  with (ratWndw.document){
    open();
    write('<html><head><title>Оценка</title><link rel="shortcut icon" href="/gaz20.ico"><link rel="stylesheet" type="text/css" href="/gaz20.css"></head><body bgcolor="#EBBF94">');
    write('<center><form action="/cgi-bin/rate.cgi" method=post><input type=hidden name="pic_no" value='+picture+'><input type=hidden name="rating" value='+rate+'>');
    if (rate=='1') {write('кол?')};
    if (rate=='2') {write('двойка?')};
    if (rate=='3') {write('трояк?')};
    if (rate=='4') {write('четверка?')};
    if (rate=='5') {write('пятерка?')};
    write('<br><br><input type=submit value="ДА!"></form></center>');
    write('</body></html>');
    close();
  }
  ratWndw.focus();
}


